aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-plugin.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-05-09 02:11:40 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-05-09 02:11:40 +0800
commit116ed5dcc7bc07fc9a2e78aef4231bfe25fa9d0a (patch)
tree49a7516e812c322167681a65bfdca0285b336733 /e-util/e-plugin.c
parent3986fb032adb5b40ae86624f209524b3273d0148 (diff)
downloadgsoc2013-evolution-116ed5dcc7bc07fc9a2e78aef4231bfe25fa9d0a.tar.gz
gsoc2013-evolution-116ed5dcc7bc07fc9a2e78aef4231bfe25fa9d0a.tar.zst
gsoc2013-evolution-116ed5dcc7bc07fc9a2e78aef4231bfe25fa9d0a.zip
** Fixes bug #525241 (EPluginUI)
2008-05-08 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #525241 (EPluginUI) * e-util/Makefile.am: Add e-plugin-ui.[ch]. * e-util/e-plugin.h (EPluginClass): Add a "get_symbol" method for extracting arbitrary symbols from an EPlugin. Implementation of the method is optional. * e-util/e-plugin.c (e_plugin_get_symbol): New function invokes the new "get_symbol" EPlugin method. * e-util/e-plugin.c (epl_get_symbol): New function implements the new "get_symbol" EPlugin method. It extracts the given symbol name from the GModule. * e-util/e-plugin-ui.[ch]: New EPluginHook subclass that allows plugins to extend menus, toolbars, and popups that are managed by GtkUIManager instead of BonoboUI. Should eventually replace EMenu/EPopup. * shell/main.c (main): Register the EPluginUIHook type. * composer/e-msg-composer.c (msg_composer_destroy), (msg_composer_init): Rip out the EMenu logic. * composer/e-msg-composer.c (msg_composer_init): Register the GtkUIManager with EPluginUI. * plugins/face/Makefile.am: * plugins/face/org-gnome-face-ui.xml: Remove org-gnome-face-ui.xml (obsolete). * plugins/face/face.c (e_plugin_ui_init): Initialization callback for EPluginUI. Adds a "face" action to the EMsgComposer instance's "composer" action group. * plugins/face/org-gnome-face.eplug.xml: Replace the "bonobomenu" hook definition with a new one for EPluginUI. Include the UI definition inline. svn path=/trunk/; revision=35485
Diffstat (limited to 'e-util/e-plugin.c')
-rw-r--r--e-util/e-plugin.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c
index d4770915d3..e91169ac67 100644
--- a/e-util/e-plugin.c
+++ b/e-util/e-plugin.c
@@ -697,6 +697,27 @@ e_plugin_invoke(EPlugin *ep, const char *name, void *data)
}
/**
+ * e_plugin_get_symbol:
+ * @ep: an #EPlugin
+ * @name: The name of the symbol to fetch. The format of this name
+ * will depend on the EPlugin type and its language conventions.
+ *
+ * Helper to fetch a symbol name from a plugin.
+ *
+ * Return value: the symbol value, or %NULL if not found
+ **/
+void *
+e_plugin_get_symbol(EPlugin *ep, const char *name)
+{
+ EPluginClass *class;
+
+ class = (EPluginClass *) G_OBJECT_GET_CLASS (ep);
+ g_return_val_if_fail (class->get_symbol != NULL, NULL);
+
+ return class->get_symbol (ep, name);
+}
+
+/**
* e_plugin_enable:
* @ep:
* @state:
@@ -927,6 +948,20 @@ epl_invoke(EPlugin *ep, const char *name, void *data)
return cb(epl, data);
}
+static void *
+epl_get_symbol(EPlugin *ep, const gchar *name)
+{
+ gpointer symbol;
+
+ if (epl_loadmodule(ep) != 0)
+ return NULL;
+
+ if (!g_module_symbol (epl->module, name, &symbol))
+ return NULL;
+
+ return symbol;
+}
+
static int
epl_construct(EPlugin *ep, xmlNodePtr root)
{
@@ -1029,6 +1064,7 @@ epl_class_init(EPluginClass *klass)
((GObjectClass *)klass)->finalize = epl_finalise;
klass->construct = epl_construct;
klass->invoke = epl_invoke;
+ klass->get_symbol = epl_get_symbol;
klass->enable = epl_enable;
klass->get_configure_widget = epl_get_configure_widget;
klass->type = "shlib";