aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-05-08 03:53:35 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-05-08 03:53:35 +0800
commit2017b2dcec910cc90d771fc2c124828e3c122014 (patch)
tree706437db1e84687c02cdaeee10d4693c3b8ee193
parent03e2a84eda5327f01e768e74caa81247faf7a157 (diff)
downloadgsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar
gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.gz
gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.bz2
gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.lz
gsoc2013-evolution-2017b2dcec910cc90d771fc2c124828e3c122014.tar.xz
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
-rw-r--r--shell/ChangeLog21
-rw-r--r--shell/Evolution-Storage.idl8
-rw-r--r--shell/e-corba-storage-registry.c50
-rw-r--r--shell/e-folder-tree.c29
-rw-r--r--shell/e-folder-tree.h4
-rw-r--r--shell/evolution-folder-selector-button.h2
-rw-r--r--shell/evolution-storage.c53
7 files changed, 165 insertions, 2 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 7386b92569..bdc31f8378 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,24 @@
+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
+
2002-05-07 Ettore Perazzoli <ettore@ximian.com>
* evolution-test-component.c (create_new_folder_selector): Use the
diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl
index 04999d24a3..824d6e32e3 100644
--- a/shell/Evolution-Storage.idl
+++ b/shell/Evolution-Storage.idl
@@ -21,6 +21,8 @@ module Evolution {
attribute string name;
+ typedef sequence<Folder> FolderList;
+
enum Result {
OK,
UNSUPPORTED_OPERATION,
@@ -39,6 +41,8 @@ module Evolution {
string path;
};
+ FolderList getFolderList ();
+
void asyncCreateFolder (in string path,
in string type,
in string description,
@@ -95,6 +99,8 @@ module Evolution {
exception NotFound {};
exception AlreadyListening {};
+ typedef sequence<Storage> StorageList;
+
enum MessageType {
STORAGE_CREATED,
STORAGE_DESTROYED
@@ -108,6 +114,8 @@ module Evolution {
StorageListener addStorage (in Storage storage,
in string name)
raises (Exists);
+
+ StorageList getStorageList ();
Storage getStorageByName (in string name)
raises (NotFound);
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
index 72ddf075a8..36f2a89ce5 100644
--- a/shell/e-corba-storage-registry.c
+++ b/shell/e-corba-storage-registry.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif
+#include "e-local-storage.h"
#include "e-corba-storage.h"
#include "e-corba-storage-registry.h"
#include "e-shell-constants.h"
@@ -130,6 +131,54 @@ impl_StorageRegistry_addStorage (PortableServer_Servant servant,
return listener_interface;
}
+static GNOME_Evolution_StorageRegistry_StorageList *
+impl_StorageRegistry_getStorageList (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ECorbaStorageRegistry *storage_registry;
+ ECorbaStorageRegistryPrivate *priv;
+ GNOME_Evolution_StorageRegistry_StorageList *storage_list;
+ GList *sl, *l;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
+ priv = storage_registry->priv;
+
+ sl = e_storage_set_get_storage_list (priv->storage_set);
+
+ storage_list = GNOME_Evolution_StorageRegistry_StorageList__alloc ();
+ storage_list->_maximum = g_list_length (sl);
+ storage_list->_length = 0;
+ storage_list->_buffer = CORBA_sequence_GNOME_Evolution_Storage_allocbuf (storage_list->_maximum);
+ for (l = sl; l != NULL; l = l->next) {
+ EStorage *storage;
+ GNOME_Evolution_Storage corba_storage;
+ CORBA_Environment ev2;
+
+ CORBA_exception_init (&ev2);
+
+ storage = l->data;
+ if (E_IS_LOCAL_STORAGE (storage)) {
+ corba_storage = e_local_storage_get_corba_interface (E_LOCAL_STORAGE (storage));
+ } else if (E_IS_CORBA_STORAGE (storage)) {
+ corba_storage = e_corba_storage_get_corba_objref (E_CORBA_STORAGE (storage));
+ } else {
+ continue;
+ }
+
+ corba_storage = CORBA_Object_duplicate (corba_storage, &ev2);
+ if (BONOBO_EX (&ev2)) {
+ CORBA_exception_free (&ev2);
+ continue;
+ }
+ storage_list->_buffer[storage_list->_length] = corba_storage;
+ storage_list->_length++;
+ }
+
+ return storage_list;
+}
+
static GNOME_Evolution_Storage
impl_StorageRegistry_getStorageByName (PortableServer_Servant servant,
const CORBA_char *name,
@@ -384,6 +433,7 @@ corba_class_init (void)
epv = g_new0 (POA_GNOME_Evolution_StorageRegistry__epv, 1);
epv->addStorage = impl_StorageRegistry_addStorage;
+ epv->getStorageList = impl_StorageRegistry_getStorageList;
epv->getStorageByName = impl_StorageRegistry_getStorageByName;
epv->removeStorageByName = impl_StorageRegistry_removeStorageByName;
epv->addListener = impl_StorageRegistry_addListener;
diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c
index d89476df2e..46e7897711 100644
--- a/shell/e-folder-tree.c
+++ b/shell/e-folder-tree.c
@@ -315,6 +315,35 @@ e_folder_tree_remove (EFolderTree *folder_tree,
return TRUE;
}
+static void
+count_nodes (EFolderTree *tree,
+ const char *path,
+ void *data,
+ void *closure)
+{
+ int *count = closure;
+
+ (*count)++;
+}
+
+/**
+ * e_folder_tree_get_count:
+ * @folder_tree: A pointer to an EFolderTree
+ *
+ * Gets the number of folders in the tree
+ *
+ * Return value: The number of folders in the tree
+ **/
+int
+e_folder_tree_get_count (EFolderTree *folder_tree)
+{
+ int count = 0;
+
+ e_folder_tree_foreach (folder_tree, count_nodes, &count);
+
+ return count;
+}
+
/**
* e_folder_tree_get_folder:
* @folder_tree: A pointer to an EFolderTree
diff --git a/shell/e-folder-tree.h b/shell/e-folder-tree.h
index 0c851d67f9..bb2f29702a 100644
--- a/shell/e-folder-tree.h
+++ b/shell/e-folder-tree.h
@@ -42,7 +42,9 @@ gboolean e_folder_tree_add (EFolderTree *folder_tre
void *data);
gboolean e_folder_tree_remove (EFolderTree *folder_tree,
const char *path);
-
+
+int e_folder_tree_get_count (EFolderTree *folder_tree);
+
void *e_folder_tree_get_folder (EFolderTree *folder_tree,
const char *path);
GList *e_folder_tree_get_subfolders (EFolderTree *folder_tree,
diff --git a/shell/evolution-folder-selector-button.h b/shell/evolution-folder-selector-button.h
index 71b0a10165..d2918bd143 100644
--- a/shell/evolution-folder-selector-button.h
+++ b/shell/evolution-folder-selector-button.h
@@ -52,7 +52,7 @@ struct _EvolutionFolderSelectorButtonClass {
GtkButtonClass parent_class;
/* signals */
- void (*selected) (GNOME_Evolution_Folder *folder);
+ void (*selected) (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder);
};
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;