1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 00:03:26 +01:00

add setting to disable terminal alerts

This commit is contained in:
Jfreegman 2014-04-11 21:47:09 -04:00
parent e384f87a04
commit 766ae685c2
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,9 @@ time:24;
# 1 to enable autologging, 0 to disable # 1 to enable autologging, 0 to disable
autolog:0; autolog:0;
# 1 to disbale terminal alerts on messages, 0 to enable
disable_alerts:0;
# 1 to use native terminal colours, 0 to use toxic default colour theme # 1 to use native terminal colours, 0 to use toxic default colour theme
colour_theme:0; colour_theme:0;

View File

@ -189,7 +189,7 @@ void alert_window(ToxWindow *self, int type, bool is_beep)
StatusBar *stb = prompt->stb; StatusBar *stb = prompt->stb;
if (is_beep && stb->status != TOX_USERSTATUS_BUSY) if (is_beep && stb->status != TOX_USERSTATUS_BUSY && user_settings->alerts == ALERTS_ENABLED)
beep(); beep();
} }

View File

@ -30,6 +30,7 @@
static void uset_autolog(struct user_settings *s, int val); static void uset_autolog(struct user_settings *s, int val);
static void uset_time(struct user_settings *s, int val); static void uset_time(struct user_settings *s, int val);
static void uset_alerts(struct user_settings *s, int val);
static void uset_colours(struct user_settings *s, int val); static void uset_colours(struct user_settings *s, int val);
static void uset_ain_dev(struct user_settings *s, int val); static void uset_ain_dev(struct user_settings *s, int val);
static void uset_aout_dev(struct user_settings *s, int val); static void uset_aout_dev(struct user_settings *s, int val);
@ -40,6 +41,7 @@ struct {
} user_settings_list[] = { } user_settings_list[] = {
{ "autolog", uset_autolog }, { "autolog", uset_autolog },
{ "time", uset_time }, { "time", uset_time },
{ "disable_alerts", uset_alerts },
{ "colour_theme", uset_colours }, { "colour_theme", uset_colours },
{ "audio_in_dev", uset_ain_dev }, { "audio_in_dev", uset_ain_dev },
{ "audio_out_dev", uset_aout_dev }, { "audio_out_dev", uset_aout_dev },
@ -57,6 +59,10 @@ static void uset_time(struct user_settings *s, int val)
s->time = val == TIME_12 ? TIME_12 : TIME_24; s->time = val == TIME_12 ? TIME_12 : TIME_24;
} }
static void uset_alerts(struct user_settings *s, int val)
{
s->alerts = val == ALERTS_DISABLED ? ALERTS_DISABLED : ALERTS_ENABLED;
}
static void uset_colours(struct user_settings *s, int val) static void uset_colours(struct user_settings *s, int val)
{ {
/* use default toxic colours if invalid value */ /* use default toxic colours if invalid value */

View File

@ -20,11 +20,12 @@
* *
*/ */
#define NUM_SETTINGS 5 #define NUM_SETTINGS 6
/* holds user setting values */ /* holds user setting values */
struct user_settings { struct user_settings {
int autolog; /* boolean */ int autolog; /* boolean */
int alerts; /* boolean */
int time; /* 12 or 24 */ int time; /* 12 or 24 */
int colour_theme; /* boolean (0 for default toxic colours) */ int colour_theme; /* boolean (0 for default toxic colours) */
long int audio_in_dev; long int audio_in_dev;
@ -38,6 +39,9 @@ enum {
TIME_24 = 24, TIME_24 = 24,
TIME_12 = 12, TIME_12 = 12,
ALERTS_DISABLED = 1,
ALERTS_ENABLED = 0,
NATIVE_COLS = 1, NATIVE_COLS = 1,
DFLT_COLS = 0, DFLT_COLS = 0,
}; };