diff options
Diffstat (limited to 'plugins/pychrysalide/gtkext/displaypanel.c')
-rw-r--r-- | plugins/pychrysalide/gtkext/displaypanel.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/plugins/pychrysalide/gtkext/displaypanel.c b/plugins/pychrysalide/gtkext/displaypanel.c index 16bd1d9..079ac73 100644 --- a/plugins/pychrysalide/gtkext/displaypanel.c +++ b/plugins/pychrysalide/gtkext/displaypanel.c @@ -32,6 +32,7 @@ #include <gtkext/gtkdisplaypanel.h> +#include "../access.h" #include "../helpers.h" #include "../arch/vmpa.h" @@ -152,32 +153,41 @@ PyTypeObject *get_python_display_panel_type(void) * * ******************************************************************************/ -bool register_python_display_panel(PyObject *module) +bool ensure_python_display_panel_is_registered(void) { bool result; /* Bilan à retourner */ - PyTypeObject *py_display_panel_type; /* Type Python 'DisplayPanel' */ + PyTypeObject *type; /* Type Python 'DisplayPanel' */ PyObject *parent_mod; /* Module Python Fixed */ PyObject *fixed; /* Module "GtkFixed" */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ result = false; - py_display_panel_type = get_python_display_panel_type(); + type = get_python_display_panel_type(); - parent_mod = PyImport_ImportModule("gi.repository.Gtk"); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.gtkext"); - if (parent_mod == NULL) - goto rpdp_exit; + parent_mod = PyImport_ImportModule("gi.repository.Gtk"); - fixed = PyObject_GetAttrString(parent_mod, "Fixed"); + if (parent_mod == NULL) + goto rpdp_exit; - Py_DECREF(parent_mod); + fixed = PyObject_GetAttrString(parent_mod, "Fixed"); - dict = PyModule_GetDict(module); + Py_DECREF(parent_mod); - result = register_class_for_pygobject(dict, GTK_TYPE_DISPLAY_PANEL, - py_display_panel_type, (PyTypeObject *)fixed); - Py_DECREF(fixed); + dict = PyModule_GetDict(module); + + result = register_class_for_pygobject(dict, GTK_TYPE_DISPLAY_PANEL, type, (PyTypeObject *)fixed); + Py_DECREF(fixed); + + } + + else + result = true; rpdp_exit: |