diff options
Diffstat (limited to 'plugins/pychrysa/gtkext')
-rw-r--r-- | plugins/pychrysa/gtkext/viewpanel.c | 39 | ||||
-rw-r--r-- | plugins/pychrysa/gtkext/viewpanel.h | 5 |
2 files changed, 10 insertions, 34 deletions
diff --git a/plugins/pychrysa/gtkext/viewpanel.c b/plugins/pychrysa/gtkext/viewpanel.c index c1108c2..9d5645a 100644 --- a/plugins/pychrysa/gtkext/viewpanel.c +++ b/plugins/pychrysa/gtkext/viewpanel.c @@ -28,6 +28,9 @@ #include <pygobject.h> +#include <gtkext/gtkviewpanel.h> + + #include "../quirks.h" @@ -66,7 +69,7 @@ static PyObject *py_view_panel_new(PyTypeObject *type, PyObject *args, PyObject GEditorItem *item; /* Version GLib du format */ ret = PyArg_ParseTuple(args, "ssOs", &name, &lname, &widget, &path); - if (!ret) return Py_None; + if (!ret) Py_RETURN_NONE; item = g_view_panel_new(get_internal_ref(), name, lname, GTK_WIDGET(pygobject_get(widget)), path); @@ -78,35 +81,9 @@ static PyObject *py_view_panel_new(PyTypeObject *type, PyObject *args, PyObject #endif /* FIXME */ - return Py_None; - -} - - -/****************************************************************************** -* * -* Paramètres : item = instance existante GLib. * -* * -* Description : Crée un nouvel objet Python de type 'ViewPanel'. * -* * -* Retour : Instance Python mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ -PyObject *py_view_panel_from_c(GtkViewPanel *item) -{ - PyObject *module; /* Module d'appartenance */ - PyTypeObject *type; /* Type Python correspondant */ - module = PyImport_ImportModule("pychrysalide.gtkext"); - type = (PyTypeObject *)PyObject_GetAttrString(module, "ViewPanel"); - Py_DECREF(module); - - pychrysalide_set_instance_data(G_OBJECT(item), type); - - return pygobject_new(G_OBJECT(item)); + Py_RETURN_NONE; } @@ -114,6 +91,7 @@ PyObject *py_view_panel_from_c(GtkViewPanel *item) + /****************************************************************************** * * * Paramètres : self = classe représentant un tampon de code. * @@ -136,7 +114,7 @@ static PyObject *py_view_panel_scroll_to_address(PyObject *self, PyObject *args) panel = GTK_VIEW_PANEL(pygobject_get(self)); ret = PyArg_ParseTuple(args, "K", &addr); - if (!ret) return Py_None; + if (!ret) Py_RETURN_NONE; gtk_view_panel_scroll_to_address(panel, addr); @@ -209,6 +187,9 @@ bool register_python_view_panel(PyObject *module) Py_INCREF(&py_view_panel_type); ret = PyModule_AddObject(module, "ViewPanel", (PyObject *)&py_view_panel_type); + pygobject_register_class(module, "GtkViewPanel", GTK_TYPE_VIEW_PANEL, &py_view_panel_type, + Py_BuildValue("(O)", py_view_panel_type.tp_base)); + return (ret == 0); } diff --git a/plugins/pychrysa/gtkext/viewpanel.h b/plugins/pychrysa/gtkext/viewpanel.h index 98b1150..7733e46 100644 --- a/plugins/pychrysa/gtkext/viewpanel.h +++ b/plugins/pychrysa/gtkext/viewpanel.h @@ -29,13 +29,8 @@ #include <Python.h> #include <stdbool.h> -#include <gtkext/gtkviewpanel.h> - -/* Crée un nouvel objet Python de type 'ViewPanel'. */ -PyObject *py_view_panel_from_c(GtkViewPanel *); - /* Prend en charge l'objet 'pychrysalide.gtkext.ViewPanel'. */ bool register_python_view_panel(PyObject *module); |