summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/gui
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/gui')
-rw-r--r--plugins/pychrysalide/gui/editem.c3
-rw-r--r--plugins/pychrysalide/gui/panels/panel.c39
2 files changed, 15 insertions, 27 deletions
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/editem.c
index 986d1cb..68962ae 100644
--- a/plugins/pychrysalide/gui/editem.c
+++ b/plugins/pychrysalide/gui/editem.c
@@ -45,9 +45,6 @@
/* Réagit à un changement de contenu chargé en cours d'analyse. */
static void py_editor_item_change_content_wrapper(GEditorItem *, GLoadedContent *, GLoadedContent *);
-/* Réagit à un changement de contenu chargé en cours d'analyse. */
-static void py_editor_item_change_content_wrapper(GEditorItem *, GLoadedContent *, GLoadedContent *);
-
/* Réagit à un changement de vue du contenu en cours d'analyse. */
static void py_editor_item_change_view_wrapper(GEditorItem *, GLoadedPanel *, GLoadedPanel *);
diff --git a/plugins/pychrysalide/gui/panels/panel.c b/plugins/pychrysalide/gui/panels/panel.c
index 1df0670..d4062d3 100644
--- a/plugins/pychrysalide/gui/panels/panel.c
+++ b/plugins/pychrysalide/gui/panels/panel.c
@@ -32,11 +32,11 @@
#include <core/params.h>
#include <gui/core/panels.h>
#include <gui/panels/panel-int.h>
+#include <plugins/dt.h>
#include "../editem.h"
#include "../../access.h"
-#include "../../dt.h"
#include "../../helpers.h"
#include "../../gtkext/dockable.h"
@@ -89,18 +89,16 @@ static bool py_panel_item_define_constants(PyTypeObject *);
static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *result; /* Objet à retourner */
- bool abstract; /* Validation du type parent */
+ PyTypeObject *base; /* Type de base à dériver */
+ bool first_time; /* Evite les multiples passages*/
GType gtype; /* Nouveau type de processeur */
- PyObject *sys_mod_dict; /* Dictionnaire des modules */
- PyObject *modname; /* Nom du module du type */
- PyObject *module; /* Module à recompléter */
- PyObject *dict; /* Dictionnaire dudit module */
+ bool status; /* Bilan d'un enregistrement */
/* Validations diverses */
- abstract = (type == get_python_panel_item_type());
+ base = get_python_panel_item_type();
- if (abstract)
+ if (type == base)
{
result = NULL;
PyErr_Format(PyExc_RuntimeError, _("%s is an abstract class"), type->tp_name);
@@ -109,30 +107,23 @@ static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject
/* Mise en place d'un type dédié */
- gtype = built_dynamic_type(G_TYPE_PANEL_ITEM, type->tp_name,
- (GClassInitFunc)py_panel_item_init_gclass);
-
- /* Enregistrement du nouveau GType dans Python */
-
- sys_mod_dict = PyImport_GetModuleDict();
+ first_time = (g_type_from_name(type->tp_name) == 0);
- modname = PyDict_GetItemString(type->tp_dict, "__module__");
-
- module = PyObject_GetItem(sys_mod_dict, modname);
+ gtype = built_dynamic_type(G_TYPE_PANEL_ITEM, type->tp_name,
+ (GClassInitFunc)py_panel_item_init_gclass, NULL);
- dict = PyModule_GetDict(module);
+ if (first_time)
+ status = register_class_for_dynamic_pygobject(gtype, type, base);
+ else
+ status = true;
- if (!_register_class_for_pygobject(dict, gtype, type,
- &PyGObject_Type, get_python_panel_item_type(), NULL))
+ if (!status)
{
result = NULL;
goto exit;
}
- Py_DECREF(module);
- Py_DECREF(modname);
-
- /* On créé, et on laisse ensuite la main à PyGObject_Type.tp_init() */
+ /* On crée, et on laisse ensuite la main à PyGObject_Type.tp_init() */
result = PyType_GenericNew(type, args, kwds);