summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-12-06 19:01:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-12-06 19:01:21 (GMT)
commitaa7cbdda718efd7ec41f0ce580847a0d0c31cfd3 (patch)
tree1216e62254397446f039a6fe26bd12ba65f68321 /src/plugins
parent333e68541e376a7b86703fad8e917f71c0f243d0 (diff)
Extended the plugin API to notify several stages of loading.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/pglist.c4
-rw-r--r--src/plugins/pglist.h7
-rw-r--r--src/plugins/plugin-def.h7
-rw-r--r--src/plugins/plugin-int.h4
-rw-r--r--src/plugins/plugin.c18
-rw-r--r--src/plugins/plugin.h2
6 files changed, 26 insertions, 16 deletions
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index cb366fe..ffcda63 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -470,7 +470,9 @@ void load_remaning_plugins(void)
g_rw_lock_reader_unlock(&_pg_lock);
- notify_native_loaded;
+ notify_native_plugins_loaded();
+
+ notify_plugins_loaded();
}
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index ccf854f..d6c539d 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -107,8 +107,11 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
/* DPS_PG_MANAGEMENT */
-#define notify_native_loaded \
- process_all_plugins_for(PGA_NATIVE_LOADED, g_plugin_module_notify_native_loaded, NULL)
+#define notify_native_plugins_loaded() \
+ process_all_plugins_for(PGA_NATIVE_PLUGINS_LOADED, g_plugin_module_notify_plugins_loaded, NULL)
+
+#define notify_plugins_loaded() \
+ process_all_plugins_for(PGA_PLUGINS_LOADED, g_plugin_module_notify_plugins_loaded, NULL)
#define build_type_instance(t) \
process_plugins_while_null(PGA_TYPE_BUILDING, g_plugin_module_build_type_instance, t)
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index e99d7b1..0c25a7a 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -121,10 +121,13 @@ typedef enum _PluginAction
*/
/* Fin du chargement des greffons natifs */
- PGA_NATIVE_LOADED = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(0),
+ PGA_NATIVE_PLUGINS_LOADED = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(0),
+
+ /* Fin du chargement de tous greffons */
+ PGA_PLUGINS_LOADED = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(1),
/* Mise en place de type à partir de code externe */
- PGA_TYPE_BUILDING = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(1),
+ PGA_TYPE_BUILDING = DPC_BASIC | DPS_CORE_MANAGEMENT | DEFINE_PLUGIN_ACTION(2),
/**
* DPC_GUI | DPS_SETUP
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 9dd9173..98a07bb 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -43,7 +43,7 @@ typedef void (* pg_set_self_fc) (GPluginModule *);
typedef bool (* pg_management_fc) (GPluginModule *);
/* Accompagne la fin du chargement des modules natifs. */
-typedef void (* pg_native_loaded_fc) (GPluginModule *, PluginAction);
+typedef void (* pg_plugins_loaded_fc) (GPluginModule *, PluginAction);
/* Crée une instance à partir d'un type dynamique externe. */
typedef gpointer (* pg_build_instance_fc) (GPluginModule *, PluginAction, GType);
@@ -107,7 +107,7 @@ struct _GPluginModuleClass
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_plugins_loaded_fc plugins_loaded; /* Fin des chargements */
pg_build_instance_fc build_instance; /* Création d'objets */
pg_get_modname_fc get_modname; /* Fourniture du nom brut */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 8b3654e..23ef34c 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -324,8 +324,9 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
switch (action)
{
- case PGA_NATIVE_LOADED:
- valid = check_plugin_symbol(module, "chrysalide_plugin_on_native_loaded");
+ case PGA_NATIVE_PLUGINS_LOADED:
+ case PGA_PLUGINS_LOADED:
+ valid = check_plugin_symbol(module, "chrysalide_plugin_on_plugins_loaded");
break;
case PGA_TYPE_BUILDING:
@@ -615,9 +616,10 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu
switch (action)
{
- case PGA_NATIVE_LOADED:
- load_plugin_symbol(module, "chrysalide_plugin_on_native_loaded",
- &class->native_loaded);
+ case PGA_NATIVE_PLUGINS_LOADED:
+ case PGA_PLUGINS_LOADED:
+ load_plugin_symbol(module, "chrysalide_plugin_on_plugins_loaded",
+ &class->plugins_loaded);
break;
case PGA_TYPE_BUILDING:
@@ -1238,7 +1240,7 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag
* action = type d'action attendue. *
* unused = variable non utilisé pour l'usage de __VA_ARGS__. *
* *
-* Description : Accompagne la fin du chargement des modules natifs. *
+* Description : Accompagne la fin du chargement des modules. *
* *
* Retour : - *
* *
@@ -1246,13 +1248,13 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag
* *
******************************************************************************/
-void g_plugin_module_notify_native_loaded(GPluginModule *plugin, PluginAction action, void *unused)
+void g_plugin_module_notify_plugins_loaded(GPluginModule *plugin, PluginAction action, void *unused)
{
GPluginModuleClass *class; /* Classe de l'instance active */
class = G_PLUGIN_MODULE_GET_CLASS(plugin);
- class->native_loaded(plugin, action);
+ class->plugins_loaded(plugin, action);
}
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 3e8d9c1..fc54aee 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -107,7 +107,7 @@ void g_plugin_module_log_simple_message(const GPluginModule *, LogMessageType, c
void g_plugin_module_log_variadic_message(const GPluginModule *, LogMessageType, const char *, ...);
/* Accompagne la fin du chargement des modules natifs. */
-void g_plugin_module_notify_native_loaded(GPluginModule *, PluginAction, void *);
+void g_plugin_module_notify_plugins_loaded(GPluginModule *, PluginAction, void *);
/* Crée une instance à partir d'un type dynamique externe. */
gpointer g_plugin_module_build_type_instance(GPluginModule *, PluginAction, GType);