[balsa] Fix warning messages about weak refs
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Fix warning messages about weak refs
- Date: Mon, 30 Aug 2010 23:48:11 +0000 (UTC)
commit ccd2512a58c6dcf3a3f9e53ecdd3c3e77c870864
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Aug 30 19:46:58 2010 -0400
Fix warning messages about weak refs
* src/balsa-mblist.c (balsa_mblist_mailbox_node_redraw): update
notebook tab when redrawing.
* src/mailbox-conf.c (mailbox_conf_update): ...so we do not need
to here.
* src/save-restore.c (sr_special_notify,
config_mailbox_set_as_special): use weak refs consistently; set
names of new special mailboxes to the standard names, and names
of previously special mailboxes to what they will be in the
next session.
ChangeLog | 12 +++++++++++
src/balsa-mblist.c | 1 +
src/mailbox-conf.c | 1 -
src/save-restore.c | 55 ++++++++++++++++++++++++++++++---------------------
4 files changed, 45 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bbe8396..6684d8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-30 Peter Bloomfield
+
+ * src/balsa-mblist.c (balsa_mblist_mailbox_node_redraw): update
+ notebook tab when redrawing.
+ * src/mailbox-conf.c (mailbox_conf_update): ...so we do not need
+ to here.
+ * src/save-restore.c (sr_special_notify,
+ config_mailbox_set_as_special): use weak refs consistently; set
+ names of new special mailboxes to the standard names, and names
+ of previously special mailboxes to what they will be in the
+ next session.
+
2010-08-21 Pawel Salek
* configure.in, NEWS: release 2.4.8
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index b3762cf..05c4a6c 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -2279,4 +2279,5 @@ balsa_mblist_mailbox_node_redraw(BalsaMailboxNode * mbnode)
GtkTreeIter iter;
if (balsa_find_iter_by_data(&iter, mbnode))
bmbl_store_redraw_mbnode(&iter, mbnode);
+ balsa_window_update_tab(mbnode);
}
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index 86a5f50..9b4db59 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -963,7 +963,6 @@ mailbox_conf_update(MailboxConfWindow *mcw)
g_free(mailbox->name);
mailbox->name = name;
balsa_mblist_mailbox_node_redraw(mbnode);
- balsa_window_update_tab(mbnode);
} else
g_free(name);
diff --git a/src/save-restore.c b/src/save-restore.c
index abafb65..7939fe0 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -168,13 +168,25 @@ load_toolbars(void)
#endif /* ENABLE_TOUCH_UI */
#define TRASH_NAME "Trash"
+static void
+sr_special_notify(gpointer data, GObject * mailbox)
+{
+ LibBalsaMailbox **special = data;
+
+ if (special == &balsa_app.trash && !balsa_app.mblist_tree_store
+ && balsa_app.empty_trash_on_exit)
+ empty_trash(balsa_app.main_window);
+
+ *special = NULL;
+}
+
static gchar *specialNames[] = {
INBOX_NAME, SENTBOX_NAME, TRASH_NAME, DRAFTS_NAME, OUTBOX_NAME
};
void
config_mailbox_set_as_special(LibBalsaMailbox * mailbox, specialType which)
{
- LibBalsaMailbox **special;
+ LibBalsaMailbox **special, *old_mailbox;
BalsaMailboxNode *mbnode;
g_return_if_fail(mailbox != NULL);
@@ -195,26 +207,35 @@ config_mailbox_set_as_special(LibBalsaMailbox * mailbox, specialType which)
default:
return;
}
- if (*special) {
- g_free((*special)->config_prefix);
- (*special)->config_prefix = NULL;
- if (!LIBBALSA_IS_MAILBOX_LOCAL(*special)
+ if ((old_mailbox = *special)) {
+ *special = NULL;
+ g_free(old_mailbox->config_prefix);
+ old_mailbox->config_prefix = NULL;
+
+ g_free(old_mailbox->name);
+ old_mailbox->name = g_path_get_basename(old_mailbox->url);
+
+ if (!LIBBALSA_IS_MAILBOX_LOCAL(old_mailbox)
|| !libbalsa_path_is_below_dir(libbalsa_mailbox_local_get_path
- (*special),
+ (old_mailbox),
balsa_app.local_mail_directory))
- config_mailbox_add(*special, NULL);
- g_object_remove_weak_pointer(G_OBJECT(*special), (gpointer) special);
+ config_mailbox_add(old_mailbox, NULL);
- mbnode = balsa_find_mailbox(*special);
- *special = NULL;
+ g_object_weak_unref(G_OBJECT(old_mailbox),
+ (GWeakNotify) sr_special_notify, special);
+
+ mbnode = balsa_find_mailbox(old_mailbox);
balsa_mblist_mailbox_node_redraw(mbnode);
g_object_unref(mbnode);
}
config_mailbox_delete(mailbox);
+ g_free(mailbox->name);
+ mailbox->name = g_strdup(specialNames[which]);
config_mailbox_add(mailbox, specialNames[which]);
*special = mailbox;
- g_object_add_weak_pointer(G_OBJECT(*special), (gpointer) special);
+ g_object_weak_ref(G_OBJECT(mailbox), (GWeakNotify) sr_special_notify,
+ special);
mbnode = balsa_find_mailbox(mailbox);
balsa_mblist_mailbox_node_redraw(mbnode);
@@ -392,18 +413,6 @@ pop3_progress_notify(LibBalsaMailbox* mailbox, int msg_type, int prog, int tot,
/* Initialize the specified mailbox, creating the internal data
structures which represent the mailbox. */
-static void
-sr_special_notify(gpointer data, GObject * mailbox)
-{
- LibBalsaMailbox **special = data;
-
- if (special == &balsa_app.trash && !balsa_app.mblist_tree_store
- && balsa_app.empty_trash_on_exit)
- empty_trash(balsa_app.main_window);
-
- *special = NULL;
-}
-
static gint
config_mailbox_init(const gchar * prefix)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]