diff options
author | JP Rosevear <jpr@ximian.com> | 2002-05-08 03:53:35 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-05-08 03:53:35 +0800 |
commit | 2017b2dcec910cc90d771fc2c124828e3c122014 (patch) | |
tree | 706437db1e84687c02cdaeee10d4693c3b8ee193 /shell/evolution-storage.c | |
parent | 03e2a84eda5327f01e768e74caa81247faf7a157 (diff) | |
download | gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.gz gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.zst gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.zip |
add every folder to the sequence except the root folder
2002-05-07 JP Rosevear <jpr@ximian.com>
* evolution-storage.c (get_folder_list_foreach): add every folder
to the sequence except the root folder
(impl_Storage_get_folder_list): implement corba method
(evolution_storage_get_epv): set new method implementation
* evolution-folder-selector-button.h: fix signal prototype
* e-folder-tree.h: new proto
* e-folder-tree.c (e_folder_tree_get_count): count nodes
(count_nodes): bump count foreach path
* e-corba-storage-registry.c
(impl_StorageRegistry_getStorageList): implement idl method
(corba_class_init): set epv method
* Evolution-Storage.idl: add getStorageList and getFolderList
methods
svn path=/trunk/; revision=16708
Diffstat (limited to 'shell/evolution-storage.c')
-rw-r--r-- | shell/evolution-storage.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index a48d135203..fa62c5244c 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -27,6 +27,7 @@ #include <glib.h> #include <gtk/gtksignal.h> #include <bonobo/bonobo-object.h> +#include <bonobo/bonobo-exception.h> #include <gal/util/e-util.h> @@ -250,6 +251,57 @@ impl_Storage__get_name (PortableServer_Servant servant, } static void +get_folder_list_foreach (EFolderTree *tree, + const char *path, + void *data, + void *closure) +{ + const GNOME_Evolution_Folder *corba_folder; + GNOME_Evolution_Folder *new_corba_folder; + GNOME_Evolution_FolderList *folder_list; + + corba_folder = (GNOME_Evolution_Folder *) data; + folder_list = (GNOME_Evolution_FolderList *) closure; + + /* The root folder has no data. */ + if (corba_folder == NULL) + return; + + new_corba_folder = folder_list->_buffer + folder_list->_length; + new_corba_folder->displayName = CORBA_string_dup (corba_folder->displayName); + new_corba_folder->description = CORBA_string_dup (corba_folder->description); + new_corba_folder->type = CORBA_string_dup (corba_folder->type); + new_corba_folder->physicalUri = CORBA_string_dup (corba_folder->physicalUri); + new_corba_folder->evolutionUri = CORBA_string_dup (corba_folder->evolutionUri); + new_corba_folder->unreadCount = corba_folder->unreadCount; + + folder_list->_length++; +} + +static GNOME_Evolution_FolderList * +impl_Storage_get_folder_list (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + EvolutionStorage *storage; + EvolutionStoragePrivate *priv; + GNOME_Evolution_FolderList *folder_list; + + bonobo_object = bonobo_object_from_servant (servant); + storage = EVOLUTION_STORAGE (bonobo_object); + priv = storage->priv; + + folder_list = GNOME_Evolution_FolderList__alloc (); + folder_list->_maximum = e_folder_tree_get_count (priv->folder_tree) - 1; + folder_list->_length = 0; + folder_list->_buffer = CORBA_sequence_GNOME_Evolution_Folder_allocbuf (folder_list->_maximum); + + e_folder_tree_foreach (priv->folder_tree, get_folder_list_foreach, folder_list); + + return folder_list; +} + +static void impl_Storage_async_create_folder (PortableServer_Servant servant, const CORBA_char *path, const CORBA_char *type, @@ -603,6 +655,7 @@ evolution_storage_get_epv (void) epv = g_new0 (POA_GNOME_Evolution_Storage__epv, 1); epv->_get_name = impl_Storage__get_name; + epv->getFolderList = impl_Storage_get_folder_list; epv->asyncCreateFolder = impl_Storage_async_create_folder; epv->asyncRemoveFolder = impl_Storage_async_remove_folder; epv->asyncXferFolder = impl_Storage_async_xfer_folder; |