[balsa/gtk3] Use local idle callback to call public method
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Use local idle callback to call public method
- Date: Sun, 17 Mar 2013 16:39:00 +0000 (UTC)
commit 67be88dda26ff9d1c2ae12acd02a1ea559a9bde2
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Mar 17 12:36:34 2013 -0400
Use local idle callback to call public method
* src/balsa-app.c (open_mailbox_by_url),
(balsa_open_mailbox_list): change gboolean
open_mailboxes_idle_cb() to void balsa_open_mailbox_list().
* src/balsa-app.h: ditto.
* src/mailbox-node.c (balsa_mailbox_node_rescan): ditto.
* src/main.c (open_mailboxes_idle_cb), (scan_mailboxes_idle_cb):
open_mailboxes_idle_cb is now just the idle callback.
ChangeLog | 10 ++++++++++
src/balsa-app.c | 40 +++++++++++++++++-----------------------
src/balsa-app.h | 2 +-
src/mailbox-node.c | 2 +-
src/main.c | 11 +++++++++--
5 files changed, 38 insertions(+), 27 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 806a381..13292a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
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().
+ * src/balsa-app.h: ditto.
+ * src/mailbox-node.c (balsa_mailbox_node_rescan): ditto.
+ * src/main.c (open_mailboxes_idle_cb), (scan_mailboxes_idle_cb):
+ open_mailboxes_idle_cb is now just the idle callback.
+
+2013-03-17 Peter Bloomfield
+
Reopen mailboxes after rescanning
* src/mailbox-node.c (imap_dir_cb): do not unref mbnode;
diff --git a/src/balsa-app.c b/src/balsa-app.c
index 9e3e4fe..a06c746 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -488,11 +488,11 @@ update_timer(gboolean update, guint minutes)
}
-
-/* open_mailboxes_idle_cb:
- open mailboxes on startup if requested so.
- This is an idle handler. Be sure to use gdk_threads_{enter/leave}
- Release the passed argument when done.
+/*
+ * balsa_open_mailbox_list:
+ * Called on startup if remember_open_mboxes is set, and also after
+ * rescanning.
+ * Frees the passed argument when done.
*/
static gboolean
@@ -516,12 +516,9 @@ open_mailbox_by_url(const gchar * url, gboolean hidden)
{
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",
+ fprintf(stderr, "balsa_open_mailbox_list: opening %s => %p..\n",
url, mailbox);
if (mailbox) {
if (hidden)
@@ -546,8 +543,8 @@ open_mailbox_by_url(const gchar * url, gboolean hidden)
}
}
-gboolean
-open_mailboxes_idle_cb(gchar ** urls)
+void
+balsa_open_mailbox_list(gchar ** urls)
{
gchar **tmp;
@@ -564,23 +561,20 @@ open_mailboxes_idle_cb(gchar ** urls)
urls = (gchar **) g_ptr_array_free(array, FALSE);
}
- if (urls) {
- for (tmp = urls; *tmp; ++tmp) {
- gchar **p;
+ for (tmp = urls; *tmp; ++tmp) {
+ gchar **p;
- /* Have we already seen this URL? */
- for (p = urls; p < tmp; ++p)
- if (!strcmp(*p, *tmp))
- break;
- if (p == tmp)
- open_mailbox_by_url(*tmp, TRUE);
- }
+ /* Have we already seen this URL? */
+ for (p = urls; p < tmp; ++p)
+ if (!strcmp(*p, *tmp))
+ break;
+ if (p == tmp)
+ open_mailbox_by_url(*tmp, TRUE);
}
g_strfreev(urls);
- gdk_threads_leave();
- return FALSE;
+ gdk_threads_leave();
}
void
diff --git a/src/balsa-app.h b/src/balsa-app.h
index 49b13af..8ed4b1d 100644
--- a/src/balsa-app.h
+++ b/src/balsa-app.h
@@ -398,7 +398,7 @@ void update_timer(gboolean update, guint minutes);
gchar *ask_password(LibBalsaServer * server, LibBalsaMailbox * mbox);
GtkWidget *balsa_stock_button_with_label(const char *icon,
const char *label);
-gboolean open_mailboxes_idle_cb(gchar * names[]);
+void balsa_open_mailbox_list(gchar ** urls);
/* Search functions */
BalsaMailboxNode *balsa_find_mailbox(LibBalsaMailbox * mailbox);
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index da3c93e..d8c706f 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -775,7 +775,7 @@ balsa_mailbox_node_rescan(BalsaMailboxNode * mn)
balsa_mailbox_node_append_subtree(mn);
/* Reopen mailboxes */
- open_mailboxes_idle_cb(NULL);
+ balsa_open_mailbox_list(NULL);
}
void
diff --git a/src/main.c b/src/main.c
index 3d082ed..4701f2b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -351,6 +351,13 @@ balsa_get_stats(long *unread, long *unsent)
} else *unsent = -1;
}
+static gboolean
+open_mailboxes_idle_cb(gchar ** urls)
+{
+ balsa_open_mailbox_list(urls);
+ return FALSE;
+}
+
static void
balsa_check_open_mailboxes(void)
{
@@ -435,8 +442,8 @@ scan_mailboxes_idle_cb()
if (url_array->len) {
g_ptr_array_add(url_array, NULL);
- open_mailboxes_idle_cb((gchar **) g_ptr_array_free(url_array,
- FALSE));
+ balsa_open_mailbox_list((gchar **) g_ptr_array_free(url_array,
+ FALSE));
}
if(cmd_get_stats) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]