diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 20:44:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 20:44:31 (GMT) |
commit | 4b1367d2fee7be0789744e1db35d6f9200b29163 (patch) | |
tree | 3b22581bf6a6d2da6d73a7fef30540282808ecb7 /src | |
parent | f6490769c12dbb3b7766c7e6861284b8fee9f9e6 (diff) |
Updated the API in order to allow Python plugins to rely on native plugins.
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/pglist.c | 2 | ||||
-rw-r--r-- | src/plugins/pglist.h | 8 | ||||
-rw-r--r-- | src/plugins/plugin-def.h | 12 | ||||
-rw-r--r-- | src/plugins/plugin-int.h | 5 | ||||
-rw-r--r-- | src/plugins/plugin.c | 42 | ||||
-rw-r--r-- | src/plugins/plugin.h | 3 |
6 files changed, 67 insertions, 5 deletions
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c index 57f7538..b7c8d1d 100644 --- a/src/plugins/pglist.c +++ b/src/plugins/pglist.c @@ -459,6 +459,8 @@ void load_remaning_plugins(void) g_rw_lock_reader_unlock(&_pg_lock); + notify_native_loaded; + } diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h index 0c8f6af..1306571 100644 --- a/src/plugins/pglist.h +++ b/src/plugins/pglist.h @@ -85,6 +85,11 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *); while (0) +/* DPS_PG_MANAGEMENT */ + +#define notify_native_loaded \ + process_all_plugins_for(PGA_NATIVE_LOADED, g_plugin_module_notify_native_loaded, NULL) + /* DPS_SETUP */ #define include_plugin_theme(r, c) \ @@ -103,9 +108,6 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *); #define handle_binary_format_analysis(a, f, g, s) \ process_all_plugins_for(a, g_plugin_module_handle_binary_format_analysis, f, g, s) -#define handle_binary_format(a, f, s) \ - process_all_plugins_for(a, g_plugin_module_handle_binary_format, f, s) - #define preload_binary_format(a, f, i, s) \ process_all_plugins_for(a, g_plugin_module_preload_binary_format, f, i, s) diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h index 96b04b1..4c59606 100644 --- a/src/plugins/plugin-def.h +++ b/src/plugins/plugin-def.h @@ -76,6 +76,7 @@ typedef uint32_t plugin_action_t; #define DPS_NONE DEFINE_PLUGIN_SUB_CATEGORY(0) #define DPS_PG_MANAGEMENT DEFINE_PLUGIN_SUB_CATEGORY(1) +#define DPS_CORE_MANAGEMENT DEFINE_PLUGIN_SUB_CATEGORY(2) /* DPC_GUI */ @@ -111,10 +112,17 @@ typedef enum _PluginAction */ /* Chargement */ - PGA_PLUGIN_INIT = DPC_BASIC | DPS_PG_MANAGEMENT | DEFINE_PLUGIN_ACTION(0), + PGA_PLUGIN_INIT = DPC_BASIC | DPS_PG_MANAGEMENT | DEFINE_PLUGIN_ACTION(0), /* Déchargement */ - PGA_PLUGIN_EXIT = DPC_BASIC | DPS_PG_MANAGEMENT | DEFINE_PLUGIN_ACTION(1), + PGA_PLUGIN_EXIT = DPC_BASIC | DPS_PG_MANAGEMENT | DEFINE_PLUGIN_ACTION(1), + + /** + * DPC_BASIC | DPS_CORE_MANAGEMENT + */ + + /* Fin du chargement des greffons natifs */ + PGA_NATIVE_LOADED = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(0), /** * DPC_GUI | DPS_SETUP diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h index 8df3527..2d98217 100644 --- a/src/plugins/plugin-int.h +++ b/src/plugins/plugin-int.h @@ -41,6 +41,9 @@ /* Prend acte du [dé]chargement du greffon. */ typedef bool (* pg_management_fc) (GPluginModule *); +/* Accompagne la fin du chargement des modules natifs. */ +typedef void (* pg_native_loaded_fc) (GPluginModule *, PluginAction); + /* Procède à une opération liée à un contenu binaire. */ typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *); @@ -83,6 +86,8 @@ struct _GPluginModule pg_management_fc init; /* Procédure d'initialisation */ pg_management_fc exit; /* Procédure d'extinction */ + pg_native_loaded_fc native_loaded; /* Fin des chargements natifs */ + pg_include_theme_fc include_theme; /* Extension d'un thème */ pg_handle_content_fc handle_content; /* Explorations ou résolutions */ diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 1608032..a9bd9da 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -288,6 +288,27 @@ GPluginModule *g_plugin_module_new(const gchar *filename) break; + case DPS_CORE_MANAGEMENT: + + switch (action) + { + case PGA_NATIVE_LOADED: + if (!load_plugin_symbol(result->module, + "chrysalide_plugin_on_native_loaded", + &result->native_loaded)) + goto bad_plugin; + break; + + default: + log_variadic_message(LMT_WARNING, + _("Unknown action '0x%02x' in plugin '%s'..."), + result->interface->actions[i], filename); + break; + + } + + break; + default: log_variadic_message(LMT_WARNING, _("Unknown sub-category '0x%02x' in plugin '%s'..."), sub, filename); @@ -775,6 +796,27 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag /****************************************************************************** * * +* Paramètres : plugin = greffon à manipuler. * +* action = type d'action attendue. * +* unused = variable non utilisé pour l'usage de __VA_ARGS__. * +* * +* Description : Accompagne la fin du chargement des modules natifs. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_plugin_module_notify_native_loaded(GPluginModule *plugin, PluginAction action, void *unused) +{ + plugin->native_loaded(plugin, action); + +} + + +/****************************************************************************** +* * * Paramètres : plugin = greffon à manipuler. * * action = type d'action attendue. * * resources = liste de ressources à constituer. [OUT] * diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 86dba25..4b3b306 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -91,6 +91,9 @@ bool g_plugin_module_resolve_dependencies(GPluginModule *, GPluginModule **, siz /* Termine le chargement du greffon préparé. */ bool g_plugin_module_load(GPluginModule *, GPluginModule **, size_t); +/* Accompagne la fin du chargement des modules natifs. */ +void g_plugin_module_notify_native_loaded(GPluginModule *, PluginAction, void *); + /* Complète une liste de resources pour thème. */ void g_plugin_module_include_theme(const GPluginModule *, PluginAction, char ***, size_t *); |