View | Details | Raw Unified | Return to bug 205623 | Differences between
and this patch

Collapse All | Expand All

(-)b/buffy.c (-3 / +13 lines)
Lines 26-31 Link Here
26
#include "mx.h"
26
#include "mx.h"
27
27
28
#include "mutt_curses.h"
28
#include "mutt_curses.h"
29
#include "sidebar.h"
29
30
30
#ifdef USE_IMAP
31
#ifdef USE_IMAP
31
#include "imap.h"
32
#include "imap.h"
Lines 602-620 Link Here
602
      {
603
      {
603
      case M_MBOX:
604
      case M_MBOX:
604
      case M_MMDF:
605
      case M_MMDF:
605
	buffy_mbox_update (tmp, &sb);
606
	if (sidebar_should_refresh()) {
607
	  buffy_mbox_update (tmp, &sb);
608
	  sidebar_updated();
609
	}
606
	if (buffy_mbox_hasnew (tmp, &sb) > 0)
610
	if (buffy_mbox_hasnew (tmp, &sb) > 0)
607
	  BuffyCount++;
611
	  BuffyCount++;
608
	break;
612
	break;
609
613
610
      case M_MAILDIR:
614
      case M_MAILDIR:
611
	buffy_maildir_update (tmp);
615
	if (sidebar_should_refresh()) {
616
	  buffy_maildir_update (tmp);
617
	  sidebar_updated();
618
 	}
612
	if (buffy_maildir_hasnew (tmp) > 0)
619
	if (buffy_maildir_hasnew (tmp) > 0)
613
	  BuffyCount++;
620
	  BuffyCount++;
614
	break;
621
	break;
615
622
616
      case M_MH:
623
      case M_MH:
617
	mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
624
	if (sidebar_should_refresh()) {
625
	  mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
626
	  sidebar_updated();
627
 	}
618
        mh_buffy(tmp);
628
        mh_buffy(tmp);
619
	if (tmp->new)
629
	if (tmp->new)
620
	  BuffyCount++;
630
	  BuffyCount++;
(-)b/globals.h (+2 lines)
Lines 219-224 Link Here
219
WHERE struct buffy_t *CurBuffy INITVAL(0);
219
WHERE struct buffy_t *CurBuffy INITVAL(0);
220
WHERE short DrawFullLine INITVAL(0);
220
WHERE short DrawFullLine INITVAL(0);
221
WHERE short SidebarWidth;
221
WHERE short SidebarWidth;
222
WHERE short SidebarRefresh;
223
WHERE short SidebarLastRefresh;
222
#ifdef USE_IMAP
224
#ifdef USE_IMAP
223
WHERE short ImapKeepalive;
225
WHERE short ImapKeepalive;
224
WHERE short ImapPipelineDepth;
226
WHERE short ImapPipelineDepth;
(-)b/init.h (+6 lines)
Lines 2042-2047 Link Here
2042
  ** .pp
2042
  ** .pp
2043
  ** The width of the sidebar.
2043
  ** The width of the sidebar.
2044
  */
2044
  */
2045
  { "sidebar_refresh", DT_NUM, R_BOTH, UL &SidebarRefresh, 60 },
2046
  /*
2047
  ** .pp
2048
  ** Do not refresh sidebar in less than $sidebar_refresh seconds,
2049
  ** (0 disables refreshing).
2050
  */
2045
  { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
2051
  { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
2046
  /*
2052
  /*
2047
  ** .pp
2053
  ** .pp
(-)b/sidebar.c (+14 lines)
Lines 211-216 Link Here
211
                saveSidebarWidth = SidebarWidth;
211
                saveSidebarWidth = SidebarWidth;
212
                if(!option(OPTSIDEBAR)) SidebarWidth = 0;
212
                if(!option(OPTSIDEBAR)) SidebarWidth = 0;
213
                initialized = true;
213
                initialized = true;
214
		SidebarLastRefresh = time(NULL);
214
        }
215
        }
215
216
216
        /* save or restore the value SidebarWidth */
217
        /* save or restore the value SidebarWidth */
Lines 417-419 Link Here
417
	draw_sidebar(menu);
418
	draw_sidebar(menu);
418
}
419
}
419
420
421
int sidebar_should_refresh()
422
{
423
	if (option(OPTSIDEBAR) && SidebarRefresh > 0) {
424
		if (time(NULL) - SidebarLastRefresh >= SidebarRefresh)
425
			return 1;
426
	}
427
	return 0;
428
}
429
void sidebar_updated()
430
{
431
	SidebarLastRefresh = time(NULL);
432
}
433
(-)b/sidebar.h (+2 lines)
Lines 32-36 Link Here
32
void scroll_sidebar(int, int);
32
void scroll_sidebar(int, int);
33
void set_curbuffy(char*);
33
void set_curbuffy(char*);
34
void set_buffystats(CONTEXT*);
34
void set_buffystats(CONTEXT*);
35
int sidebar_should_refresh();
36
void sidebar_updated();
35
37
36
#endif /* SIDEBAR_H */
38
#endif /* SIDEBAR_H */

Return to bug 205623