about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-26 22:20:37 +0000
committerJames Booth <boothj5@gmail.com>2014-10-26 22:20:37 +0000
commitc8b524d9c8364ca56562d9e63d5e41cd75deef81 (patch)
tree55600f043de9d9a670ca43c5c484f68706ef45b2 /src/ui
parent6c980969e051676dbd7ee62e19b8463ad57e7852 (diff)
downloadprofani-tty-c8b524d9c8364ca56562d9e63d5e41cd75deef81.tar.gz
Show message on /prefs desktop when notifications not supported by the build
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c135
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.");
     }
 }