diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-02-08 01:36:53 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-02-08 02:26:37 +0800 |
commit | 49ef32b76c55cbefba53568f02028dddf23a9bc9 (patch) | |
tree | 682e825cab580d4c401f0a138ee29a8534336591 /modules | |
parent | 2ef43b4cf40d21c61d39c5a938e428afa9074e2b (diff) | |
download | gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar.gz gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar.bz2 gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar.lz gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar.xz gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.tar.zst gsoc2013-evolution-49ef32b76c55cbefba53568f02028dddf23a9bc9.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/plugin-lib/e-plugin-lib.c | 55 | ||||
-rw-r--r-- | modules/plugin-lib/e-plugin-lib.h | 2 | ||||
-rw-r--r-- | modules/plugin-mono/e-plugin-mono.c | 7 |
3 files changed, 31 insertions, 33 deletions
diff --git a/modules/plugin-lib/e-plugin-lib.c b/modules/plugin-lib/e-plugin-lib.c index f5b5b9dbd1..33ba699258 100644 --- a/modules/plugin-lib/e-plugin-lib.c +++ b/modules/plugin-lib/e-plugin-lib.c @@ -79,40 +79,41 @@ plugin_lib_loadmodule (EPlugin *plugin) } static gpointer -plugin_lib_invoke (EPlugin *plugin, const gchar *name, gpointer data) +plugin_lib_get_symbol (EPlugin *plugin, const gchar *name) { EPluginLib *plugin_lib = E_PLUGIN_LIB (plugin); - EPluginLibFunc cb; - - if (!plugin->enabled) { - g_warning ("trying to invoke '%s' on disabled plugin '%s'", name, plugin->id); - return NULL; - } + gpointer symbol; if (plugin_lib_loadmodule (plugin) != 0) return NULL; - if (!g_module_symbol (plugin_lib->module, name, (gpointer)&cb)) { - g_warning ("Cannot resolve symbol '%s' in plugin '%s' (not exported?)", name, plugin_lib->location); + if (!g_module_symbol (plugin_lib->module, name, &symbol)) return NULL; - } - return cb (plugin, data); + return symbol; } static gpointer -plugin_lib_get_symbol (EPlugin *plugin, const gchar *name) +plugin_lib_invoke (EPlugin *plugin, const gchar *name, gpointer data) { EPluginLib *plugin_lib = E_PLUGIN_LIB (plugin); - gpointer symbol; + EPluginLibFunc func; - if (plugin_lib_loadmodule (plugin) != 0) + if (!plugin->enabled) { + g_warning ("trying to invoke '%s' on disabled plugin '%s'", name, plugin->id); return NULL; + } - if (!g_module_symbol (plugin_lib->module, name, &symbol)) + func = plugin_lib_get_symbol (plugin, name); + + if (func == NULL) { + g_warning ( + "Cannot resolve symbol '%s' in plugin '%s' " + "(not exported?)", name, plugin_lib->location); return NULL; + } - return symbol; + return func (plugin, data); } static gint @@ -164,16 +165,14 @@ plugin_lib_construct (EPlugin *plugin, xmlNodePtr root) static GtkWidget * plugin_lib_get_configure_widget (EPlugin *plugin) { - EPluginLib *plugin_lib = E_PLUGIN_LIB (plugin); EPluginLibGetConfigureWidgetFunc get_configure_widget; - if (plugin_lib_loadmodule (plugin) != 0) { - return NULL; - } + get_configure_widget = plugin_lib_get_symbol ( + plugin, "e_plugin_lib_get_configure_widget"); + + if (get_configure_widget != NULL) + return get_configure_widget (plugin); - if (g_module_symbol (plugin_lib->module, "e_plugin_lib_get_configure_widget", (gpointer)&get_configure_widget)) { - return (GtkWidget*) get_configure_widget (plugin); - } return NULL; } @@ -189,14 +188,10 @@ plugin_lib_enable (EPlugin *plugin, gint state) if (!state && plugin_lib->module == NULL) return; - /* this will noop if we're disabling since we tested it above */ - if (plugin_lib_loadmodule (plugin) != 0) - return; + enable = plugin_lib_get_symbol (plugin, "e_plugin_lib_enable"); - if (g_module_symbol (plugin_lib->module, "e_plugin_lib_enable", (gpointer) &enable)) { - if (enable (plugin, state) != 0) - return; - } + if (enable != NULL) + enable (plugin, state); } static void diff --git a/modules/plugin-lib/e-plugin-lib.h b/modules/plugin-lib/e-plugin-lib.h index 6ca7d697a9..91f440bf49 100644 --- a/modules/plugin-lib/e-plugin-lib.h +++ b/modules/plugin-lib/e-plugin-lib.h @@ -57,7 +57,7 @@ typedef gpointer (*EPluginLibFunc) (EPlugin *ep, gpointer data); * is disabled. */ typedef gint (*EPluginLibEnableFunc) (EPlugin *ep, gint enable); -typedef gpointer (*EPluginLibGetConfigureWidgetFunc) (EPlugin *ep); +typedef GtkWidget * (*EPluginLibGetConfigureWidgetFunc) (EPlugin *ep); /** * struct _EPluginLib - diff --git a/modules/plugin-mono/e-plugin-mono.c b/modules/plugin-mono/e-plugin-mono.c index 1c43fb9d56..f1fe76ff49 100644 --- a/modules/plugin-mono/e-plugin-mono.c +++ b/modules/plugin-mono/e-plugin-mono.c @@ -121,7 +121,8 @@ plugin_mono_invoke (EPlugin *plugin, plugin_mono = E_PLUGIN_MONO (plugin); priv = plugin_mono->priv; - /* we need to do this every time since we may be called from any thread for some uses */ + /* We need to do this every time since we may + * be called from any thread for some uses. */ mono_thread_attach (domain); if (priv->assembly == NULL) { @@ -135,7 +136,9 @@ plugin_mono_invoke (EPlugin *plugin, } if (plugin_mono->handler == NULL - || (priv->class = mono_class_from_name (mono_assembly_get_image (priv->assembly), "", plugin_mono->handler)) == NULL) { + || (priv->class = mono_class_from_name ( + mono_assembly_get_image (priv->assembly), + "", plugin_mono->handler)) == NULL) { } else { priv->plugin = mono_object_new (domain, priv->class); /* could conceivably init with some context too */ |