Andreas Krennmair:
[apps/madmutt.git] / sidebar.c
index 8adea8f..4f5d17c 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -133,7 +133,7 @@ static char * shortened_hierarchy(char * box) {
   return safe_strdup(box);
 }
 
-char *make_sidebar_entry(char *box, int size, int new)
+char *make_sidebar_entry(char *box, int size, int new, int tagged)
 {
   char *c;
   int i = 0, dlen = mutt_strlen (SidebarDelim);
@@ -155,11 +155,22 @@ char *make_sidebar_entry(char *box, int size, int new)
   i = strlen(box);
   strncpy( entry, box, i < SidebarWidth - dlen ? i :SidebarWidth - dlen);
 
-  if ( new ) 
-    sprintf(entry + SidebarWidth - 3 - quick_log10(size) - dlen - quick_log10(new),
-            "% d(%d)", size, new);
-  else
-    sprintf( entry + SidebarWidth - 1 - quick_log10(size) - dlen, "% d", size);
+  if ( new ) {
+    if (tagged>0) {
+      sprintf(entry + SidebarWidth - 5 - quick_log10(size) - dlen - quick_log10(new) - quick_log10(tagged),
+              "% d(%d)[%d]", size, new, tagged);
+    } else {
+      sprintf(entry + SidebarWidth - 3 - quick_log10(size) - dlen - quick_log10(new),
+              "% d(%d)", size, new);
+    }
+  } else {
+    if (tagged>0) {
+      sprintf( entry + SidebarWidth - 3 - quick_log10(size) - dlen - quick_log10(tagged), "% d[%d]", size,tagged);
+    } else {
+      sprintf( entry + SidebarWidth - 1 - quick_log10(size) - dlen, "% d", size);
+    }
+
+  }
   if (option(OPTSHORTENHIERARCHY)) {
     free(box);
   }
@@ -195,6 +206,7 @@ void set_buffystats (CONTEXT* Context)
     {
       tmp->msg_unread = Context->unread;
       tmp->msgcount = Context->msgcount;
+      tmp->msg_tagged = Context->flagged;
       break;
     }
     tmp = tmp->next;
@@ -261,14 +273,15 @@ int draw_sidebar(int menu) {
     if ( Context && !strcmp( tmp->path, Context->path ) ) {
       printw( "%.*s", SidebarWidth - delim_len,
               make_sidebar_entry(basename(tmp->path),
-                                 Context->msgcount, Context->unread));
+                                 Context->msgcount, Context->unread, Context->tagged));
       tmp->msg_unread = Context->unread;
       tmp->msgcount = Context->msgcount;
+      tmp->msg_tagged = Context->tagged;
     }
     else
       printw( "%.*s", SidebarWidth - delim_len,
               make_sidebar_entry(basename(tmp->path),
-                                 tmp->msgcount,tmp->msg_unread));
+                                 tmp->msgcount,tmp->msg_unread, tmp->msg_tagged));
     lines++;
   }
   SETCOLOR(MT_COLOR_NORMAL);