Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 14 Mar 2005 11:37:59 +0000 (11:37 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 14 Mar 2005 11:37:59 +0000 (11:37 +0000)
sidebar update (indicator placement, correct use of ctx->new, ...)

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@177 e385b8ad-14ed-0310-8656-cc95a2468c6d

buffy.c
commands.c
curs_main.c
sidebar.c
status.c

diff --git a/buffy.c b/buffy.c
index e486aba..c955ab9 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -274,9 +274,10 @@ int mutt_buffy_check (int force)
   DIR *dirp;
   char path[_POSIX_PATH_MAX];
   struct stat contex_sb;
   DIR *dirp;
   char path[_POSIX_PATH_MAX];
   struct stat contex_sb;
-  time_t now, last1, last2;
+  time_t now, last1;
   CONTEXT *ctx;
 #ifdef USE_IMAP
   CONTEXT *ctx;
 #ifdef USE_IMAP
+  time_t last2;
   /* update postponed count as well, on force */
   if (force != 0)
     mutt_update_num_postponed ();
   /* update postponed count as well, on force */
   if (force != 0)
     mutt_update_num_postponed ();
@@ -533,7 +534,7 @@ int mutt_buffy_check (int force)
       tmp->size = (long) sb.st_size;   /* update the size */
 #endif
 
       tmp->size = (long) sb.st_size;   /* update the size */
 #endif
 
-    if (!tmp->new)
+    if (tmp->new <= 0)
       tmp->notified = 0;
     else if (!tmp->notified)
       BuffyNotify++;
       tmp->notified = 0;
     else if (!tmp->notified)
       BuffyNotify++;
@@ -563,7 +564,7 @@ int mutt_buffy_list (void)
   for (tmp = Incoming; tmp; tmp = tmp->next)
   {
     /* Is there new mail in this mailbox? */
   for (tmp = Incoming; tmp; tmp = tmp->next)
   {
     /* Is there new mail in this mailbox? */
-    if (!tmp->new || (have_unnotified && tmp->notified))
+    if (tmp->new <= 0 || (have_unnotified && tmp->notified))
       continue;
 
     strfcpy (path, tmp->path, sizeof (path));
       continue;
 
     strfcpy (path, tmp->path, sizeof (path));
@@ -633,7 +634,7 @@ void mutt_buffy (char *s, size_t slen)
 
   case 1:
 
 
   case 1:
 
-    while (tmp && !tmp->new)
+    while (tmp && tmp->new <= 0)
       tmp = tmp->next;
     if (!tmp)
     {
       tmp = tmp->next;
     if (!tmp)
     {
@@ -652,7 +653,7 @@ void mutt_buffy (char *s, size_t slen)
     {
       if (mutt_strcmp (s, tmp->path) == 0)
        count++;
     {
       if (mutt_strcmp (s, tmp->path) == 0)
        count++;
-      else if (count && tmp->new)
+      else if (count && tmp->new > 0)
        break;
       tmp = tmp->next;
       if (!tmp)
        break;
       tmp = tmp->next;
       if (!tmp)
index d60bd52..86a83ba 100644 (file)
@@ -832,7 +832,7 @@ int mutt_save_message (HEADER *h, int delete,
     {
 #ifdef BUFFY_SIZE
       tmp = mutt_find_mailbox (buf);
     {
 #ifdef BUFFY_SIZE
       tmp = mutt_find_mailbox (buf);
-      if (tmp && !tmp->new)
+      if (tmp && tmp->new <= 0)
        mutt_update_mailbox (tmp);
 #else
       /* fix up the times so buffy won't get confused */
        mutt_update_mailbox (tmp);
 #else
       /* fix up the times so buffy won't get confused */
index 8008f5f..1e50716 100644 (file)
@@ -479,8 +479,12 @@ int mutt_index_menu (void)
 #endif
         IndexHelp);
   
 #endif
         IndexHelp);
   
-  if (!attach_msg) 
+  if (!attach_msg) {
     mutt_buffy_check(1); /* force the buffy check after we enter the folder */
     mutt_buffy_check(1); /* force the buffy check after we enter the folder */
+    /* record folder we open to place sidebar indicator properly */
+    if (Context && Context->path)
+      set_curbuffy(Context->path);
+  }
 
   FOREVER
   {
 
   FOREVER
   {
index cc7350e..001c720 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -212,6 +212,7 @@ void set_buffystats (CONTEXT* Context)
   {
     if (strcmp (tmp->path, Context->path) == 0)
     {
   {
     if (strcmp (tmp->path, Context->path) == 0)
     {
+      tmp->new = Context->new;
       tmp->msg_unread = Context->unread;
       tmp->msgcount = Context->msgcount;
       tmp->msg_flagged = Context->flagged;
       tmp->msg_unread = Context->unread;
       tmp->msgcount = Context->msgcount;
       tmp->msg_flagged = Context->flagged;
@@ -264,7 +265,9 @@ int draw_sidebar(int menu) {
   lines = option(OPTHELP) ? 1 : 0; /* go back to the top */
 
   if ( CurBuffy == 0 ) CurBuffy = Incoming;
   lines = option(OPTHELP) ? 1 : 0; /* go back to the top */
 
   if ( CurBuffy == 0 ) CurBuffy = Incoming;
+#if 0
   if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
   if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
+#endif
     calc_boundaries(menu);
 
   tmp = TopBuffy;
     calc_boundaries(menu);
 
   tmp = TopBuffy;
index 8f58fec..42d4fce 100644 (file)
--- a/status.c
+++ b/status.c
@@ -198,7 +198,7 @@ status_format_str (char *buf, size_t buflen, char op, const char *src,
        snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
        snprintf (buf, buflen, fmt, Context ? Context->new : 0);
       }
        snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
        snprintf (buf, buflen, fmt, Context ? Context->new : 0);
       }
-      else if (!Context || !Context->new)
+      else if (!Context || Context->new <= 0)
        optional = 0;
       break;
 
        optional = 0;
       break;