diff options
author | Not Zed <NotZed@Ximian.com> | 2005-05-13 19:08:46 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-05-13 19:08:46 +0800 |
commit | b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6 (patch) | |
tree | 0c119ed2c3fb2e7306164b61fa5643a45d643421 | |
parent | 51490d54078a67793ab48584a4f672d0ae3d3bd4 (diff) | |
download | gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar.gz gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar.bz2 gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar.lz gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar.xz gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.tar.zst gsoc2013-evolution-b28bcfc9e5c9febb0f4c6702e3a0426bd5e087c6.zip |
if we have a factory method supplied, call that as well. More flexible
2005-05-13 Not Zed <NotZed@Ximian.com>
* e-popup.c (emph_popup_factory): if we have a factory method
supplied, call that as well. More flexible popup building.
(emph_construct_menu): load factory def.
svn path=/trunk/; revision=29352
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-popup.c | 11 | ||||
-rw-r--r-- | e-util/e-popup.h | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 791ad79c16..c2faeeb73b 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2005-05-13 Not Zed <NotZed@Ximian.com> + + * e-popup.c (emph_popup_factory): if we have a factory method + supplied, call that as well. More flexible popup building. + (emph_construct_menu): load factory def. + 2005-05-03 Not Zed <NotZed@Ximian.com> * e-profile-event.c (e_profile_event_emit): undefine diff --git a/e-util/e-popup.c b/e-util/e-popup.c index cb505e0cb2..d812e01d31 100644 --- a/e-util/e-popup.c +++ b/e-util/e-popup.c @@ -685,7 +685,7 @@ e_popup_target_free(EPopup *ep, void *o) description="IMAP4 and IMAP4v1 mail store"> <hook class="org.gnome.mail.popupMenu:1.0" handler="HandlePopup"> - <menu id="any" target="select"> + <menu id="any" target="select" factory="funcspec"?> <item type="item|toggle|radio|image|submenu|bar" active @@ -693,7 +693,7 @@ e_popup_target_free(EPopup *ep, void *o) label="label" icon="foo" visible="select_one" - activate="ep_view_emacs"/> + activate="ep_view_emacs"/> * </menu> </extension> @@ -735,6 +735,9 @@ emph_popup_factory(EPopup *emp, void *data) if (menu->items) e_popup_add_items(emp, menu->items, menu->hook->hook.plugin->domain, NULL, menu->hook); + + if (menu->factory) + e_plugin_invoke(menu->hook->hook.plugin, menu->factory, emp->target); } static void @@ -753,6 +756,7 @@ emph_free_menu(struct _EPopupHookMenu *menu) g_slist_foreach(menu->items, (GFunc)emph_free_item, NULL); g_slist_free(menu->items); + g_free(menu->factory); g_free(menu->id); g_free(menu); } @@ -817,6 +821,9 @@ emph_construct_menu(EPluginHook *eph, xmlNodePtr root) ((EPluginHookClass *)G_OBJECT_GET_CLASS(eph))->id); goto error; } + + menu->factory = e_plugin_xml_prop(root, "factory"); + node = root->children; while (node) { if (0 == strcmp(node->name, "item")) { diff --git a/e-util/e-popup.h b/e-util/e-popup.h index d347b38d62..9da06335f5 100644 --- a/e-util/e-popup.h +++ b/e-util/e-popup.h @@ -236,6 +236,7 @@ typedef void (*EPopupHookFunc)(struct _EPlugin *plugin, EPopupTarget *target); * @target_type: The target number of the type of target these menu * items expect. It will generally also be defined by the menu id. * @items: A list of EPopupItems. + * @factory: If supplied, a function to call * * The structure used to keep track of all of the items that a plugin * wishes to add to a given menu. This is used internally by a factory @@ -246,6 +247,7 @@ struct _EPopupHookMenu { char *id; /* target menu id for these menu items */ int target_type; /* target type of this menu */ GSList *items; /* items to add to menu */ + char *factory; /* optional factory to call for adding menu items */ }; /** |