aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-10 07:37:56 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-10 07:37:56 +0800
commit20801a94aaba0002a8adb7df3829494e4164d5bf (patch)
treea13690465e7f5eeb434f4bb1104ec3e9fc1670ae /shell/e-shell.c
parent3c88c8b755113fb61bf153d6070ed92274fb5d02 (diff)
downloadgsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar.gz
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar.bz2
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar.lz
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar.xz
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.tar.zst
gsoc2013-evolution-20801a94aaba0002a8adb7df3829494e4164d5bf.zip
Add the menu items using the EShellUserCreatableItemsHandler.
* e-shell-view.c (e_shell_view_construct): Add the menu items using the EShellUserCreatableItemsHandler. * e-shell-user-creatable-items-handler.c: New. * e-shell-user-creatable-items-handler.h: New. * e-shell.c: New member `user_creatable_items_handler' in `EShellPrivate'. (init): Initialize to NULL. (destroy): Unref. (e_shell_construct): Create here. (e_shell_get_user_creatable_items_handler): New accessor. (setup_components): Add the registered components to the user_creatable_items_handler. * evolution-test-component.c (factory_fn): Add a couple sample user-creatable items. (user_create_new_item_callback): New callback for the "user_create_new_item" signal on the EvolutionShellComponent. (factory_fn): Connect. * e-shell.c (e_shell_get_component_registry): New. * evolution-shell-component.c: New enum value `USER_CREATE_NEW_ITEM'. New member `user_create_item_types' in `_EvolutionShellComponentPrivate'. (init): Init to NULL. (impl_destroy): Free it. (user_creatable_item_type_free): New helper function. (user_creatable_item_type_new): New helper function. (impl_userCreateNewItem): New, implementation for ::userCreateNewItem. (class_init): Install the "user_create_new_item" signal and the userCreateNewItem impl. (impl__get_external_uri_schemas): Renamed from `impl_ShellComponent__get_external_uri_schemas'. (impl___get_supported_types): Renamed from `impl_ShellComponent__get_supported_types'. (impl__get_user_creatable_item_types): New, implementation for the `user_creatable_item_types' attribute. (class_init): Install it. (evolution_shell_component_add_user_creatable_item): New. * evolution-shell-component.h: Added signal `user_create_new_item'. * Evolution-ShellComponent.idl: Added typedefs `UserCreatableItemType', `UserCreatableItemTypeList'. New attribute `user_creatable_item_types'. (userCreateNewItem): New. svn path=/trunk/; revision=11849
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c66
1 files changed, 48 insertions, 18 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 2d2d11565b..3d1fec1ff5 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -88,6 +88,8 @@ struct _EShellPrivate {
EComponentRegistry *component_registry;
+ EShellUserCreatableItemsHandler *user_creatable_items_handler;
+
/* ::StorageRegistry interface handler. */
ECorbaStorageRegistry *corba_storage_registry; /* <aggregate> */
@@ -575,10 +577,14 @@ setup_components (EShell *shell,
info = info_list->_buffer + i;
- if (! e_component_registry_register_component (priv->component_registry, info->iid))
+ if (! e_component_registry_register_component (priv->component_registry, info->iid)) {
g_warning ("Cannot activate Evolution component -- %s", info->iid);
- else
+ } else {
+ e_shell_user_creatable_items_handler_add_component
+ (priv->user_creatable_items_handler,
+ e_component_registry_get_component_by_id (priv->component_registry, info->iid));
g_print ("Evolution component activated successfully -- %s\n", info->iid);
+ }
if (splash != NULL)
e_splash_set_icon_highlight (splash, i, TRUE);
@@ -707,6 +713,9 @@ destroy (GtkObject *object)
if (priv->component_registry != NULL)
gtk_object_unref (GTK_OBJECT (priv->component_registry));
+ if (priv->user_creatable_items_handler != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->user_creatable_items_handler));
+
for (p = priv->views; p != NULL; p = p->next) {
EShellView *view;
@@ -795,22 +804,23 @@ init (EShell *shell)
priv->views = NULL;
- priv->iid = NULL;
- priv->local_directory = NULL;
- priv->storage_set = NULL;
- priv->local_storage = NULL;
- priv->summary_storage = NULL;
- priv->shortcuts = NULL;
- priv->component_registry = NULL;
- priv->folder_type_registry = NULL;
- priv->uri_schema_registry = NULL;
- priv->corba_storage_registry = NULL;
- priv->activity_handler = NULL;
- priv->corba_shortcuts = NULL;
- priv->offline_handler = NULL;
- priv->crash_type_names = NULL;
- priv->line_status = E_SHELL_LINE_STATUS_ONLINE;
- priv->db = CORBA_OBJECT_NIL;
+ priv->iid = NULL;
+ priv->local_directory = NULL;
+ priv->storage_set = NULL;
+ priv->local_storage = NULL;
+ priv->summary_storage = NULL;
+ priv->shortcuts = NULL;
+ priv->component_registry = NULL;
+ priv->user_creatable_items_handler = NULL;
+ priv->folder_type_registry = NULL;
+ priv->uri_schema_registry = NULL;
+ priv->corba_storage_registry = NULL;
+ priv->activity_handler = NULL;
+ priv->corba_shortcuts = NULL;
+ priv->offline_handler = NULL;
+ priv->crash_type_names = NULL;
+ priv->line_status = E_SHELL_LINE_STATUS_ONLINE;
+ priv->db = CORBA_OBJECT_NIL;
shell->priv = priv;
}
@@ -896,6 +906,8 @@ e_shell_construct (EShell *shell,
while (gtk_events_pending ())
gtk_main_iteration ();
+ priv->user_creatable_items_handler = e_shell_user_creatable_items_handler_new ();
+
if (show_splash)
setup_components (shell, E_SPLASH (splash));
else
@@ -1554,6 +1566,24 @@ e_shell_get_config_db (EShell *shell)
return shell->priv->db;
}
+EComponentRegistry *
+e_shell_get_component_registry (EShell *shell)
+{
+ g_return_val_if_fail (shell != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ return shell->priv->component_registry;
+}
+
+EShellUserCreatableItemsHandler *
+e_shell_get_user_creatable_items_handler (EShell *shell)
+{
+ g_return_val_if_fail (shell != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ return shell->priv->user_creatable_items_handler;
+}
+
void
e_shell_unregister_all (EShell *shell)