[balsa] Select first command-line mailbox



commit 22fbcfb1c9673037f84beb538a29c4b65d9f340f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Oct 22 17:06:51 2011 -0400

    Select first command-line mailbox
    
    	* src/balsa-app.c (open_mailboxes_idle_cb): select first
    	command-line mailbox; see discussion at
    	http://mail.gnome.org/archives/balsa-list/2011-October/msg00010.html

 ChangeLog       |    6 ++++++
 src/balsa-app.c |   36 ++++++++++++++++++++----------------
 2 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2984bef..4e83bfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-22  Peter Bloomfield
+
+	* src/balsa-app.c (open_mailboxes_idle_cb): select first
+	command-line mailbox; see discussion at
+	http://mail.gnome.org/archives/balsa-list/2011-October/msg00010.html
+
 2011-09-28  Peter Bloomfield
 
 	* configure.in: check for javascriptcoregtk with recent webkit;
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 50dcabb..c5ae3d7 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -559,34 +559,38 @@ open_mailboxes_idle_cb(gchar ** urls)
 
     gdk_threads_enter();
 
-    if (!urls) {
-        GPtrArray *array;
+    if (urls) {
+        gboolean hidden;
 
-        if (!libbalsa_mailbox_view_table) {
-            gdk_threads_leave();
-            return FALSE;
+        hidden = FALSE;
+        for (tmp = urls; *tmp; ++tmp) {
+            open_mailbox_by_url(*tmp, hidden);
+            hidden = TRUE;
         }
+    } else if (libbalsa_mailbox_view_table) {
+        GPtrArray *array;
 
         array = g_ptr_array_new();
         g_hash_table_foreach(libbalsa_mailbox_view_table,
                              (GHFunc) append_url_if_open, array);
         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, FALSE);
 
-            for (tmp = urls; *tmp; ++tmp)
-                if (!balsa_app.current_mailbox_url
-                    || strcmp(*tmp, balsa_app.current_mailbox_url))
-                    open_mailbox_by_url(*tmp, TRUE);
+        if (urls) {
+            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);
+                    }
+                }
+            }
         }
-
-        g_strfreev(urls);
     }
 
+    g_strfreev(urls);
     gdk_threads_leave();
 
     return FALSE;



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