aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-user-creatable-items-handler.c39
-rw-r--r--shell/e-user-creatable-items-handler.h4
3 files changed, 38 insertions, 12 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a6f36fe11d..09b2d85a49 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2004-04-19 Jeffrey Stedfast <fejj@ximian.com>
* e-user-creatable-items-handler.c (ensure_menu_items): Same.
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;
}
diff --git a/shell/e-user-creatable-items-handler.h b/shell/e-user-creatable-items-handler.h
index f7be31894e..146672a35c 100644
--- a/shell/e-user-creatable-items-handler.h
+++ b/shell/e-user-creatable-items-handler.h
@@ -43,6 +43,7 @@ typedef struct _EUserCreatableItemsHandler EUserCreatableItemsHandler;
typedef struct _EUserCreatableItemsHandlerPrivate EUserCreatableItemsHandlerPrivate;
typedef struct _EUserCreatableItemsHandlerClass EUserCreatableItemsHandlerClass;
+typedef void (*EUserCreatableItemsHandlerCreate)(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data);
struct _EUserCreatableItemsHandler {
GObject parent;
@@ -56,7 +57,8 @@ struct _EUserCreatableItemsHandlerClass {
GType e_user_creatable_items_handler_get_type (void);
-EUserCreatableItemsHandler *e_user_creatable_items_handler_new (const char *component_alias);
+EUserCreatableItemsHandler *e_user_creatable_items_handler_new (const char *component_alias,
+ EUserCreatableItemsHandlerCreate create_local, void *data);
void e_user_creatable_items_handler_activate (EUserCreatableItemsHandler *handler,
BonoboUIComponent *ui_component);