about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-09 20:40:13 +0000
committerJames Booth <boothj5@gmail.com>2016-01-09 20:40:13 +0000
commitfcbd2592cf5f2c7d1006f0f45a278b2c53a33704 (patch)
tree9c838069858063ea46e82c09475375d64497aa02 /src
parent841f907308f7a539e66a3be4f463ff2ed5941104 (diff)
downloadprofani-tty-fcbd2592cf5f2c7d1006f0f45a278b2c53a33704.tar.gz
Use different colour for roster chat rooms with unread messages
Diffstat (limited to 'src')
-rw-r--r--src/ui/rosterwin.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index a3540d01..f54b2734 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -373,8 +373,13 @@ void
 _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
 {
     GString *msg = g_string_new(" ");
-    theme_item_t presence_colour = theme_main_presence_attrs("online");
-    wattron(layout->subwin, theme_attrs(presence_colour));
+
+    if (mucwin->unread > 0) {
+        wattron(layout->subwin, theme_attrs(THEME_GREEN_BOLD));
+    } else {
+        wattron(layout->subwin, theme_attrs(THEME_GREEN));
+    }
+
     int indent = prefs_get_roster_contact_indent();
     int current_indent = 0;
     if (indent > 0) {
@@ -398,11 +403,16 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
     gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
     win_sub_print(layout->subwin, msg->str, FALSE, wrap, current_indent);
     g_string_free(msg, TRUE);
-    wattroff(layout->subwin, theme_attrs(presence_colour));
+
+    if (mucwin->unread > 0) {
+        wattroff(layout->subwin, theme_attrs(THEME_GREEN_BOLD));
+    } else {
+        wattroff(layout->subwin, theme_attrs(THEME_GREEN));
+    }
 }
 
 static int
-_compare_rooms(ProfMucWin *a, ProfMucWin *b)
+_compare_rooms_unread(ProfMucWin *a, ProfMucWin *b)
 {
     if (a->unread > b->unread) {
         return -1;
@@ -422,7 +432,7 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline)
     while (curr_room) {
         ProfMucWin *mucwin = wins_get_muc(curr_room->data);
         if (mucwin) {
-            rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms);
+            rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms_unread);
         }
         curr_room = g_list_next(curr_room);
     }