From a3a512a3e5756adb9b5ec097b4e97a7c373a90bd Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 8 Jul 2002 19:01:37 +0000 Subject: New helper function. (e_folder_to_corba): Use it here. * e-folder.c (safe_corba_string_dup): New helper function. (e_folder_to_corba): Use it here. * Makefile.am (libeshell_la_SOURCES): Move e-folder.c here, from evolution_SOURCES. (eshellinclude_HEADERS): Likewise, move e-folder.h here. * evolution-storage.c (impl_Storage_getFolderAtPath): New, implementation for Evoluiton::Storage::getFolderAtPath. (evolution_storage_get_epv): Install CORBA method here. * Evolution-Storage.idl (getFolderAtPath): New method in Evolution::Storage. svn path=/trunk/; revision=17383 --- shell/ChangeLog | 16 ++++++++++++++++ shell/Evolution-Storage.idl | 6 ++++++ shell/Makefile.am | 4 ++-- shell/e-folder.c | 19 ++++++++++++++----- shell/e-local-storage.c | 3 --- shell/evolution-storage.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 67 insertions(+), 10 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 1542e8a4cf..2a7e916a78 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2002-07-08 Ettore Perazzoli + + * e-folder.c (safe_corba_string_dup): New helper function. + (e_folder_to_corba): Use it here. + + * Makefile.am (libeshell_la_SOURCES): Move e-folder.c here, from + evolution_SOURCES. + (eshellinclude_HEADERS): Likewise, move e-folder.h here. + + * evolution-storage.c (impl_Storage_getFolderAtPath): New, + implementation for Evoluiton::Storage::getFolderAtPath. + (evolution_storage_get_epv): Install CORBA method here. + + * Evolution-Storage.idl (getFolderAtPath): New method in + Evolution::Storage. + 2002-07-05 Ettore Perazzoli [Fix #22047, Crash after running the start-up wizard. The patch diff --git a/shell/Evolution-Storage.idl b/shell/Evolution-Storage.idl index dcc87ca6dd..e4ce3f1f1a 100644 --- a/shell/Evolution-Storage.idl +++ b/shell/Evolution-Storage.idl @@ -42,6 +42,12 @@ module Evolution { /* Whether the storage has folders from other user's. */ readonly attribute boolean hasSharedFolders; + + /* Get informatino for a folder. NOTE: evolutionUri in the + returned Folder is going to be an empty string if you use + this function. */ + Folder getFolderAtPath (in string path) + raises (NotFound); /* Flat list of the folders in the storage. */ readonly attribute FolderList folderList; diff --git a/shell/Makefile.am b/shell/Makefile.am index 95854f4f5a..7e79c317d4 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -73,6 +73,7 @@ eshellincludedir = $(includedir)/evolution/shell eshellinclude_HEADERS = \ Evolution.h \ + e-folder.h \ e-folder-list.h \ e-folder-tree.h \ evolution-activity-client.h \ @@ -91,6 +92,7 @@ eshellinclude_HEADERS = \ libeshell_la_SOURCES = \ $(IDL_GENERATED) \ + e-folder.c \ e-folder-list.c \ e-folder-tree.c \ e-shell-corba-icon-utils.c \ @@ -136,8 +138,6 @@ evolution_SOURCES = \ e-folder-dnd-bridge.h \ e-folder-type-registry.c \ e-folder-type-registry.h \ - e-folder.c \ - e-folder.h \ e-gray-bar.c \ e-gray-bar.h \ e-history.c \ diff --git a/shell/e-folder.c b/shell/e-folder.c index 3c2669f0bd..6f78e48db3 100644 --- a/shell/e-folder.c +++ b/shell/e-folder.c @@ -391,6 +391,15 @@ e_folder_get_can_sync_offline (EFolder *folder) /* Gotta love CORBA. */ +static CORBA_char * +safe_corba_string_dup (const char *s) +{ + if (s == NULL) + return CORBA_string_dup (""); + + return CORBA_string_dup (s); +} + void e_folder_to_corba (EFolder *folder, const char *evolution_uri, @@ -399,11 +408,11 @@ e_folder_to_corba (EFolder *folder, g_return_if_fail (E_IS_FOLDER (folder)); g_return_if_fail (folder_return != NULL); - folder_return->type = e_safe_corba_string_dup (e_folder_get_type_string (folder)); - folder_return->description = e_safe_corba_string_dup (e_folder_get_description (folder)); - folder_return->displayName = e_safe_corba_string_dup (e_folder_get_name (folder)); - folder_return->physicalUri = e_safe_corba_string_dup (e_folder_get_physical_uri (folder)); - folder_return->evolutionUri = e_safe_corba_string_dup (evolution_uri); + folder_return->type = safe_corba_string_dup (e_folder_get_type_string (folder)); + folder_return->description = safe_corba_string_dup (e_folder_get_description (folder)); + folder_return->displayName = safe_corba_string_dup (e_folder_get_name (folder)); + folder_return->physicalUri = safe_corba_string_dup (e_folder_get_physical_uri (folder)); + folder_return->evolutionUri = safe_corba_string_dup (evolution_uri); folder_return->unreadCount = e_folder_get_unread_count (folder); folder_return->canSyncOffline = e_folder_get_can_sync_offline (folder); } diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 882a52e5bb..ee8b09cb5c 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -520,9 +520,6 @@ component_async_remove_folder_callback (EvolutionShellComponentClient *shell_com if (result == EVOLUTION_SHELL_COMPONENT_OK) { result = remove_folder_directory (E_LOCAL_STORAGE (callback_data->storage), path); e_storage_removed_folder (E_STORAGE (callback_data->storage), path); - - g_print ("...Removed %s!\n", path); - evolution_storage_removed_folder (EVOLUTION_STORAGE (priv->bonobo_interface), path); } else { /* FIXME: Handle errors. */ diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 6648f61434..ebc514f774 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -33,6 +33,7 @@ #include "Evolution.h" +#include "e-folder.h" #include "e-folder-tree.h" #include "evolution-storage.h" @@ -271,6 +272,33 @@ impl_Storage__get_hasSharedFolders (PortableServer_Servant servant, return priv->has_shared_folders; } +static GNOME_Evolution_Folder * +impl_Storage_getFolderAtPath (PortableServer_Servant servant, + const CORBA_char *path, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + EvolutionStorage *storage; + EvolutionStoragePrivate *priv; + EFolder *folder; + GNOME_Evolution_Folder *corba_folder; + + bonobo_object = bonobo_object_from_servant (servant); + storage = EVOLUTION_STORAGE (bonobo_object); + priv = storage->priv; + + folder = e_folder_tree_get_folder (priv->folder_tree, path); + if (folder == NULL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Storage_NotFound, NULL); + return NULL; + } + + corba_folder = GNOME_Evolution_Folder__alloc (); + e_folder_to_corba (folder, "", corba_folder); + + return corba_folder; +} + static void get_folder_list_foreach (EFolderTree *tree, const char *path, @@ -699,6 +727,7 @@ evolution_storage_get_epv (void) epv = g_new0 (POA_GNOME_Evolution_Storage__epv, 1); epv->_get_name = impl_Storage__get_name; epv->_get_hasSharedFolders = impl_Storage__get_hasSharedFolders; + epv->getFolderAtPath = impl_Storage_getFolderAtPath; epv->_get_folderList = impl_Storage__get_folderList; epv->asyncCreateFolder = impl_Storage_asyncCreateFolder; epv->asyncRemoveFolder = impl_Storage_asyncRemoveFolder; -- cgit v1.2.3