diff options
author | James Booth <boothj5@gmail.com> | 2014-10-26 22:20:37 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-10-26 22:20:37 +0000 |
commit | c8b524d9c8364ca56562d9e63d5e41cd75deef81 (patch) | |
tree | 55600f043de9d9a670ca43c5c484f68706ef45b2 /src | |
parent | 6c980969e051676dbd7ee62e19b8463ad57e7852 (diff) | |
download | profani-tty-c8b524d9c8364ca56562d9e63d5e41cd75deef81.tar.gz |
Show message on /prefs desktop when notifications not supported by the build
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/console.c | 135 |
1 files changed, 75 insertions, 60 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 73aa9710..ae31ac11 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -944,68 +944,83 @@ _cons_show_ui_prefs(void) static void _cons_notify_setting(void) { - if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) - cons_show("Messages (/notify message) : ON"); - else - cons_show("Messages (/notify message) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) - cons_show("Messages current (/notify message) : ON"); - else - cons_show("Messages current (/notify message) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) - cons_show("Messages text (/notify message) : ON"); - else - cons_show("Messages text (/notify message) : OFF"); - - char *room_setting = prefs_get_string(PREF_NOTIFY_ROOM); - if (g_strcmp0(room_setting, "on") == 0) { - cons_show ("Room messages (/notify room) : ON"); - } else if (g_strcmp0(room_setting, "off") == 0) { - cons_show ("Room messages (/notify room) : OFF"); - } else { - cons_show ("Room messages (/notify room) : %s", room_setting); - } - prefs_free_string(room_setting); - - if (prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT)) - cons_show("Room current (/notify room) : ON"); - else - cons_show("Room current (/notify room) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) - cons_show("Room text (/notify room) : ON"); - else - cons_show("Room text (/notify room) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_TYPING)) - cons_show("Composing (/notify typing) : ON"); - else - cons_show("Composing (/notify typing) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) - cons_show("Composing current (/notify typing) : ON"); - else - cons_show("Composing current (/notify typing) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_INVITE)) - cons_show("Room invites (/notify invite) : ON"); - else - cons_show("Room invites (/notify invite) : OFF"); - - if (prefs_get_boolean(PREF_NOTIFY_SUB)) - cons_show("Subscription requests (/notify sub) : ON"); - else - cons_show("Subscription requests (/notify sub) : OFF"); + gboolean notify_enabled = FALSE; +#ifdef HAVE_OSXNOTIFY + notify_enabled = TRUE; +#endif +#ifdef HAVE_LIBNOTIFY + notify_enabled = TRUE; +#endif +#ifdef PLATFORM_CYGWIN + notify_enabled = TRUE; +#endif - gint remind_period = prefs_get_notify_remind(); - if (remind_period == 0) { - cons_show("Reminder period (/notify remind) : OFF"); - } else if (remind_period == 1) { - cons_show("Reminder period (/notify remind) : 1 second"); + if (notify_enabled) { + if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) + cons_show("Messages (/notify message) : ON"); + else + cons_show("Messages (/notify message) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) + cons_show("Messages current (/notify message) : ON"); + else + cons_show("Messages current (/notify message) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) + cons_show("Messages text (/notify message) : ON"); + else + cons_show("Messages text (/notify message) : OFF"); + + char *room_setting = prefs_get_string(PREF_NOTIFY_ROOM); + if (g_strcmp0(room_setting, "on") == 0) { + cons_show ("Room messages (/notify room) : ON"); + } else if (g_strcmp0(room_setting, "off") == 0) { + cons_show ("Room messages (/notify room) : OFF"); + } else { + cons_show ("Room messages (/notify room) : %s", room_setting); + } + prefs_free_string(room_setting); + + if (prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT)) + cons_show("Room current (/notify room) : ON"); + else + cons_show("Room current (/notify room) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) + cons_show("Room text (/notify room) : ON"); + else + cons_show("Room text (/notify room) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_TYPING)) + cons_show("Composing (/notify typing) : ON"); + else + cons_show("Composing (/notify typing) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) + cons_show("Composing current (/notify typing) : ON"); + else + cons_show("Composing current (/notify typing) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_INVITE)) + cons_show("Room invites (/notify invite) : ON"); + else + cons_show("Room invites (/notify invite) : OFF"); + + if (prefs_get_boolean(PREF_NOTIFY_SUB)) + cons_show("Subscription requests (/notify sub) : ON"); + else + cons_show("Subscription requests (/notify sub) : OFF"); + + gint remind_period = prefs_get_notify_remind(); + if (remind_period == 0) { + cons_show("Reminder period (/notify remind) : OFF"); + } else if (remind_period == 1) { + cons_show("Reminder period (/notify remind) : 1 second"); + } else { + cons_show("Reminder period (/notify remind) : %d seconds", remind_period); + } } else { - cons_show("Reminder period (/notify remind) : %d seconds", remind_period); + cons_show("Notification support was not included in this build."); } } |