diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-25 13:55:59 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-05-25 13:55:59 +0800 |
commit | bb241192eb773d7f0d178306dd55f9ca8e31c1f0 (patch) | |
tree | 4201777027364eeea243b2f625bb373bca30ef6d /shell/e-shell.c | |
parent | e90eea58a2109961faa8632ac5e5783d9970366b (diff) | |
download | gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.gz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.bz2 gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.lz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.xz gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.tar.zst gsoc2013-evolution-bb241192eb773d7f0d178306dd55f9ca8e31c1f0.zip |
Reorganized the shell to allow dynamic registration of storages and
folder types, and changed all the components to work with the new
setup.
svn path=/trunk/; revision=3199
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r-- | shell/e-shell.c | 77 |
1 files changed, 65 insertions, 12 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index 19cdcdc596..ca1c44f576 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -32,8 +32,9 @@ #include "e-util/e-util.h" +#include "e-component-registry.h" #include "e-corba-storage-registry.h" -#include "e-folder-type-repository.h" +#include "e-folder-type-registry.h" #include "e-local-storage.h" #include "e-shell-view.h" #include "e-shortcuts.h" @@ -52,14 +53,30 @@ struct _EShellPrivate { EStorageSet *storage_set; EShortcuts *shortcuts; - EFolderTypeRepository *folder_type_repository; + EFolderTypeRegistry *folder_type_registry; + + EComponentRegistry *component_registry; ECorbaStorageRegistry *corba_storage_registry; }; + +/* Constants. */ + #define SHORTCUTS_FILE_NAME "shortcuts.xml" #define LOCAL_STORAGE_DIRECTORY "local" +#ifdef USING_OAF +#define MAIL_COMPONENT_ID "OAFIID:evolution-shell-component:evolution-mail:d3cb3ed6-a654-4337-8aa0-f443751d6d1b" +#define CALENDAR_COMPONENT_ID "OAFIID:evolution-shell-component:evolution-calendar:2eb9eb63-d305-4918-9c35-faae5db19e51" +#define ADDRESSBOOK_COMPONENT_ID "OAFIID:evolution-shell-component:addressbook:b7a26547-7014-4bb5-98ab-2bcac2bb55ca" +#else +#define MAIL_COMPONENT_ID "evolution-shell-component:evolution-mail" +#define CALENDAR_COMPONENT_ID "evolution-shell-component:evolution-calendar" +#define ADDRESSBOOK_COMPONENT_ID "evolution-shell-component:addressbook" +#endif + + enum { NO_VIEWS_LEFT, LAST_SIGNAL @@ -143,15 +160,39 @@ setup_storages (EShell *shell) } g_free (local_storage_path); - g_assert (shell->priv->folder_type_repository); + g_assert (shell->priv->folder_type_registry); - priv->storage_set = e_storage_set_new (shell->priv->folder_type_repository); + priv->storage_set = e_storage_set_new (shell->priv->folder_type_registry); e_storage_set_add_storage (priv->storage_set, local_storage); return setup_corba_storages (shell); } +/* Initialization of the components. */ + +static void +setup_components (EShell *shell) +{ + EShellPrivate *priv; + + priv = shell->priv; + + priv->component_registry = e_component_registry_new (shell); + + /* FIXME: Hardcoded for now. */ + + if (! e_component_registry_register_component (priv->component_registry, MAIL_COMPONENT_ID)) + g_warning ("Cannot activate mail component -- %s", MAIL_COMPONENT_ID); + + if (! e_component_registry_register_component (priv->component_registry, CALENDAR_COMPONENT_ID)) + g_warning ("Cannot activate calendar component -- %s", CALENDAR_COMPONENT_ID); + + if (! e_component_registry_register_component (priv->component_registry, ADDRESSBOOK_COMPONENT_ID)) + g_warning ("Cannot activate addressbook component -- %s", ADDRESSBOOK_COMPONENT_ID); +} + + /* EShellView destruction callback. */ static void @@ -188,8 +229,11 @@ destroy (GtkObject *object) if (priv->shortcuts != NULL) gtk_object_unref (GTK_OBJECT (priv->shortcuts)); - if (priv->folder_type_repository != NULL) - gtk_object_unref (GTK_OBJECT (priv->folder_type_repository)); + if (priv->folder_type_registry != NULL) + gtk_object_unref (GTK_OBJECT (priv->folder_type_registry)); + + if (priv->component_registry != NULL) + gtk_object_unref (GTK_OBJECT (priv->component_registry)); for (p = priv->views; p != NULL; p = p->next) { EShellView *view; @@ -269,7 +313,8 @@ init (EShell *shell) priv->local_directory = NULL; priv->storage_set = NULL; priv->shortcuts = NULL; - priv->folder_type_repository = NULL; + priv->component_registry = NULL; + priv->folder_type_registry = NULL; priv->corba_storage_registry = NULL; shell->priv = priv; @@ -286,6 +331,7 @@ e_shell_construct (EShell *shell, g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (corba_object != CORBA_OBJECT_NIL); g_return_if_fail (local_directory != NULL); g_return_if_fail (g_path_is_absolute (local_directory)); @@ -294,12 +340,16 @@ e_shell_construct (EShell *shell, priv = shell->priv; priv->local_directory = g_strdup (local_directory); - priv->folder_type_repository = e_folder_type_repository_new (); + priv->folder_type_registry = e_folder_type_registry_new (); + /* Storages must be set up before the components, because otherwise components + cannot register their own storages. */ if (! setup_storages (shell)) return; - priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_repository); + setup_components (shell); + + priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_registry); shortcut_path = g_concat_dir_and_file (local_directory, "shortcuts.xml"); @@ -321,6 +371,9 @@ e_shell_new (const char *local_directory) Evolution_Shell corba_object; POA_Evolution_Shell *servant; + g_return_val_if_fail (local_directory != NULL, NULL); + g_return_val_if_fail (*local_directory != '\0', NULL); + servant = create_servant (); if (servant == NULL) return NULL; @@ -382,13 +435,13 @@ e_shell_get_storage_set (EShell *shell) return shell->priv->storage_set; } -EFolderTypeRepository * -e_shell_get_folder_type_repository (EShell *shell) +EFolderTypeRegistry * +e_shell_get_folder_type_registry (EShell *shell) { g_return_val_if_fail (shell != NULL, NULL); g_return_val_if_fail (E_IS_SHELL (shell), NULL); - return shell->priv->folder_type_repository; + return shell->priv->folder_type_registry; } |