From 32f545cdf031ebe3718791f18e8fb6b6141fd081 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 28 Aug 2009 20:21:54 -0400 Subject: Simplify EPlugin loading at startup. - Require all EPlugin and EPluginHook subtypes be registered before loading plugins. This drastically simplifies the EPlugin/EPluginHook negotiation. - Turn most EPluginHook subtypes into GTypeModules and register their types from an e_module_load() function (does not include shell hooks). - Convert EPluginLib and the Mono and Python bindings to GTypeModules and register their types from an e_module_load() function, and kill EPluginTypeHook. --- e-util/e-plugin.h | 118 ------------------------------------------------------ 1 file changed, 118 deletions(-) (limited to 'e-util/e-plugin.h') diff --git a/e-util/e-plugin.h b/e-util/e-plugin.h index 18949bf893..8e24436605 100644 --- a/e-util/e-plugin.h +++ b/e-util/e-plugin.h @@ -64,8 +64,6 @@ struct _EPluginAuthor { * @object: Superclass. * @id: Unique identifier for plugin instance. * @path: Filename where the xml definition resides. - * @hooks_pending: A list hooks which can't yet be loaded. This is - * the xmlNodePtr to the root node of the hook definition. * @description: A description of the plugin's purpose. * @name: The name of the plugin. * @domain: The translation domain for this plugin. @@ -82,7 +80,6 @@ struct _EPlugin { gchar *id; gchar *path; - GSList *hooks_pending; gchar *description; gchar *name; @@ -134,11 +131,8 @@ GType e_plugin_get_type(void); gint e_plugin_construct(EPlugin *ep, xmlNodePtr root); void e_plugin_add_load_path(const gchar *); gint e_plugin_load_plugins(void); -void e_plugin_load_plugins_with_missing_symbols(void); GSList * e_plugin_list_plugins(void); -void e_plugin_register_type(GType type); - gpointer e_plugin_get_symbol(EPlugin *ep, const gchar *name); gpointer e_plugin_invoke(EPlugin *ep, const gchar *name, gpointer data); void e_plugin_enable(EPlugin *eph, gint state); @@ -153,73 +147,6 @@ gint e_plugin_xml_int(xmlNodePtr node, const gchar *id, gint def); gchar *e_plugin_xml_content(xmlNodePtr node); gchar *e_plugin_xml_content_domain(xmlNodePtr node, const gchar *domain); -/* ********************************************************************** */ -#include - -/* Standard GObject macros */ -#define E_TYPE_PLUGIN_LIB \ - (e_plugin_lib_get_type ()) -#define E_PLUGIN_LIB(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_PLUGIN_LIB, EPluginLib)) -#define E_PLUGIN_LIB_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_PLUGIN_LIB, EPluginLibClass)) -#define E_IS_PLUGIN_LIB(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_PLUGIN_LIB)) -#define E_IS_PLUGIN_LIB_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_PLUGIN_LIB)) -#define E_PLUGIN_LIB_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_PLUGIN_LIB, EPluginLibClass)) - -typedef struct _EPluginLib EPluginLib; -typedef struct _EPluginLibClass EPluginLibClass; - -/* The callback signature used for epluginlib methods */ -typedef gpointer (*EPluginLibFunc)(EPluginLib *ep, gpointer data); -/* The setup method, this will be called when the plugin is - * initialised. In the future it may also be called when the plugin - * is disabled. */ -typedef gint (*EPluginLibEnableFunc)(EPluginLib *ep, gint enable); -typedef gpointer (*EPluginLibGetConfigureWidgetFunc)(EPluginLib *ep); - -/** - * struct _EPluginLib - - * - * @plugin: Superclass. - * @location: The filename of the shared object. - * @module: The GModule once it is loaded. - * - * This is a concrete EPlugin class. It loads and invokes dynamically - * loaded libraries using GModule. The shared object isn't loaded - * until the first callback is invoked. - * - * When the plugin is loaded, and if it exists, "e_plugin_lib_enable" - * will be invoked to initialise the - **/ -struct _EPluginLib { - EPlugin plugin; - - gchar *location; - GModule *module; -}; - -/** - * struct _EPluginLibClass - - * - * @plugin_class: Superclass. - * - * The plugin library needs no additional class data. - **/ -struct _EPluginLibClass { - EPluginClass plugin_class; -}; - -GType e_plugin_lib_get_type(void); - /* ********************************************************************** */ /* Standard GObject macros */ @@ -323,8 +250,6 @@ struct _EPluginHookClass { GType e_plugin_hook_get_type(void); -void e_plugin_hook_register_type(GType type); - EPluginHook * e_plugin_hook_new(EPlugin *ep, xmlNodePtr root); void e_plugin_hook_enable(EPluginHook *eph, gint state); @@ -332,49 +257,6 @@ void e_plugin_hook_enable(EPluginHook *eph, gint state); guint32 e_plugin_hook_mask(xmlNodePtr root, const struct _EPluginHookTargetKey *map, const gchar *prop); guint32 e_plugin_hook_id(xmlNodePtr root, const struct _EPluginHookTargetKey *map, const gchar *prop); -/* ********************************************************************** */ - -/* EPluginTypeHook lets a plugin register a new plugin type. - -