summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-10-17 21:01:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-10-17 21:01:17 (GMT)
commitacbd3ac3899bd1230097df2f1afea6c3690a5cb8 (patch)
treec3434aed3aaa2ea6c9f2d94240fa9736e4ca7159 /src/plugins
parent30411ff58e8c495953d09b5b796ce129056c20fb (diff)
Extended themes from plugins CSS definitions.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/pglist.h4
-rw-r--r--src/plugins/plugin-def.h16
-rw-r--r--src/plugins/plugin-int.h5
-rw-r--r--src/plugins/plugin.c55
-rw-r--r--src/plugins/plugin.h3
5 files changed, 79 insertions, 4 deletions
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index 5fc2867..31c9c29 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -85,8 +85,10 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
while (0)
+/* DPS_SETUP */
-
+#define include_plugin_theme(r, c) \
+ process_all_plugins_for(PGA_GUI_THEME, g_plugin_module_include_theme, r, c)
/* DPS_CONTENT */
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index f404b14..fd05b00 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -69,15 +69,18 @@ typedef uint32_t plugin_action_t;
#define DPC_BASIC DEFINE_PLUGIN_CATEGORY(0)
-#define DPC_BINARY_PROCESSING DEFINE_PLUGIN_CATEGORY(1)
-
-// GUI
+#define DPC_GUI DEFINE_PLUGIN_CATEGORY(1)
+#define DPC_BINARY_PROCESSING DEFINE_PLUGIN_CATEGORY(2)
/* DPC_BASIC */
#define DPS_NONE DEFINE_PLUGIN_SUB_CATEGORY(0)
#define DPS_PG_MANAGEMENT DEFINE_PLUGIN_SUB_CATEGORY(1)
+/* DPC_GUI */
+
+#define DPS_SETUP DEFINE_PLUGIN_SUB_CATEGORY(0)
+
/* DPC_BINARY_PROCESSING */
#define DPS_CONTENT DEFINE_PLUGIN_SUB_CATEGORY(0)
@@ -114,6 +117,13 @@ typedef enum _PluginAction
PGA_PLUGIN_EXIT = DPC_BASIC | DPS_PG_MANAGEMENT | DEFINE_PLUGIN_ACTION(1),
/**
+ * DPC_GUI | DPS_SETUP
+ */
+
+ /* Inclusion de thèmes */
+ PGA_GUI_THEME = DPC_GUI | DPS_SETUP | DEFINE_PLUGIN_ACTION(0),
+
+ /**
* DPC_BINARY_PROCESSING | DPS_CONTENT
*/
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 19993e9..cee6242 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -47,6 +47,9 @@ typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBin
/* Procède à une opération liée à un contenu chargé. */
typedef void (* pg_handle_loaded_fc) (const GPluginModule *, PluginAction, GLoadedContent *, wgroup_id_t, GtkStatusStack *);
+/* Complète une liste de resources pour thème. */
+typedef void (* pg_include_theme_fc) (const GPluginModule *, PluginAction, char ***, size_t *);
+
/* Assure l'interprétation d'un format en différé. */
typedef bool (* pg_handle_format_analysis_fc) (const GPluginModule *, PluginAction, GBinFormat *, wgroup_id_t, GtkStatusStack *);
@@ -80,6 +83,8 @@ struct _GPluginModule
pg_management_fc init; /* Procédure d'initialisation */
pg_management_fc exit; /* Procédure d'extinction */
+ pg_include_theme_fc include_theme; /* Extension d'un thème */
+
pg_handle_content_fc handle_content; /* Explorations ou résolutions */
pg_handle_loaded_fc handle_loaded; /* Traitement de contenu chargé*/
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index b63b263..161d6a6 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -297,6 +297,39 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
break;
+ case DPC_GUI:
+
+ switch (sub)
+ {
+ case DPS_SETUP:
+
+ switch (action)
+ {
+ case PGA_GUI_THEME:
+ if (!load_plugin_symbol(result->module,
+ "chrysalide_plugin_include_theme", &result->include_theme))
+ 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);
+ break;
+
+ }
+
+ break;
+
case DPC_BINARY_PROCESSING:
switch (sub)
@@ -742,6 +775,28 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag
/******************************************************************************
* *
+* Paramètres : plugin = greffon à manipuler. *
+* action = type d'action attendue. *
+* resources = liste de ressources à constituer. [OUT] *
+* count = taille de cette liste. [OUT] *
+* *
+* Description : Complète une liste de resources pour thème. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_plugin_module_include_theme(const GPluginModule *plugin, PluginAction action, char ***resources, size_t *count)
+{
+ plugin->include_theme(plugin, action, resources, count);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* content = contenu binaire à traiter. *
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 718531a..1127604 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);
+/* Complète une liste de resources pour thème. */
+void g_plugin_module_include_theme(const GPluginModule *, PluginAction, char ***, size_t *);
+
/* Procède à une opération liée à un contenu binaire. */
void g_plugin_module_handle_binary_content(const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);