[balsa/gtk3] Remember current mailbox after rescanning



commit f6d8f3539569ccf7645771ef218119cf1ee33785
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Mar 17 18:09:03 2013 -0400

    Remember current mailbox after rescanning
    
        * src/mailbox-node.c (mb_rescan_cb): reopen mailboxes in the UI
        callback,
        (balsa_mailbox_node_rescan): not in the recursive function
        * src/balsa-app.c (balsa_open_mailbox_list): make sure first
        mailbox in the list is not hidden.

 ChangeLog          |    8 ++++++++
 src/balsa-app.c    |   20 +++++++-------------
 src/mailbox-node.c |   15 ++++++++++++---
 3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 13292a1..7035cda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2013-03-17  Peter Bloomfield
 
+       * src/mailbox-node.c (mb_rescan_cb): reopen mailboxes in the UI
+       callback,
+       (balsa_mailbox_node_rescan): not in the recursive function
+       * src/balsa-app.c (balsa_open_mailbox_list): make sure first
+       mailbox in the list is not hidden.
+
+2013-03-17  Peter Bloomfield
+
        * src/balsa-app.c (open_mailbox_by_url),
        (balsa_open_mailbox_list): change gboolean
        open_mailboxes_idle_cb() to void balsa_open_mailbox_list().
diff --git a/src/balsa-app.c b/src/balsa-app.c
index a06c746..6f8dcf6 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -546,20 +546,12 @@ open_mailbox_by_url(const gchar * url, gboolean hidden)
 void
 balsa_open_mailbox_list(gchar ** urls)
 {
+    gboolean hidden = FALSE;
     gchar **tmp;
 
-    gdk_threads_enter();
-
-    if (!urls) {
-        GPtrArray *array;
+    g_return_if_fail(urls != NULL);
 
-        array = g_ptr_array_new();
-        libbalsa_conf_foreach_group(VIEW_BY_URL_SECTION_PREFIX,
-                                    (LibBalsaConfForeachFunc)
-                                    append_url_if_open, array);
-        g_ptr_array_add(array, NULL);
-        urls = (gchar **) g_ptr_array_free(array, FALSE);
-    }
+    gdk_threads_enter();
 
     for (tmp = urls; *tmp; ++tmp) {
         gchar **p;
@@ -568,8 +560,10 @@ balsa_open_mailbox_list(gchar ** urls)
         for (p = urls; p < tmp; ++p)
             if (!strcmp(*p, *tmp))
                 break;
-        if (p == tmp)
-            open_mailbox_by_url(*tmp, TRUE);
+        if (p == tmp) {
+            open_mailbox_by_url(*tmp, hidden);
+            hidden = TRUE;
+        }
     }
 
     g_strfreev(urls);
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index d8c706f..8a4b325 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -773,9 +773,6 @@ balsa_mailbox_node_rescan(BalsaMailboxNode * mn)
     }
     mn->scanned = FALSE;
     balsa_mailbox_node_append_subtree(mn);
-
-    /* Reopen mailboxes */
-    balsa_open_mailbox_list(NULL);
 }
 
 void
@@ -1009,7 +1006,19 @@ mb_unsubscribe_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 static void
 mb_rescan_cb(GtkWidget * widget, BalsaMailboxNode * mbnode)
 {
+    gchar *current_mailbox_url;
+    GPtrArray *url_array;
+
+    current_mailbox_url = g_strdup(balsa_app.current_mailbox_url);
     balsa_mailbox_node_rescan(mbnode);
+
+    /* Reopen mailboxes */
+    url_array = g_ptr_array_new();
+    if (current_mailbox_url)
+        g_ptr_array_add(url_array, current_mailbox_url);
+    balsa_add_open_mailbox_urls(url_array);
+    g_ptr_array_add(url_array, NULL);
+    balsa_open_mailbox_list((gchar **) g_ptr_array_free(url_array, FALSE));
 }
 
 static void


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