[PATCH] Properly remove accounts in list store widget
- From: Sergio Villar Senín <svillar igalia com>
- Subject: [PATCH] Properly remove accounts in list store widget
- Date: Thu, 15 Jan 2009 15:42:29 +0100
---
ChangeLog | 6 +++
libtinymailui-gtk/tny-gtk-folder-list-store.c | 51 ++++++++++++++++---------
2 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c7e183d..ad89b65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-15 Sergio Villar Senin <svillar igalia com>
+
+ * libtinymailui-gtk/tny-gtk-folder-list-store.c
+ (tny_gtk_folder_list_store_remove): remove folders that
+ belong to the account that is being removed
+
2009-01-14 Jose Dapena Paz <jdapena igalia com>
* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c:
diff --git a/libtinymailui-gtk/tny-gtk-folder-list-store.c b/libtinymailui-gtk/tny-gtk-folder-list-store.c
index 6041e6a..e040da2 100644
--- a/libtinymailui-gtk/tny-gtk-folder-list-store.c
+++ b/libtinymailui-gtk/tny-gtk-folder-list-store.c
@@ -815,28 +815,43 @@ tny_gtk_folder_list_store_remove (TnyList *self, GObject* item)
me->first = g_list_remove (me->first, (gconstpointer)item);
- /* This doesn't have to be recursive as only the first-level folders are
- actually really part of the list. */
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ gboolean more_items = TRUE;
- if (gtk_tree_model_get_iter_first (model, &iter))
- do
- {
- GObject *citem = NULL;
- gtk_tree_model_get (model, &iter,
- TNY_GTK_FOLDER_LIST_STORE_INSTANCE_COLUMN,
- &citem, -1);
- if (citem == item)
- {
- /* This removes a reference count */
- gtk_list_store_remove (GTK_LIST_STORE (me), &iter);
+ do {
+ GObject *citem = NULL;
+ gboolean deleted;
+
+ deleted = FALSE;
+ gtk_tree_model_get (model, &iter,
+ TNY_GTK_FOLDER_LIST_STORE_INSTANCE_COLUMN,
+ &citem, -1);
+
+ if (TNY_IS_ACCOUNT (citem) || TNY_IS_MERGE_FOLDER (citem)) {
+ if (citem == item) {
+ more_items = gtk_list_store_remove (GTK_LIST_STORE (me), &iter);
+ deleted = TRUE;
+ }
+ } else if (TNY_IS_FOLDER (citem)) {
+ TnyAccount *account = tny_folder_get_account (TNY_FOLDER (citem));
+ if (account) {
+ if ((GObject *) account == item) {
+ more_items = gtk_list_store_remove (GTK_LIST_STORE (me), &iter);
+ deleted = TRUE;
+ }
+ g_object_unref (account);
+ }
+ }
if (citem)
g_object_unref (citem);
- break;
- }
- if (citem)
- g_object_unref (citem);
- } while (gtk_tree_model_iter_next (model, &iter));
+ /* If the item was deleted then the iter was
+ moved to the next row */
+ if (!deleted)
+ more_items = gtk_tree_model_iter_next (model, &iter);
+ } while (more_items);
+ }
+
g_mutex_unlock (me->iterator_lock);
}
--
1.5.2.4
--------------000005010507030203090003--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]