aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-user-creatable-items-handler.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-04-21 12:08:55 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-04-21 12:08:55 +0800
commitbb6445c7f1fe7573e76c227731f233f7d25d2636 (patch)
tree155ee08c9a8491e2d48b06dd53fceddaf6803ffd /shell/e-user-creatable-items-handler.c
parent5ceead1c12ce0e632512359632ccf54594c08a6d (diff)
downloadgsoc2013-evolution-bb6445c7f1fe7573e76c227731f233f7d25d2636.tar.gz
gsoc2013-evolution-bb6445c7f1fe7573e76c227731f233f7d25d2636.tar.zst
gsoc2013-evolution-bb6445c7f1fe7573e76c227731f233f7d25d2636.zip
if we're running a local create, invoke that directly via the callback.
2004-04-21 Not Zed <NotZed@Ximian.com> * e-user-creatable-items-handler.c (execute_verb): if we're running a local create, invoke that directly via the callback. (e_user_creatable_items_handler_new): add a callback for creating local items. svn path=/trunk/; revision=25544
Diffstat (limited to 'shell/e-user-creatable-items-handler.c')
-rw-r--r--shell/e-user-creatable-items-handler.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c
index b0ed095522..2bd84d9058 100644
--- a/shell/e-user-creatable-items-handler.c
+++ b/shell/e-user-creatable-items-handler.c
@@ -79,6 +79,10 @@ struct _EUserCreatableItemsHandlerPrivate {
/* This component's alias */
char *this_component;
+ /* For creating items on the view */
+ EUserCreatableItemsHandlerCreate create_local;
+ void *create_data;
+
/* The components that register user creatable items. */
GSList *components; /* Component */
@@ -371,18 +375,24 @@ execute_verb (EUserCreatableItemsHandler *handler,
if (component->type_list == NULL)
return;
+ /* TODO: why do we actually iterate this? Is it just to check we have it in the menu? The
+ search isn't used otherwise */
for (i = 0; i < component->type_list->_length; i ++) {
if (strcmp (component->type_list->_buffer[i].id, id) == 0) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
+ if (priv->create_local && priv->this_component && strcmp(priv->this_component, component->alias) == 0) {
+ priv->create_local(handler, id, priv->create_data);
+ } else {
+ CORBA_Environment ev;
- GNOME_Evolution_Component_requestCreateItem (component->component, id, &ev);
+ CORBA_exception_init (&ev);
+
+ GNOME_Evolution_Component_requestCreateItem (component->component, id, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Error in requestCreateItem -- %s", BONOBO_EX_REPOID (&ev));
+ if (ev._major != CORBA_NO_EXCEPTION)
+ g_warning ("Error in requestCreateItem -- %s", BONOBO_EX_REPOID (&ev));
- CORBA_exception_free (&ev);
+ CORBA_exception_free (&ev);
+ }
return;
}
}
@@ -809,11 +819,18 @@ init (EUserCreatableItemsHandler *handler)
EUserCreatableItemsHandler *
-e_user_creatable_items_handler_new (const char *component_alias)
+e_user_creatable_items_handler_new (const char *component_alias,
+ EUserCreatableItemsHandlerCreate create_local, void *data)
{
- return g_object_new (e_user_creatable_items_handler_get_type (),
- "this_component", component_alias,
- NULL);
+ EUserCreatableItemsHandler *handler;
+
+ handler = g_object_new (e_user_creatable_items_handler_get_type (),
+ "this_component", component_alias,
+ NULL);
+ handler->priv->create_local = create_local;
+ handler->priv->create_data = data;
+
+ return handler;
}