diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 6 | ||||
-rw-r--r-- | shell/evolution-storage.c | 60 | ||||
-rw-r--r-- | shell/evolution-storage.h | 2 |
3 files changed, 65 insertions, 3 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 445ee3f8b9..201c814670 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2001-06-21 Jason Leach <jleach@ximian.com> + + * evolution-storage.c (evolution_storage_deregister_on_shell): New + function, uses the StorageRegistry::removeStoragebyName corba call + to properly make the storage vanish from the shell. + 2001-06-18 Dan Winship <danw@ximian.com> * Makefile.am (evolution_LDADD): Remove DB3_LDADD diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index 517993fa79..ee6d446cb9 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -650,8 +650,8 @@ evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, CORBA_exception_init (&ev); corba_storage_registry = Bonobo_Unknown_queryInterface (corba_shell, - "IDL:GNOME/Evolution/StorageRegistry:1.0", - &ev); + "IDL:GNOME/Evolution/StorageRegistry:1.0", + &ev); if (corba_storage_registry == CORBA_OBJECT_NIL || ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); return EVOLUTION_STORAGE_ERROR_NOREGISTRY; @@ -668,6 +668,60 @@ evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, } EvolutionStorageResult +evolution_storage_deregister_on_shell (EvolutionStorage *evolution_storage, + GNOME_Evolution_Shell corba_shell) +{ + GNOME_Evolution_StorageRegistry corba_storage_registry; + EvolutionStorageResult result; + EvolutionStoragePrivate *priv; + CORBA_Environment ev; + + g_return_val_if_fail (evolution_storage != NULL, + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (EVOLUTION_IS_STORAGE (evolution_storage), + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + g_return_val_if_fail (corba_shell != CORBA_OBJECT_NIL, + EVOLUTION_STORAGE_ERROR_INVALIDPARAMETER); + + priv = evolution_storage->priv; + + CORBA_exception_init (&ev); + + corba_storage_registry = Bonobo_Unknown_queryInterface (corba_shell, + "IDL:GNOME/Evolution/StorageRegistry:1.0", + &ev); + if (corba_storage_registry == CORBA_OBJECT_NIL || ev._major != CORBA_NO_EXCEPTION) { + CORBA_exception_free (&ev); + return EVOLUTION_STORAGE_ERROR_NOREGISTRY; + } + + GNOME_Evolution_StorageRegistry_removeStorageByName (corba_storage_registry, + priv->name, + &ev); + + if (ev._major = CORBA_NO_EXCEPTION) + result = EVOLUTION_STORAGE_OK; + else { + if (ev._major != CORBA_USER_EXCEPTION) + result = EVOLUTION_STORAGE_ERROR_CORBA; + else if (strcmp (CORBA_exception_id (&ev), ex_GNOME_Evolution_StorageRegistry_NotFound) == 0) + result = EVOLUTION_STORAGE_ERROR_EXISTS; + else + result = EVOLUTION_STORAGE_ERROR_GENERIC; + } + + /* Now unref the EvolutionStorage */ + bonobo_object_unref (BONOBO_OBJECT (evolution_storage)); + + Bonobo_Unknown_unref (corba_storage_registry, &ev); + CORBA_Object_release (corba_storage_registry, &ev); + + CORBA_exception_free (&ev); + + return result; +} + +EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage, const char *path, const char *display_name, @@ -861,7 +915,7 @@ evolution_storage_removed_folder (EvolutionStorage *evolution_storage, listener = p->data; GNOME_Evolution_StorageListener_notifyFolderRemoved (listener, path, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) continue; diff --git a/shell/evolution-storage.h b/shell/evolution-storage.h index 94b512ae3c..00a2e8af49 100644 --- a/shell/evolution-storage.h +++ b/shell/evolution-storage.h @@ -110,6 +110,8 @@ EvolutionStorageResult evolution_storage_register (EvolutionStorage GNOME_Evolution_StorageRegistry corba_registry); EvolutionStorageResult evolution_storage_register_on_shell (EvolutionStorage *evolution_storage, GNOME_Evolution_Shell corba_shell); +EvolutionStorageResult evolution_storage_deregister_on_shell (EvolutionStorage *storage, + GNOME_Evolution_Shell corba_shell); EvolutionStorageResult evolution_storage_new_folder (EvolutionStorage *evolution_storage, const char *path, const char *display_name, |