about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-05-31 09:41:18 +0200
committerMichael Vetter <jubalh@iodoru.org>2021-05-31 09:41:18 +0200
commit2bfe11ed828805e1a810cf3a22036710739743d7 (patch)
tree76a7ea5c576d1e9cb223e34495e4eda525d4a03e /src/ui
parent47e39a79759eddbacf8c738f8415e3e96381116e (diff)
downloadprofani-tty-2bfe11ed828805e1a810cf3a22036710739743d7.tar.gz
Display attention hint in titlebar for mucs too
* Display the `[ATTENTION]` hint in the titlebar for both chatwins and
mucwins.
* Use THEME_TITLE_TEXT instead of THEME_TITLE_ENCRYPT
* Have separate function `_show_attention` and don't do it in unrelated
  `_show_privacy`.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/titlebar.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 0b2187ce..98af2b24 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -67,6 +67,7 @@ static void _show_contact_presence(ProfChatWin* chatwin, int pos, int maxpos);
 static void _show_privacy(ProfChatWin* chatwin);
 static void _show_muc_privacy(ProfMucWin* mucwin);
 static void _show_scrolled(ProfWin* current);
+static void _show_attention(ProfWin* current, gboolean attention);
 
 void
 create_title_bar(void)
@@ -210,6 +211,7 @@ _title_bar_draw(void)
         assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
         _show_contact_presence(chatwin, pos, maxrightpos);
         _show_privacy(chatwin);
+        _show_attention(current, chatwin->has_attention);
         _show_scrolled(current);
 
         if (typing) {
@@ -219,6 +221,7 @@ _title_bar_draw(void)
         ProfMucWin* mucwin = (ProfMucWin*)current;
         assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
         _show_muc_privacy(mucwin);
+        _show_attention(current, mucwin->has_attention);
         _show_scrolled(current);
     }
 
@@ -229,6 +232,26 @@ _title_bar_draw(void)
 }
 
 static void
+_show_attention(ProfWin* current, gboolean attention)
+{
+    int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
+    int text_attrs = theme_attrs(THEME_TITLE_TEXT);
+
+    if (attention) {
+        wprintw(win, " ");
+        wattron(win, bracket_attrs);
+        wprintw(win, "[");
+        wattroff(win, bracket_attrs);
+        wattron(win, text_attrs);
+        wprintw(win, "ATTENTION");
+        wattroff(win, text_attrs);
+        wattron(win, bracket_attrs);
+        wprintw(win, "]");
+        wattroff(win, bracket_attrs);
+    }
+}
+
+static void
 _show_scrolled(ProfWin* current)
 {
     if (current && current->layout->paged == 1) {
@@ -487,18 +510,6 @@ _show_privacy(ProfChatWin* chatwin)
 
         return;
     }
-    if (chatwin->has_attention) {
-        wprintw(win, " ");
-        wattron(win, bracket_attrs);
-        wprintw(win, "[");
-        wattroff(win, bracket_attrs);
-        wattron(win, encrypted_attrs);
-        wprintw(win, "ATTENTION");
-        wattroff(win, encrypted_attrs);
-        wattron(win, bracket_attrs);
-        wprintw(win, "]");
-        wattroff(win, bracket_attrs);
-    }
 
     if (chatwin->pgp_send || chatwin->pgp_recv) {
         GString* pgpmsg = g_string_new("PGP ");