diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-08 01:01:52 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-08 01:01:52 +0800 |
commit | e7971bb4f5f1d262a3f3af99f81c221a724131da (patch) | |
tree | 9a27ea0d6eeda598771c40bea1b896a58d0bbe0f /shell/e-storage-set.c | |
parent | 6aac85ab5b50dc9e3cc454c37858755a564120c3 (diff) | |
download | gsoc2013-evolution-e7971bb4f5f1d262a3f3af99f81c221a724131da.tar.gz gsoc2013-evolution-e7971bb4f5f1d262a3f3af99f81c221a724131da.tar.zst gsoc2013-evolution-e7971bb4f5f1d262a3f3af99f81c221a724131da.zip |
Fixed a refcount leak and added interfaces to add/remove folders
from an EStorage (although they are not implemented yet).
svn path=/trunk/; revision=3460
Diffstat (limited to 'shell/e-storage-set.c')
-rw-r--r-- | shell/e-storage-set.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 7a71f518fe..33dc366afe 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -49,7 +49,7 @@ struct _NamedStorage { typedef struct _NamedStorage NamedStorage; struct _EStorageSetPrivate { - GList *storages; + GList *storages; /* EStorage */ GHashTable *name_to_named_storage; EFolderTypeRegistry *folder_type_registry; @@ -85,6 +85,19 @@ named_storage_destroy (NamedStorage *named_storage) g_free (named_storage); } +static gboolean +name_to_named_storage_foreach_destroy (void *key, + void *value, + void *user_data) +{ + NamedStorage *named_storage; + + named_storage = (NamedStorage *) value; + named_storage_destroy (named_storage); + + return TRUE; +} + /* Handling for signals coming from the EStorages. */ @@ -345,6 +358,35 @@ e_storage_set_remove_storage (EStorageSet *storage_set, return TRUE; } +void +e_storage_set_remove_all_storages (EStorageSet *storage_set) +{ + EStorageSetPrivate *priv; + GList *p; + + g_return_if_fail (storage_set != NULL); + g_return_if_fail (E_IS_STORAGE_SET (storage_set)); + + priv = storage_set->priv; + + for (p = priv->storages; p != NULL; p = p->next) { + EStorage *storage; + + storage = E_STORAGE (p->data); + + gtk_signal_emit (GTK_OBJECT (storage_set), signals[REMOVED_STORAGE], storage); + gtk_object_unref (GTK_OBJECT (storage)); + } + + g_hash_table_foreach_remove (priv->name_to_named_storage, + name_to_named_storage_foreach_destroy, + NULL); + + g_list_free (priv->storages); + priv->storages = NULL; +} + + EStorage * e_storage_set_get_storage (EStorageSet *storage_set, const char *name) |