[balsa/gtk3] Forget open mailboxes when not remembering them



commit 21f9e5e5a5239a37af67cc90aef6ae3accf3f964
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Feb 26 09:54:06 2013 -0500

    Forget open mailboxes when not remembering them
    
        * src/balsa-app.c (append_url_if_open),
        (open_mailboxes_idle_cb): if we are not remembering open
        mailboxes, forget them.
        * src/main.c (scan_mailboxes_idle_cb): always call
        open_mailboxes_idle_cb so we can forget them.

 ChangeLog       |    8 ++++++++
 src/balsa-app.c |   23 +++++++++++++----------
 src/main.c      |    3 +--
 3 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 620c3cf..b378408 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-26  Peter Bloomfield
+
+       * src/balsa-app.c (append_url_if_open),
+       (open_mailboxes_idle_cb): if we are not remembering open
+       mailboxes, forget them.
+       * src/main.c (scan_mailboxes_idle_cb): always call
+       open_mailboxes_idle_cb so we can forget them.
+
 2013-02-25  Peter Bloomfield
 
        * src/sendmsg-window.c (balsa_sendmsg_destroy_handler),
diff --git a/src/balsa-app.c b/src/balsa-app.c
index eb79ab6..a9fa8f7 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -498,8 +498,13 @@ static void
 append_url_if_open(const gchar * url, LibBalsaMailboxView * view,
                    GPtrArray * array)
 {
-    if (view->open)
-        g_ptr_array_add(array, g_strdup(url));
+    if (balsa_app.remember_open_mboxes) {
+        if (view->open)
+            g_ptr_array_add(array, g_strdup(url));
+    } else {
+        view->open = FALSE;
+        view->in_sync = 0;
+    }
 }
 
 static void
@@ -560,15 +565,13 @@ open_mailboxes_idle_cb(gchar ** urls)
         g_ptr_array_add(array, NULL);
         urls = (gchar **) g_ptr_array_free(array, FALSE);
 
-        if (urls) {
-            if (*urls) {
-                open_mailbox_by_url(balsa_app.current_mailbox_url, TRUE);
+        if (*urls) {
+            open_mailbox_by_url(balsa_app.current_mailbox_url, TRUE);
 
-                for (tmp = urls; *tmp; ++tmp) {
-                    if (!balsa_app.current_mailbox_url
-                        || strcmp(*tmp, balsa_app.current_mailbox_url)) {
-                        open_mailbox_by_url(*tmp, TRUE);
-                    }
+            for (tmp = urls; *tmp; ++tmp) {
+                if (!balsa_app.current_mailbox_url
+                    || strcmp(*tmp, balsa_app.current_mailbox_url)) {
+                    open_mailbox_by_url(*tmp, TRUE);
                 }
             }
         }
diff --git a/src/main.c b/src/main.c
index 85d96e4..a5df5b3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -406,8 +406,7 @@ scan_mailboxes_idle_cb()
 
     balsa_check_open_mailboxes();
 
-    if (balsa_app.remember_open_mboxes)
-       g_idle_add((GSourceFunc) open_mailboxes_idle_cb, NULL);
+    g_idle_add((GSourceFunc) open_mailboxes_idle_cb, NULL);
 
     if (cmd_open_inbox || balsa_app.open_inbox_upon_startup)
        g_idle_add((GSourceFunc) initial_open_inbox, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]