diff options
Diffstat (limited to 'plugins/pychrysalide/gui')
| -rw-r--r-- | plugins/pychrysalide/gui/Makefile.am | 22 | ||||
| -rw-r--r-- | plugins/pychrysalide/gui/core/Makefile.am | 17 | ||||
| -rw-r--r-- | plugins/pychrysalide/gui/item.c | 62 | ||||
| -rw-r--r-- | plugins/pychrysalide/gui/menubar.c | 5 | ||||
| -rw-r--r-- | plugins/pychrysalide/gui/panel.c | 5 | ||||
| -rw-r--r-- | plugins/pychrysalide/gui/panels/Makefile.am | 13 | 
6 files changed, 46 insertions, 78 deletions
| diff --git a/plugins/pychrysalide/gui/Makefile.am b/plugins/pychrysalide/gui/Makefile.am index 360f7ff..de2e888 100644 --- a/plugins/pychrysalide/gui/Makefile.am +++ b/plugins/pychrysalide/gui/Makefile.am @@ -1,18 +1,19 @@  noinst_LTLIBRARIES = libpychrysagui.la -libpychrysagui_la_SOURCES =				\ -	constants.h constants.c				\ -	item.h item.c						\ -	menubar.h menubar.c					\ -	module.h module.c					\ +libpychrysagui_la_SOURCES =					\ +	constants.h constants.c					\ +	item.h item.c							\ +	menubar.h menubar.c						\ +	module.h module.c						\  	panel.h panel.c -libpychrysagui_la_LIBADD =				\ -	core/libpychrysaguicore.la			\ +libpychrysagui_la_LIBADD =					\ +	core/libpychrysaguicore.la				\  	panels/libpychrysaguipanels.la -libpychrysagui_la_LDFLAGS =  +libpychrysagui_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir) @@ -20,9 +21,4 @@ devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysagui_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) -  SUBDIRS = core panels diff --git a/plugins/pychrysalide/gui/core/Makefile.am b/plugins/pychrysalide/gui/core/Makefile.am index 02f3596..8f49176 100644 --- a/plugins/pychrysalide/gui/core/Makefile.am +++ b/plugins/pychrysalide/gui/core/Makefile.am @@ -1,21 +1,16 @@  noinst_LTLIBRARIES = libpychrysaguicore.la -libpychrysaguicore_la_SOURCES =			\ -	global.h global.c					\ -	items.h items.c						\ -	module.h module.c					\ +libpychrysaguicore_la_SOURCES =				\ +	global.h global.c						\ +	items.h items.c							\ +	module.h module.c						\  	panels.h panels.c -libpychrysaguicore_la_LDFLAGS =  +libpychrysaguicore_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysaguicore_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) diff --git a/plugins/pychrysalide/gui/item.c b/plugins/pychrysalide/gui/item.c index 2046587..0c604b5 100644 --- a/plugins/pychrysalide/gui/item.c +++ b/plugins/pychrysalide/gui/item.c @@ -291,19 +291,16 @@ static GtkWidget *py_editor_item_get_widget_wrapper(const GEditorItem *item)  static void py_editor_item_change_content_wrapper(GEditorItem *item, GLoadedContent *old, GLoadedContent *new)  { +    PyGILState_STATE gstate;                /* Sauvegarde d'environnement  */      PyObject *pyobj;                        /* Objet Python concerné       */ -    PyThreadState *tstate;                  /* Contexte d'environnement    */      PyObject *pyold;                        /* Conversion ou None          */      PyObject *pynew;                        /* Conversion ou None          */      PyObject *args;                         /* Arguments pour l'appel      */      PyObject *pyret;                        /* Retour de Python            */ -    pyobj = pygobject_new(G_OBJECT(item)); - -    tstate = get_pychrysalide_main_tstate(); +    gstate = PyGILState_Ensure(); -    if (tstate != NULL) -        PyEval_RestoreThread(tstate); +    pyobj = pygobject_new(G_OBJECT(item));      if (has_python_method(pyobj, "_change_content"))      { @@ -334,8 +331,7 @@ static void py_editor_item_change_content_wrapper(GEditorItem *item, GLoadedCont      } -    if (tstate != NULL) -        PyEval_SaveThread(); +    PyGILState_Release(gstate);  } @@ -356,19 +352,16 @@ static void py_editor_item_change_content_wrapper(GEditorItem *item, GLoadedCont  static void py_editor_item_change_view_wrapper(GEditorItem *item, GLoadedPanel *old, GLoadedPanel *new)  { +    PyGILState_STATE gstate;                /* Sauvegarde d'environnement  */      PyObject *pyobj;                        /* Objet Python concerné       */ -    PyThreadState *tstate;                  /* Contexte d'environnement    */      PyObject *pyold;                        /* Conversion ou None          */      PyObject *pynew;                        /* Conversion ou None          */      PyObject *args;                         /* Arguments pour l'appel      */      PyObject *pyret;                        /* Retour de Python            */ -    pyobj = pygobject_new(G_OBJECT(item)); - -    tstate = get_pychrysalide_main_tstate(); +    gstate = PyGILState_Ensure(); -    if (tstate != NULL) -        PyEval_RestoreThread(tstate); +    pyobj = pygobject_new(G_OBJECT(item));      if (has_python_method(pyobj, "_change_view"))      { @@ -399,8 +392,7 @@ static void py_editor_item_change_view_wrapper(GEditorItem *item, GLoadedPanel *      } -    if (tstate != NULL) -        PyEval_SaveThread(); +    PyGILState_Release(gstate);  } @@ -420,17 +412,14 @@ static void py_editor_item_change_view_wrapper(GEditorItem *item, GLoadedPanel *  static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel *panel)  { +    PyGILState_STATE gstate;                /* Sauvegarde d'environnement  */      PyObject *pyobj;                        /* Objet Python concerné       */ -    PyThreadState *tstate;                  /* Contexte d'environnement    */      PyObject *args;                         /* Arguments pour l'appel      */      PyObject *pyret;                        /* Retour de Python            */ -    pyobj = pygobject_new(G_OBJECT(item)); - -    tstate = get_pychrysalide_main_tstate(); +    gstate = PyGILState_Ensure(); -    if (tstate != NULL) -        PyEval_RestoreThread(tstate); +    pyobj = pygobject_new(G_OBJECT(item));      if (has_python_method(pyobj, "_update_view"))      { @@ -444,8 +433,7 @@ static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel *      } -    if (tstate != NULL) -        PyEval_SaveThread(); +    PyGILState_Release(gstate);  } @@ -466,17 +454,14 @@ static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel *  static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel *panel, const GLineCursor *cursor)  { +    PyGILState_STATE gstate;                /* Sauvegarde d'environnement  */      PyObject *pyobj;                        /* Objet Python concerné       */ -    PyThreadState *tstate;                  /* Contexte d'environnement    */      PyObject *args;                         /* Arguments pour l'appel      */      PyObject *pyret;                        /* Retour de Python            */ -    pyobj = pygobject_new(G_OBJECT(item)); - -    tstate = get_pychrysalide_main_tstate(); +    gstate = PyGILState_Ensure(); -    if (tstate != NULL) -        PyEval_RestoreThread(tstate); +    pyobj = pygobject_new(G_OBJECT(item));      if (has_python_method(pyobj, "_track_cursor"))      { @@ -491,8 +476,7 @@ static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel      } -    if (tstate != NULL) -        PyEval_SaveThread(); +    PyGILState_Release(gstate);  } @@ -513,17 +497,14 @@ static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel  static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedContent *content, const GLineCursor *cursor)  { +    PyGILState_STATE gstate;                /* Sauvegarde d'environnement  */      PyObject *pyobj;                        /* Objet Python concerné       */ -    PyThreadState *tstate;                  /* Contexte d'environnement    */      PyObject *args;                         /* Arguments pour l'appel      */      PyObject *pyret;                        /* Retour de Python            */ -    pyobj = pygobject_new(G_OBJECT(item)); - -    tstate = get_pychrysalide_main_tstate(); +    gstate = PyGILState_Ensure(); -    if (tstate != NULL) -        PyEval_RestoreThread(tstate); +    pyobj = pygobject_new(G_OBJECT(item));      if (has_python_method(pyobj, "_focus_cursor"))      { @@ -538,8 +519,7 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedConten      } -    if (tstate != NULL) -        PyEval_SaveThread(); +    PyGILState_Release(gstate);  } @@ -711,7 +691,7 @@ bool ensure_python_editor_item_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_EDITOR_ITEM, type, &PyGObject_Type)) +        if (!register_class_for_pygobject(dict, G_TYPE_EDITOR_ITEM, type))              return false;      } diff --git a/plugins/pychrysalide/gui/menubar.c b/plugins/pychrysalide/gui/menubar.c index 5c6270e..29b76ac 100644 --- a/plugins/pychrysalide/gui/menubar.c +++ b/plugins/pychrysalide/gui/menubar.c @@ -160,7 +160,10 @@ bool ensure_python_menu_bar_is_registered(void)          dict = PyModule_GetDict(module); -        if (!register_class_for_pygobject(dict, G_TYPE_MENU_BAR, type, get_python_editor_item_type())) +        if (!ensure_python_editor_item_is_registered()) +            return false; + +        if (!register_class_for_pygobject(dict, G_TYPE_MENU_BAR, type))              return false;      } diff --git a/plugins/pychrysalide/gui/panel.c b/plugins/pychrysalide/gui/panel.c index 2afb2a1..949243c 100644 --- a/plugins/pychrysalide/gui/panel.c +++ b/plugins/pychrysalide/gui/panel.c @@ -164,7 +164,7 @@ static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject      if (first_time)      { -        status = register_class_for_dynamic_pygobject(gtype, type, base); +        status = register_class_for_dynamic_pygobject(gtype, type);          if (!status)          { @@ -1188,8 +1188,7 @@ bool ensure_python_panel_item_is_registered(void)          if (!ensure_python_dockable_is_registered())              return false; -        if (!_register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, type, -                                           get_python_editor_item_type(), get_python_dockable_type(), NULL)) +        if (!register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, type))              return false;          if (!define_panel_item_constants(type)) diff --git a/plugins/pychrysalide/gui/panels/Makefile.am b/plugins/pychrysalide/gui/panels/Makefile.am index 9585ec4..067c798 100644 --- a/plugins/pychrysalide/gui/panels/Makefile.am +++ b/plugins/pychrysalide/gui/panels/Makefile.am @@ -1,19 +1,14 @@  noinst_LTLIBRARIES = libpychrysaguipanels.la -libpychrysaguipanels_la_SOURCES =		\ -	module.h module.c					\ +libpychrysaguipanels_la_SOURCES =			\ +	module.h module.c						\  	updating.h updating.c -libpychrysaguipanels_la_LDFLAGS =  +libpychrysaguipanels_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ +	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT  devdir = $(includedir)/chrysalide/$(subdir)  dev_HEADERS = $(libpychrysaguipanels_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -	-I$(top_srcdir)/src - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) | 
