diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/panel.c | 7 | ||||
-rw-r--r-- | src/plugins/pglist.h | 8 | ||||
-rw-r--r-- | src/plugins/plugin-def.h | 11 | ||||
-rw-r--r-- | src/plugins/plugin-int.h | 8 | ||||
-rw-r--r-- | src/plugins/plugin.c | 95 | ||||
-rw-r--r-- | src/plugins/plugin.h | 7 |
6 files changed, 136 insertions, 0 deletions
diff --git a/src/gui/panel.c b/src/gui/panel.c index a509f40..976a2d7 100644 --- a/src/gui/panel.c +++ b/src/gui/panel.c @@ -38,6 +38,7 @@ #include "../gtkext/gtkdockable-int.h" #include "../gtkext/named.h" #include "../plugins/dt.h" +#include "../plugins/pglist.h" @@ -601,6 +602,8 @@ GPanelItem *g_panel_item_new(GType type, const char *path) register_editor_item(G_EDITOR_ITEM(result)); + notify_panel_creation(result); + singleton: if (path != NULL) @@ -818,6 +821,8 @@ void g_panel_item_dock(GPanelItem *item) if (G_PANEL_ITEM_GET_CLASS(item)->ack_dock != NULL) G_PANEL_ITEM_GET_CLASS(item)->ack_dock(item); + notify_panel_docking(item, true); + } @@ -895,6 +900,8 @@ void g_panel_item_undock(GPanelItem *item) if (G_PANEL_ITEM_GET_CLASS(item)->ack_undock != NULL) G_PANEL_ITEM_GET_CLASS(item)->ack_undock(item); + notify_panel_docking(item, false); + personality = gtk_panel_item_class_get_personality(G_PANEL_ITEM_GET_CLASS(item)); if (personality != PIP_PERSISTENT_SINGLETON) diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h index fd8e30a..ccf854f 100644 --- a/src/plugins/pglist.h +++ b/src/plugins/pglist.h @@ -118,6 +118,14 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *); #define include_plugin_theme(d, r, c) \ process_all_plugins_for(PGA_GUI_THEME, g_plugin_module_include_theme, d, r, c) +/* DPS_RUNNING */ + +#define notify_panel_creation(i) \ + process_all_plugins_for(PGA_PANEL_CREATION, g_plugin_module_notify_panel_creation, i) + +#define notify_panel_docking(i, d) \ + process_all_plugins_for(PGA_PANEL_DOCKING, g_plugin_module_notify_panel_docking, i, d) + /* DPS_CONTENT */ #define handle_binary_content(a, c, i, s) \ diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h index 5a2dc54..e99d7b1 100644 --- a/src/plugins/plugin-def.h +++ b/src/plugins/plugin-def.h @@ -79,6 +79,7 @@ typedef uint32_t plugin_action_t; /* DPC_GUI */ #define DPS_SETUP DEFINE_PLUGIN_SUB_CATEGORY(0) +#define DPS_RUNNING DEFINE_PLUGIN_SUB_CATEGORY(1) /* DPC_BINARY_PROCESSING */ @@ -133,6 +134,16 @@ typedef enum _PluginAction PGA_GUI_THEME = DPC_GUI | DPS_SETUP | DEFINE_PLUGIN_ACTION(0), /** + * DPC_GUI | DPS_RUNNING + */ + + /* Accrochage / décrochage de panneaux */ + PGA_PANEL_CREATION = DPC_GUI | DPS_RUNNING | DEFINE_PLUGIN_ACTION(0), + + /* Accrochage / décrochage de panneaux */ + PGA_PANEL_DOCKING = DPC_GUI | DPS_RUNNING | DEFINE_PLUGIN_ACTION(1), + + /** * DPC_BINARY_PROCESSING | DPS_CONTENT */ diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h index 129e155..9dd9173 100644 --- a/src/plugins/plugin-int.h +++ b/src/plugins/plugin-int.h @@ -60,6 +60,12 @@ typedef void (* pg_handle_loaded_fc) (const GPluginModule *, PluginAction, GLoad /* Complète une liste de resources pour thème. */ typedef void (* pg_include_theme_fc) (const GPluginModule *, PluginAction, gboolean, char ***, size_t *); +/* Rend compte de la création d'un panneau. */ +typedef void (* pg_notify_panel_fc) (const GPluginModule *, PluginAction, GPanelItem *); + +/* Rend compte d'un affichage ou d'un retrait de panneau. */ +typedef void (* pg_notify_docking_fc) (const GPluginModule *, PluginAction, GPanelItem *, bool); + /* Assure l'interprétation d'un format en différé. */ typedef bool (* pg_handle_format_analysis_fc) (const GPluginModule *, PluginAction, GKnownFormat *, wgroup_id_t, GtkStatusStack *); @@ -107,6 +113,8 @@ struct _GPluginModuleClass pg_get_modname_fc get_modname; /* Fourniture du nom brut */ pg_include_theme_fc include_theme; /* Extension d'un thème */ + pg_notify_panel_fc notify_panel; /* Création de panneau */ + pg_notify_docking_fc notify_docking; /* Affichage ou retrait */ 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 df593ea..8b3654e 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -373,6 +373,28 @@ GPluginModule *g_plugin_module_new(const gchar *filename) break; + case DPS_RUNNING: + + switch (action) + { + case PGA_PANEL_CREATION: + valid = check_plugin_symbol(module, "chrysalide_plugin_on_panel_creation"); + break; + + case PGA_PANEL_DOCKING: + valid = check_plugin_symbol(module, "chrysalide_plugin_on_panel_docking"); + break; + + default: + log_variadic_message(LMT_WARNING, + _("Unknown action '0x%02x' in plugin '%s'..."), + interface->actions[i], filename); + break; + + } + + break; + default: log_variadic_message(LMT_WARNING, _("Unknown sub-category '0x%02x' in plugin '%s'..."), sub, filename); @@ -640,6 +662,28 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu break; + case DPS_RUNNING: + + switch (action) + { + case PGA_PANEL_CREATION: + load_plugin_symbol(module, "chrysalide_plugin_on_panel_creation", + &class->notify_panel); + break; + + case PGA_PANEL_DOCKING: + load_plugin_symbol(module, "chrysalide_plugin_on_panel_docking", + &class->notify_docking); + break; + + default: + assert(false); + break; + + } + + break; + default: assert(false); break; @@ -1270,6 +1314,57 @@ void g_plugin_module_include_theme(const GPluginModule *plugin, PluginAction act /****************************************************************************** * * +* Paramètres : plugin = greffon à manipuler. * +* action = type d'action attendue. * +* item = nouveau panneau créé. * +* * +* Description : Rend compte de la création d'un panneau. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_plugin_module_notify_panel_creation(const GPluginModule *plugin, PluginAction action, GPanelItem *item) +{ + GPluginModuleClass *class; /* Classe de l'instance active */ + + class = G_PLUGIN_MODULE_GET_CLASS(plugin); + + class->notify_panel(plugin, action, item); + +} + + +/****************************************************************************** +* * +* Paramètres : plugin = greffon à manipuler. * +* action = type d'action attendue. * +* item = panneau marqué par un changement d'affichage. * +* dock = indique une accroche et non un décrochage. * +* * +* Description : Rend compte d'un affichage ou d'un retrait de panneau. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_plugin_module_notify_panel_docking(const GPluginModule *plugin, PluginAction action, GPanelItem *item, bool dock) +{ + GPluginModuleClass *class; /* Classe de l'instance active */ + + class = G_PLUGIN_MODULE_GET_CLASS(plugin); + + class->notify_docking(plugin, action, item, dock); + +} + + +/****************************************************************************** +* * * 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 f65d0eb..3e8d9c1 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -36,6 +36,7 @@ #include "../format/known.h" #include "../format/preload.h" #include "../gtkext/gtkstatusstack.h" +#include "../gui/panel.h" @@ -114,6 +115,12 @@ gpointer g_plugin_module_build_type_instance(GPluginModule *, PluginAction, GTyp /* Complète une liste de resources pour thème. */ void g_plugin_module_include_theme(const GPluginModule *, PluginAction, gboolean, char ***, size_t *); +/* Rend compte de la création d'un panneau. */ +void g_plugin_module_notify_panel_creation(const GPluginModule *, PluginAction, GPanelItem *); + +/* Rend compte d'un affichage ou d'un retrait de panneau. */ +void g_plugin_module_notify_panel_docking(const GPluginModule *, PluginAction, GPanelItem *, bool); + /* 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 *); |