summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/constants.c3
-rw-r--r--plugins/pychrysalide/plugin.c139
2 files changed, 142 insertions, 0 deletions
diff --git a/plugins/pychrysalide/constants.c b/plugins/pychrysalide/constants.c
index e31a8fe..ded25c3 100644
--- a/plugins/pychrysalide/constants.c
+++ b/plugins/pychrysalide/constants.c
@@ -57,7 +57,10 @@ bool define_plugin_module_constants(PyTypeObject *type)
if (result) result = add_const_to_group(values, "PLUGIN_INIT", PGA_PLUGIN_INIT);
if (result) result = add_const_to_group(values, "PLUGIN_EXIT", PGA_PLUGIN_EXIT);
if (result) result = add_const_to_group(values, "NATIVE_LOADED", PGA_NATIVE_LOADED);
+ if (result) result = add_const_to_group(values, "TYPE_BUILDING", PGA_TYPE_BUILDING);
if (result) result = add_const_to_group(values, "GUI_THEME", PGA_GUI_THEME);
+ if (result) result = add_const_to_group(values, "PANEL_CREATION", PGA_PANEL_CREATION);
+ if (result) result = add_const_to_group(values, "PANEL_DOCKING", PGA_PANEL_DOCKING);
if (result) result = add_const_to_group(values, "CONTENT_EXPLORER", PGA_CONTENT_EXPLORER);
if (result) result = add_const_to_group(values, "CONTENT_RESOLVER", PGA_CONTENT_RESOLVER);
if (result) result = add_const_to_group(values, "CONTENT_ANALYZED", PGA_CONTENT_ANALYZED);
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c
index a552aaa..b3bcce5 100644
--- a/plugins/pychrysalide/plugin.c
+++ b/plugins/pychrysalide/plugin.c
@@ -63,6 +63,12 @@ static void py_plugin_module_notify_native_loaded_wrapper(GPluginModule *, Plugi
/* Complète une liste de resources pour thème. */
static void py_plugin_module_include_theme_wrapper(const GPluginModule *, PluginAction, gboolean, char ***, size_t *);
+/* Rend compte de la création d'un panneau. */
+static void py_plugin_module_notify_panel_creation_wrapper(const GPluginModule *, PluginAction, GPanelItem *);
+
+/* Rend compte d'un affichage ou d'un retrait de panneau. */
+static void py_plugin_module_notify_panel_docking_wrapper(const GPluginModule *, PluginAction, GPanelItem *, bool);
+
/* Procède à une opération liée à un contenu binaire. */
static void py_plugin_module_handle_binary_content_wrapper(const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
@@ -228,6 +234,8 @@ static void py_plugin_module_init_gclass(GPluginModuleClass *class, gpointer unu
class->native_loaded = py_plugin_module_notify_native_loaded_wrapper;
class->include_theme = py_plugin_module_include_theme_wrapper;
+ class->notify_panel = py_plugin_module_notify_panel_creation_wrapper;
+ class->notify_docking = py_plugin_module_notify_panel_docking_wrapper;
class->handle_content = py_plugin_module_handle_binary_content_wrapper;
class->handle_loaded = py_plugin_module_handle_loaded_content_wrapper;
@@ -287,6 +295,8 @@ static int py_plugin_module_init(PyObject *self, PyObject *args, PyObject *kwds)
" have to be defined for new classes:\n" \
"* pychrysalide.PluginModule._notify_native_loaded();\n" \
"* pychrysalide.PluginModule._include_theme();\n" \
+ "* pychrysalide.PluginModule._on_panel_creation;\n" \
+ "* pychrysalide.PluginModule._on_panel_docking();\n" \
"* pychrysalide.PluginModule._handle_binary_content();\n" \
"* pychrysalide.PluginModule._handle_loaded_content();\n" \
"* pychrysalide.PluginModule._handle_format_analysis();\n" \
@@ -530,6 +540,133 @@ static void py_plugin_module_include_theme_wrapper(const GPluginModule *plugin,
/******************************************************************************
* *
+* 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 : - *
+* *
+******************************************************************************/
+
+static void py_plugin_module_notify_panel_creation_wrapper(const GPluginModule *plugin, PluginAction action, GPanelItem *item)
+{
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Bilan d'exécution */
+
+#define PLUGIN_MODULE_ON_PANEL_CREATION_WRAPPER PYTHON_WRAPPER_DEF \
+( \
+ _on_panel_creation, "$self, action, item, /", \
+ METH_VARARGS, \
+ "Abstract method called when a new instance of panel is created.\n" \
+ "\n" \
+ "The expected *action* is a pychrysalide.PluginModule.PluginAction" \
+ " value and the *item* is a pychrysalide.gui.PanelItem instance.\n" \
+ "\n" \
+ "This method has to be defined in order to handle action such as" \
+ " *PANEL_CREATION*." \
+)
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(plugin));
+
+ if (has_python_method(pyobj, "_on_panel_creation"))
+ {
+ args = PyTuple_New(2);
+
+ PyTuple_SetItem(args, 0, PyLong_FromUnsignedLong(action));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(item)));
+
+ pyret = run_python_method(pyobj, "_on_panel_creation", args);
+
+ Py_XDECREF(pyret);
+ Py_DECREF(args);
+
+ }
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+}
+
+
+/******************************************************************************
+* *
+* 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 : - *
+* *
+******************************************************************************/
+
+static void py_plugin_module_notify_panel_docking_wrapper(const GPluginModule *plugin, PluginAction action, GPanelItem *item, bool dock)
+{
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *pydock; /* Valeur booléenne à joindre */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Bilan d'exécution */
+
+#define PLUGIN_MODULE_ON_PANEL_DOCKING_WRAPPER PYTHON_WRAPPER_DEF \
+( \
+ _on_panel_docking, "$self, action, item, dock, /", \
+ METH_VARARGS, \
+ "Abstract method called when a panel is docked or undocked into" \
+ " the Chrysalide main graphical interface.\n" \
+ "\n" \
+ "The expected *action* is a pychrysalide.PluginModule.PluginAction" \
+ " value, the *item* is a pychrysalide.gui.PanelItem instance and" \
+ " the *dock* parameter indicates if the panel request a docking" \
+ " operation or an undocking one.\n" \
+ "\n" \
+ "This method has to be defined in order to handle action such as" \
+ " *PANEL_DOCKING*." \
+)
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(plugin));
+
+ if (has_python_method(pyobj, "_on_panel_docking"))
+ {
+ args = PyTuple_New(3);
+
+ pydock = (dock ? Py_True : Py_False);
+ Py_INCREF(pydock);
+
+ PyTuple_SetItem(args, 0, PyLong_FromUnsignedLong(action));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(item)));
+ PyTuple_SetItem(args, 2, pydock);
+
+ pyret = run_python_method(pyobj, "_on_panel_docking", args);
+
+ Py_XDECREF(pyret);
+ Py_DECREF(args);
+
+ }
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* content = contenu binaire à traiter. *
@@ -1494,6 +1631,8 @@ PyTypeObject *get_python_plugin_module_type(void)
static PyMethodDef py_plugin_module_methods[] = {
PLUGIN_MODULE_NOTIFY_NATIVE_LOADED_WRAPPER,
PLUGIN_MODULE_INCLUDE_THEME_WRAPPER,
+ PLUGIN_MODULE_ON_PANEL_CREATION_WRAPPER,
+ PLUGIN_MODULE_ON_PANEL_DOCKING_WRAPPER,
PLUGIN_MODULE_HANDLE_BINARY_CONTENT_WRAPPER,
PLUGIN_MODULE_HANDLE_LOADED_CONTENT_WRAPPER,
PLUGIN_MODULE_HANDLE_BINARY_FORMAT_ANALYSIS_WRAPPER,