aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-corba-storage-registry.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-05 04:01:31 +0800
committerDan Winship <danw@src.gnome.org>2002-04-05 04:01:31 +0800
commit54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d (patch)
tree5db3acedbe64f229af7052db4ec38e7ac5c19a3d /shell/e-corba-storage-registry.c
parent97e99e459e9a32c96ade6b1fbf9bd0da201de591 (diff)
downloadgsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.tar.gz
gsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.tar.zst
gsoc2013-evolution-54ddaa6e4852542cf37cfb32fa6bfcec92a2dd0d.zip
New widget for a button that displays a folder selection in a standard
* evolution-folder-selector-button.c: New widget for a button that displays a folder selection in a standard form, and when clicked lets the user select a new folder. * Evolution-Shell.idl (FolderSelectionListener:notifySelected): Make this take an Evolution:Folder instead of a pair of uris. (Shell:getIconByType): New method to get the icon for a type from the folder type registry. * Evolution-common.idl (Folder): add "evolutionUri" to the folder structure. * Evolution-Storage.idl (StorageRegistry:getFolderByUri): get an Evolution:Folder for a given uri. * evolution-shell-client.c (evolution_shell_client_user_select_folder): Update this to reflect the IDL change: return a GNOME_Evolution_Folder instead of a pair of URIs. Make sure it always sets *@folder_return to %NULL if it fails (even if it's a g_return_if_fail). (evolution_shell_client_get_storage_registry_interface): New. (evolution_shell_client_get_pixbuf_for_type): New. Uses Shell_getIconByType, but caches results. * e-shell.c (folder_selection_dialog_folder_selected_cb): Update for API change. (Return a GNOME_Evolution_Folder.) (impl_Shell_getIconByType): Implement. * e-corba-storage-registry.c (impl_StorageRegistry_getFolderByUri): Implement. * evolution-storage.c (evolution_storage_new_folder): Add a (dummy) evolutionUri to the folder. * Makefile.am (libeshell_la_SOURCES): add evolution-folder-selector-button.c (eshellinclude_HEADERS): and .h svn path=/trunk/; revision=16352
Diffstat (limited to 'shell/e-corba-storage-registry.c')
-rw-r--r--shell/e-corba-storage-registry.c66
1 files changed, 62 insertions, 4 deletions
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
index 6086bda60e..c93ac2caa5 100644
--- a/shell/e-corba-storage-registry.c
+++ b/shell/e-corba-storage-registry.c
@@ -24,12 +24,12 @@
#include <config.h>
#endif
-#include <gal/util/e-util.h>
-
#include "e-corba-storage.h"
-
#include "e-corba-storage-registry.h"
+#include "e-shell-constants.h"
+
#include <bonobo/bonobo-exception.h>
+#include <gal/util/e-util.h>
#define PARENT_TYPE BONOBO_OBJECT_TYPE
@@ -289,6 +289,63 @@ impl_StorageRegistry_removeListener (PortableServer_Servant servant,
g_slist_free (p);
}
+static GNOME_Evolution_Folder *
+impl_StorageRegistry_getFolderByUri (PortableServer_Servant servant,
+ const CORBA_char *uri,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ ECorbaStorageRegistry *storage_registry;
+ GNOME_Evolution_Folder *corba_folder;
+ EStorageSet *storage_set;
+ EFolder *folder;
+ char *path;
+ CORBA_char *corba_evolution_uri;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_registry = E_CORBA_STORAGE_REGISTRY (bonobo_object);
+ storage_set = storage_registry->priv->storage_set;
+
+ if (!strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN)) {
+ corba_evolution_uri = CORBA_string_dup (uri);
+ path = (char *)uri + E_SHELL_URI_PREFIX_LEN;
+ folder = e_storage_set_get_folder (storage_set, path);
+ } else {
+ path = e_storage_set_get_path_for_physical_uri (storage_set, uri);
+ if (path) {
+ corba_evolution_uri = CORBA_string_alloc (strlen (path) + E_SHELL_URI_PREFIX_LEN + 1);
+ strcpy (corba_evolution_uri, E_SHELL_URI_PREFIX);
+ strcat (corba_evolution_uri, path);
+ folder = e_storage_set_get_folder (storage_set, path);
+ g_free (path);
+ } else
+ folder = NULL;
+ }
+
+ if (!folder) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_GNOME_Evolution_StorageRegistry_NotFound,
+ NULL);
+ return CORBA_OBJECT_NIL;
+ }
+
+ corba_folder = GNOME_Evolution_Folder__alloc ();
+ corba_folder->displayName = CORBA_string_dup (e_folder_get_name (folder));
+ if (e_folder_get_description (folder))
+ corba_folder->description = CORBA_string_dup (e_folder_get_description (folder));
+ else
+ corba_folder->description = CORBA_string_dup ("");
+ corba_folder->type = CORBA_string_dup (e_folder_get_type_string (folder));
+ if (e_folder_get_physical_uri (folder))
+ corba_folder->physicalUri = CORBA_string_dup (e_folder_get_physical_uri (folder));
+ else
+ corba_folder->physicalUri = CORBA_string_dup ("");
+ corba_folder->evolutionUri = corba_evolution_uri;
+ corba_folder->unreadCount = e_folder_get_unread_count (folder);
+
+ return corba_folder;
+}
+
/* GtkObject methods. */
@@ -329,7 +386,8 @@ corba_class_init (void)
epv->removeStorageByName = impl_StorageRegistry_removeStorageByName;
epv->addListener = impl_StorageRegistry_addListener;
epv->removeListener = impl_StorageRegistry_removeListener;
-
+ epv->getFolderByUri = impl_StorageRegistry_getFolderByUri;
+
vepv = &storage_registry_vepv;
vepv->_base_epv = base_epv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();