Link Here
|
|
|
1 |
--- mutt.orig/buffy.c 2012-11-02 13:16:39.000000000 +0100 |
2 |
+++ mutt/buffy.c 2012-11-02 13:20:52.000000000 +0100 |
3 |
@@ -26,6 +26,7 @@ |
4 |
#include "mx.h" |
5 |
|
6 |
#include "mutt_curses.h" |
7 |
+#include "sidebar.h" |
8 |
|
9 |
#ifdef USE_IMAP |
10 |
#include "imap.h" |
11 |
@@ -564,19 +565,28 @@ |
12 |
{ |
13 |
case M_MBOX: |
14 |
case M_MMDF: |
15 |
- buffy_mbox_update (tmp); |
16 |
+ if (sidebar_should_refresh()) { |
17 |
+ buffy_mbox_update (tmp); |
18 |
+ sidebar_updated(); |
19 |
+ } |
20 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
21 |
BuffyCount++; |
22 |
break; |
23 |
|
24 |
case M_MAILDIR: |
25 |
- buffy_maildir_update (tmp); |
26 |
+ if (sidebar_should_refresh()) { |
27 |
+ buffy_maildir_update (tmp); |
28 |
+ sidebar_updated(); |
29 |
+ } |
30 |
if (buffy_maildir_hasnew (tmp) > 0) |
31 |
BuffyCount++; |
32 |
break; |
33 |
|
34 |
case M_MH: |
35 |
- mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged); |
36 |
+ if (sidebar_should_refresh()) { |
37 |
+ mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged); |
38 |
+ sidebar_updated(); |
39 |
+ } |
40 |
mh_buffy(tmp); |
41 |
if (tmp->new) |
42 |
BuffyCount++; |
43 |
Index: mutt/globals.h |
44 |
=================================================================== |
45 |
--- mutt.orig/globals.h 2012-11-02 13:16:39.000000000 +0100 |
46 |
+++ mutt/globals.h 2012-11-02 13:16:40.000000000 +0100 |
47 |
@@ -214,6 +214,8 @@ |
48 |
WHERE struct buffy_t *CurBuffy INITVAL(0); |
49 |
WHERE short DrawFullLine INITVAL(0); |
50 |
WHERE short SidebarWidth; |
51 |
+WHERE short SidebarRefresh; |
52 |
+WHERE short SidebarLastRefresh; |
53 |
#ifdef USE_IMAP |
54 |
WHERE short ImapKeepalive; |
55 |
WHERE short ImapPipelineDepth; |
56 |
Index: mutt/init.h |
57 |
=================================================================== |
58 |
--- mutt.orig/init.h 2012-11-02 13:16:39.000000000 +0100 |
59 |
+++ mutt/init.h 2012-11-02 13:16:40.000000000 +0100 |
60 |
@@ -2009,6 +2009,12 @@ |
61 |
{ "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 }, |
62 |
/* |
63 |
** .pp |
64 |
+ ** Do not refresh sidebar in less than $sidebar_refresh seconds, |
65 |
+ ** (0 disables refreshing). |
66 |
+ */ |
67 |
+ { "sidebar_refresh", DT_NUM, R_BOTH, UL &SidebarRefresh, 60 }, |
68 |
+ /* |
69 |
+ ** .pp |
70 |
** The width of the sidebar. |
71 |
*/ |
72 |
{ "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 }, |
73 |
Index: mutt/sidebar.c |
74 |
=================================================================== |
75 |
--- mutt.orig/sidebar.c 2012-11-02 13:16:39.000000000 +0100 |
76 |
+++ mutt/sidebar.c 2012-11-02 13:16:40.000000000 +0100 |
77 |
@@ -252,6 +252,7 @@ |
78 |
saveSidebarWidth = SidebarWidth; |
79 |
if(!option(OPTSIDEBAR)) SidebarWidth = 0; |
80 |
initialized = true; |
81 |
+ SidebarLastRefresh = time(NULL); |
82 |
} |
83 |
|
84 |
/* save or restore the value SidebarWidth */ |
85 |
@@ -464,3 +465,16 @@ |
86 |
set_curbuffy(""); /* default is the first mailbox */ |
87 |
draw_sidebar(menu); |
88 |
} |
89 |
+ |
90 |
+int sidebar_should_refresh() |
91 |
+{ |
92 |
+ if (option(OPTSIDEBAR) && SidebarRefresh > 0) { |
93 |
+ if (time(NULL) - SidebarLastRefresh >= SidebarRefresh) |
94 |
+ return 1; |
95 |
+ } |
96 |
+ return 0; |
97 |
+} |
98 |
+void sidebar_updated() |
99 |
+{ |
100 |
+ SidebarLastRefresh = time(NULL); |
101 |
+} |
102 |
Index: mutt/sidebar.h |
103 |
=================================================================== |
104 |
--- mutt.orig/sidebar.h 2012-11-02 13:16:39.000000000 +0100 |
105 |
+++ mutt/sidebar.h 2012-11-02 13:16:40.000000000 +0100 |
106 |
@@ -32,5 +32,7 @@ |
107 |
void scroll_sidebar(int, int); |
108 |
void set_curbuffy(char*); |
109 |
void set_buffystats(CONTEXT*); |
110 |
+int sidebar_should_refresh(); |
111 |
+void sidebar_updated(); |
112 |
|
113 |
#endif /* SIDEBAR_H */ |