[balsa] Remember most recent mailbox better
- From: Peter Bloomfield <PeterB src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [balsa] Remember most recent mailbox better
- Date: Thu, 24 Sep 2009 10:58:31 +0000 (UTC)
commit 6412f6aa5ddaf3e9ea598c98fa1e7d0ff3fef3e5
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Sep 24 06:57:21 2009 -0400
Remember most recent mailbox better
ChangeLog | 9 +++++++
src/balsa-app.c | 66 +++++++++++++++++++++++++++++++---------------------
src/main-window.c | 3 --
src/main.c | 2 +-
4 files changed, 49 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3ab129a..5133a20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-24 Peter Bloomfield
+
+ * src/balsa-app.c (open_mailbox_by_url),
+ (open_mailboxes_idle_cb): respect current-mailbox-url when -o
+ command line option is used.
+ * src/main-window.c: do not clear current-mailbox-url when last
+ mailbox is closed, as it may get saved that way.
+ * src/main.c (initial_open_inbox): open inbox hidden.
+
2009-09-11 Peter Bloomfield
Open most recent mailbox first on restart
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 1330d44..7f34f84 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -518,11 +518,43 @@ append_url_if_open(const gchar * url, LibBalsaMailboxView * view,
}
}
+static void
+open_mailbox_by_url(const gchar * url)
+{
+ LibBalsaMailbox *mailbox;
+
+ if (!(url && *url))
+ return;
+
+ mailbox = balsa_find_mailbox_by_url(url);
+ if (balsa_app.debug)
+ fprintf(stderr, "open_mailboxes_idle_cb: opening %s => %p..\n",
+ url, mailbox);
+ if (mailbox)
+ /* The first mailbox we open will be shown; later mailboxes will
+ * have notebook pages, but will not be shown. */
+ balsa_mblist_open_mailbox_hidden(mailbox);
+ else {
+ /* Do not try to open it next time. */
+ LibBalsaMailboxView *view =
+ g_hash_table_lookup(libbalsa_mailbox_view_table, url);
+ /* The mailbox may have been requested to be open because its
+ * stored view might say so or the user requested it from the
+ * command line - in which case, view may or may not be present.
+ * We will be careful here. */
+ if (view) {
+ view->open = FALSE;
+ view->in_sync = FALSE;
+ }
+ balsa_information(LIBBALSA_INFORMATION_WARNING,
+ _("Couldn't open mailbox \"%s\""), url);
+ }
+}
+
gboolean
open_mailboxes_idle_cb(gchar ** urls)
{
gchar **tmp;
- LibBalsaMailbox *mbox;
gdk_threads_enter();
@@ -534,38 +566,18 @@ open_mailboxes_idle_cb(gchar ** urls)
return FALSE;
}
- str = g_string_new(balsa_app.current_mailbox_url);
+ str = g_string_new(NULL);
g_hash_table_foreach(libbalsa_mailbox_view_table,
(GHFunc) append_url_if_open, str);
urls = g_strsplit(str->str, ";", 0);
g_string_free(str, TRUE);
}
- for (tmp = urls; *tmp; ++tmp) {
- mbox = balsa_find_mailbox_by_url(*tmp);
- if (balsa_app.debug)
- fprintf(stderr, "open_mailboxes_idle_cb: opening %s => %p..\n",
- *tmp, mbox);
- if (mbox)
- /* The first mailbox we open will be shown; the others will
- * have notebook pages, but will not be shown. */
- balsa_mblist_open_mailbox_hidden(mbox);
- else {
- /* Do not try to open it next time. */
- LibBalsaMailboxView *view =
- g_hash_table_lookup(libbalsa_mailbox_view_table, *tmp);
- /* The mailbox may have bee requested to be open because
- its stored view might say so or the user requested it
- from the command line - in which case, view may or may
- not be present. We will be careful here. */
- if(view) {
- view->open = FALSE;
- view->in_sync = FALSE;
- }
- balsa_information(LIBBALSA_INFORMATION_WARNING,
- _("Couldn't open mailbox \"%s\""), *tmp);
- }
- }
+ open_mailbox_by_url(balsa_app.current_mailbox_url);
+
+ for (tmp = urls; *tmp; ++tmp)
+ open_mailbox_by_url(*tmp);
+
g_strfreev(urls);
gdk_threads_leave();
diff --git a/src/main-window.c b/src/main-window.c
index 2e4cd1b..8d3ce3a 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2449,9 +2449,6 @@ balsa_window_real_close_mbnode(BalsaWindow * window,
/* Just in case... */
g_object_set_data(G_OBJECT(window), BALSA_INDEX_GRAB_FOCUS, NULL);
-
- g_free(balsa_app.current_mailbox_url);
- balsa_app.current_mailbox_url = NULL;
}
}
diff --git a/src/main.c b/src/main.c
index cef3448..7f7be0c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -723,7 +723,7 @@ initial_open_inbox()
printf("opening %s..\n", balsa_app.inbox->name);
gdk_threads_enter();
- balsa_mblist_open_mailbox(balsa_app.inbox);
+ balsa_mblist_open_mailbox_hidden(balsa_app.inbox);
gdk_threads_leave();
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]