[Goodies-commits] r5387 - in xfce4-mailwatch-plugin/trunk: . libmailwatch-core
Brian Tarricone
kelnos at xfce.org
Thu Sep 11 06:55:27 CEST 2008
Author: kelnos
Date: 2008-09-11 04:55:27 +0000 (Thu, 11 Sep 2008)
New Revision: 5387
Modified:
xfce4-mailwatch-plugin/trunk/NEWS
xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch.c
Log:
clean out stale mailbox data while saving config file
Modified: xfce4-mailwatch-plugin/trunk/NEWS
===================================================================
--- xfce4-mailwatch-plugin/trunk/NEWS 2008-09-11 04:55:12 UTC (rev 5386)
+++ xfce4-mailwatch-plugin/trunk/NEWS 2008-09-11 04:55:27 UTC (rev 5387)
@@ -17,6 +17,7 @@
* Fix removed new-mail folders sometimes re-adding themselves (bug 2647).
* Display message in log about possible incorrect username/password
when IMAP or POP3 authentication fails (bug 4344).
+ * Clean out stale mailbox data when a mailbox is removed.
Features:
* Update the new message counts for all mailboxes on startup, rather than
Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch.c 2008-09-11 04:55:12 UTC (rev 5386)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch.c 2008-09-11 04:55:27 UTC (rev 5387)
@@ -351,18 +351,29 @@
for(l = mailwatch->mailboxes, i = 0; l; l = l->next, i++) {
XfceMailwatchMailboxData *mdata = l->data;
- g_snprintf(buf, 32, "mailbox%d", i);
+ g_snprintf(buf, sizeof(buf), "mailbox%d", i);
xfce_rc_write_entry(rcfile, buf, mdata->mailbox->type->id);
- g_snprintf(buf, 32, "mailbox_name%d", i);
+ g_snprintf(buf, sizeof(buf), "mailbox_name%d", i);
xfce_rc_write_entry(rcfile, buf, mdata->mailbox_name);
}
+ /* clear out stale entries */
+ while(g_snprintf(buf, sizeof(buf), "mailbox%d", i)
+ && xfce_rc_has_entry(rcfile, buf))
+ {
+ xfce_rc_delete_entry(rcfile, buf, FALSE);
+ g_snprintf(buf, sizeof(buf), "mailbox_name%d", i);
+ xfce_rc_delete_entry(rcfile, buf, FALSE);
+ ++i;
+ }
/* write out config data for each mailbox */
for(l = mailwatch->mailboxes, i = 0; l; l = l->next, i++) {
XfceMailwatchMailboxData *mdata = l->data;
GList *config_data, *m;
- g_snprintf(buf, 32, "mailbox%d", i);
+ g_snprintf(buf, sizeof(buf), "mailbox%d", i);
+ if(xfce_rc_has_group(rcfile, buf))
+ xfce_rc_delete_group(rcfile, buf, FALSE);
xfce_rc_set_group(rcfile, buf);
config_data = mdata->mailbox->type->save_param_list_func(mdata->mailbox);
@@ -379,6 +390,13 @@
if(config_data)
g_list_free(config_data);
}
+ /* clear out stale groups */
+ while(g_snprintf(buf, sizeof(buf), "mailbox%d", i)
+ && xfce_rc_has_group(rcfile, buf))
+ {
+ xfce_rc_delete_group(rcfile, buf, FALSE);
+ ++i;
+ }
xfce_rc_close(rcfile);
More information about the Goodies-commits
mailing list