diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
commit | fb315963527f6412273829f09513325e446eb6c9 (patch) | |
tree | 361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/gtkext/module.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/gtkext/module.c')
-rw-r--r-- | plugins/pychrysalide/gtkext/module.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/plugins/pychrysalide/gtkext/module.c b/plugins/pychrysalide/gtkext/module.c index 8b2cc5e..2108b04 100644 --- a/plugins/pychrysalide/gtkext/module.c +++ b/plugins/pychrysalide/gtkext/module.c @@ -32,26 +32,26 @@ #include "bufferdisplay.h" #include "displaypanel.h" #include "dockable.h" +#include "../helpers.h" /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : super = module dont la définition est à compléter. * * * -* Description : Ajoute le module 'gtkext' au module Python. * +* Description : Ajoute le module 'gtkext' à un module Python. * * * -* Retour : - * +* Retour : Bilan de l'opération. * * * * Remarques : - * * * ******************************************************************************/ -bool add_gtkext_module_to_python_module(PyObject *super) +bool add_gtkext_module(PyObject *super) { bool result; /* Bilan à retourner */ PyObject *module; /* Sous-module mis en place */ - int ret; /* Bilan d'un appel */ static PyModuleDef py_chrysalide_gtkext_module = { @@ -64,29 +64,37 @@ bool add_gtkext_module_to_python_module(PyObject *super) }; - result = false; + module = build_python_module(super, &py_chrysalide_gtkext_module); - module = PyModule_Create(&py_chrysalide_gtkext_module); - if (module == NULL) return false; + result = (module != NULL); - ret = PyState_AddModule(super, &py_chrysalide_gtkext_module); - if (ret != 0) goto agmtpm_exit; + return result; - ret = _PyImport_FixupBuiltin(module, "pychrysalide.gtkext"); - if (ret != 0) goto agmtpm_exit; +} - Py_INCREF(module); - ret = PyModule_AddObject(super, "gtkext", module); - if (ret != 0) goto agmtpm_exit; - result = true; +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Intègre les objets du module 'gtkext'. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ - result &= register_python_display_panel(module); - result &= register_python_buffer_display(module); - result &= register_python_block_display(module); - result &= register_python_gtk_dockable(module); +bool populate_gtkext_module(void) +{ + bool result; /* Bilan à retourner */ + + result = true; - agmtpm_exit: + if (result) result = ensure_python_block_display_is_registered(); + if (result) result = ensure_python_buffer_display_is_registered(); + if (result) result = ensure_python_display_panel_is_registered(); + if (result) result = ensure_python_gtk_dockable_is_registered(); assert(result); |