Author: dannym Date: 2009-01-11 14:26:42 +0000 (Sun, 11 Jan 2009) New Revision: 29152
Modified: pyxfce/trunk/panel/enums.c pyxfce/trunk/panel/enums.override pyxfce/trunk/panel/plugin_iface.c pyxfce/trunk/panel/plugin_iface.override pyxfce/trunk/panel/window.c pyxfce/trunk/panel/window.override Log: use 'libxfce4-panel-enums.h', fixes bug#3054. Modified: pyxfce/trunk/panel/enums.c =================================================================== --- pyxfce/trunk/panel/enums.c 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/enums.c 2009-01-11 14:26:42 UTC (rev 29152) @@ -8,7 +8,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-enums.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; @@ -30,8 +30,8 @@ /* ----------- functions ----------- */ -PyMethodDef pyenums_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pyenums_functions[] = { + { NULL, NULL, 0, NULL } }; @@ -40,6 +40,9 @@ void pyenums_add_constants(PyObject *module, const gchar *strip_prefix) { +#ifdef VERSION + PyModule_AddStringConstant(module, "__version__", VERSION); +#endif pyg_enum_add(module, "ScreenPosition", strip_prefix, XFCE_TYPE_SCREEN_POSITION); if (PyErr_Occurred()) @@ -53,34 +56,30 @@ PyObject *module; if ((module = PyImport_ImportModule("gobject")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); if (_PyGObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name GObject from gobject"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return; + return ; } if ((module = PyImport_ImportModule("gtk")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGtkWidget_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Widget"); + _PyGtkWidget_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Widget"); if (_PyGtkWidget_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Widget from gtk"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gtk"); - return; + return ; } -#line 86 "enums.c" +#line 85 "enums.c" } Modified: pyxfce/trunk/panel/enums.override =================================================================== --- pyxfce/trunk/panel/enums.override 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/enums.override 2009-01-11 14:26:42 UTC (rev 29152) @@ -6,7 +6,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-enums.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; Modified: pyxfce/trunk/panel/plugin_iface.c =================================================================== --- pyxfce/trunk/panel/plugin_iface.c 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/plugin_iface.c 2009-01-11 14:26:42 UTC (rev 29152) @@ -8,7 +8,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-plugin-iface.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; @@ -27,7 +27,7 @@ /* ---------- forward type declarations ---------- */ -PyTypeObject PyXfcePanelPlugin_Type; +PyTypeObject G_GNUC_INTERNAL PyXfcePanelPlugin_Type; #line 33 "plugin_iface.c" @@ -38,11 +38,16 @@ static PyObject * _wrap_xfce_panel_plugin_get_name(PyGObject *self) { - const gchar *ret; + gchar *ret; + ret = xfce_panel_plugin_get_name(XFCE_PANEL_PLUGIN(self->obj)); - if (ret) - return PyString_FromString(ret); + + if (ret) { + PyObject *py_ret = PyString_FromString(ret); + g_free(ret); + return py_ret; + } Py_INCREF(Py_None); return Py_None; } @@ -50,11 +55,16 @@ static PyObject * _wrap_xfce_panel_plugin_get_id(PyGObject *self) { - const gchar *ret; + gchar *ret; + ret = xfce_panel_plugin_get_id(XFCE_PANEL_PLUGIN(self->obj)); - if (ret) - return PyString_FromString(ret); + + if (ret) { + PyObject *py_ret = PyString_FromString(ret); + g_free(ret); + return py_ret; + } Py_INCREF(Py_None); return Py_None; } @@ -62,11 +72,16 @@ static PyObject * _wrap_xfce_panel_plugin_get_display_name(PyGObject *self) { - const gchar *ret; + gchar *ret; + ret = xfce_panel_plugin_get_display_name(XFCE_PANEL_PLUGIN(self->obj)); - if (ret) - return PyString_FromString(ret); + + if (ret) { + PyObject *py_ret = PyString_FromString(ret); + g_free(ret); + return py_ret; + } Py_INCREF(Py_None); return Py_None; } @@ -76,7 +91,9 @@ { int ret; + ret = xfce_panel_plugin_get_size(XFCE_PANEL_PLUGIN(self->obj)); + return PyInt_FromLong(ret); } @@ -85,7 +102,9 @@ { gint ret; + ret = xfce_panel_plugin_get_screen_position(XFCE_PANEL_PLUGIN(self->obj)); + return pyg_enum_from_gtype(XFCE_TYPE_SCREEN_POSITION, ret); } @@ -95,9 +114,11 @@ static char *kwlist[] = { "expand", NULL }; int expand; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:XfcePanelPlugin.set_expand", kwlist, &expand)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:XfcePanelPlugin.set_expand", kwlist, &expand)) return NULL; + xfce_panel_plugin_set_expand(XFCE_PANEL_PLUGIN(self->obj), expand); + Py_INCREF(Py_None); return Py_None; } @@ -107,7 +128,9 @@ { int ret; + ret = xfce_panel_plugin_get_expand(XFCE_PANEL_PLUGIN(self->obj)); + return PyBool_FromLong(ret); } @@ -117,7 +140,9 @@ { gint ret; + ret = xfce_panel_plugin_get_orientation(XFCE_PANEL_PLUGIN(self->obj)); + return pyg_enum_from_gtype(GTK_TYPE_ORIENTATION, ret); } @@ -127,9 +152,11 @@ static char *kwlist[] = { "widget", NULL }; PyGObject *widget; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:XfcePanelPlugin.add_action_widget", kwlist, &PyGtkWidget_Type, &widget)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:XfcePanelPlugin.add_action_widget", kwlist, &PyGtkWidget_Type, &widget)) return NULL; + xfce_panel_plugin_add_action_widget(XFCE_PANEL_PLUGIN(self->obj), GTK_WIDGET(widget->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -140,9 +167,11 @@ static char *kwlist[] = { "item", NULL }; PyGObject *item; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:XfcePanelPlugin.menu_insert_item", kwlist, &PyGtkMenuItem_Type, &item)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:XfcePanelPlugin.menu_insert_item", kwlist, &PyGtkMenuItem_Type, &item)) return NULL; + xfce_panel_plugin_menu_insert_item(XFCE_PANEL_PLUGIN(self->obj), GTK_MENU_ITEM(item->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -150,7 +179,9 @@ static PyObject * _wrap_xfce_panel_plugin_menu_show_about(PyGObject *self) { + xfce_panel_plugin_menu_show_about(XFCE_PANEL_PLUGIN(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -158,7 +189,9 @@ static PyObject * _wrap_xfce_panel_plugin_menu_show_configure(PyGObject *self) { + xfce_panel_plugin_menu_show_configure(XFCE_PANEL_PLUGIN(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -166,7 +199,9 @@ static PyObject * _wrap_xfce_panel_plugin_block_menu(PyGObject *self) { + xfce_panel_plugin_block_menu(XFCE_PANEL_PLUGIN(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -174,7 +209,9 @@ static PyObject * _wrap_xfce_panel_plugin_unblock_menu(PyGObject *self) { + xfce_panel_plugin_unblock_menu(XFCE_PANEL_PLUGIN(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -185,9 +222,11 @@ static char *kwlist[] = { "menu", NULL }; PyGObject *menu; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:XfcePanelPlugin.register_menu", kwlist, &PyGtkMenu_Type, &menu)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:XfcePanelPlugin.register_menu", kwlist, &PyGtkMenu_Type, &menu)) return NULL; + xfce_panel_plugin_register_menu(XFCE_PANEL_PLUGIN(self->obj), GTK_MENU(menu->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -197,7 +236,9 @@ { gchar *ret; + ret = xfce_panel_plugin_lookup_rc_file(XFCE_PANEL_PLUGIN(self->obj)); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -214,9 +255,11 @@ int create; gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:XfcePanelPlugin.save_location", kwlist, &create)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:XfcePanelPlugin.save_location", kwlist, &create)) return NULL; + ret = xfce_panel_plugin_save_location(XFCE_PANEL_PLUGIN(self->obj), create); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -232,74 +275,111 @@ static char *kwlist[] = { "widget", NULL }; PyGObject *widget; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:XfcePanelPlugin.focus_widget", kwlist, &PyGtkWidget_Type, &widget)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:XfcePanelPlugin.focus_widget", kwlist, &PyGtkWidget_Type, &widget)) return NULL; + xfce_panel_plugin_focus_widget(XFCE_PANEL_PLUGIN(self->obj), GTK_WIDGET(widget->obj)); + Py_INCREF(Py_None); return Py_None; } -static PyMethodDef _PyXfcePanelPlugin_methods[] = { - { "get_name", (PyCFunction)_wrap_xfce_panel_plugin_get_name, METH_NOARGS }, - { "get_id", (PyCFunction)_wrap_xfce_panel_plugin_get_id, METH_NOARGS }, - { "get_display_name", (PyCFunction)_wrap_xfce_panel_plugin_get_display_name, METH_NOARGS }, - { "get_size", (PyCFunction)_wrap_xfce_panel_plugin_get_size, METH_NOARGS }, - { "get_screen_position", (PyCFunction)_wrap_xfce_panel_plugin_get_screen_position, METH_NOARGS }, - { "set_expand", (PyCFunction)_wrap_xfce_panel_plugin_set_expand, METH_VARARGS|METH_KEYWORDS }, - { "get_expand", (PyCFunction)_wrap_xfce_panel_plugin_get_expand, METH_NOARGS }, - { "get_orientation", (PyCFunction)_wrap_xfce_panel_plugin_get_orientation, METH_NOARGS }, - { "add_action_widget", (PyCFunction)_wrap_xfce_panel_plugin_add_action_widget, METH_VARARGS|METH_KEYWORDS }, - { "menu_insert_item", (PyCFunction)_wrap_xfce_panel_plugin_menu_insert_item, METH_VARARGS|METH_KEYWORDS }, - { "menu_show_about", (PyCFunction)_wrap_xfce_panel_plugin_menu_show_about, METH_NOARGS }, - { "menu_show_configure", (PyCFunction)_wrap_xfce_panel_plugin_menu_show_configure, METH_NOARGS }, - { "block_menu", (PyCFunction)_wrap_xfce_panel_plugin_block_menu, METH_NOARGS }, - { "unblock_menu", (PyCFunction)_wrap_xfce_panel_plugin_unblock_menu, METH_NOARGS }, - { "register_menu", (PyCFunction)_wrap_xfce_panel_plugin_register_menu, METH_VARARGS|METH_KEYWORDS }, - { "lookup_rc_file", (PyCFunction)_wrap_xfce_panel_plugin_lookup_rc_file, METH_NOARGS }, - { "save_location", (PyCFunction)_wrap_xfce_panel_plugin_save_location, METH_VARARGS|METH_KEYWORDS }, - { "focus_widget", (PyCFunction)_wrap_xfce_panel_plugin_focus_widget, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +static PyObject * +_wrap_xfce_panel_plugin_set_panel_hidden(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "hidden", NULL }; + int hidden; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:XfcePanelPlugin.set_panel_hidden", kwlist, &hidden)) + return NULL; + + xfce_panel_plugin_set_panel_hidden(XFCE_PANEL_PLUGIN(self->obj), hidden); + + Py_INCREF(Py_None); + return Py_None; +} + +static const PyMethodDef _PyXfcePanelPlugin_methods[] = { + { "get_name", (PyCFunction)_wrap_xfce_panel_plugin_get_name, METH_NOARGS, + NULL }, + { "get_id", (PyCFunction)_wrap_xfce_panel_plugin_get_id, METH_NOARGS, + NULL }, + { "get_display_name", (PyCFunction)_wrap_xfce_panel_plugin_get_display_name, METH_NOARGS, + NULL }, + { "get_size", (PyCFunction)_wrap_xfce_panel_plugin_get_size, METH_NOARGS, + NULL }, + { "get_screen_position", (PyCFunction)_wrap_xfce_panel_plugin_get_screen_position, METH_NOARGS, + NULL }, + { "set_expand", (PyCFunction)_wrap_xfce_panel_plugin_set_expand, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_expand", (PyCFunction)_wrap_xfce_panel_plugin_get_expand, METH_NOARGS, + NULL }, + { "get_orientation", (PyCFunction)_wrap_xfce_panel_plugin_get_orientation, METH_NOARGS, + NULL }, + { "add_action_widget", (PyCFunction)_wrap_xfce_panel_plugin_add_action_widget, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "menu_insert_item", (PyCFunction)_wrap_xfce_panel_plugin_menu_insert_item, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "menu_show_about", (PyCFunction)_wrap_xfce_panel_plugin_menu_show_about, METH_NOARGS, + NULL }, + { "menu_show_configure", (PyCFunction)_wrap_xfce_panel_plugin_menu_show_configure, METH_NOARGS, + NULL }, + { "block_menu", (PyCFunction)_wrap_xfce_panel_plugin_block_menu, METH_NOARGS, + NULL }, + { "unblock_menu", (PyCFunction)_wrap_xfce_panel_plugin_unblock_menu, METH_NOARGS, + NULL }, + { "register_menu", (PyCFunction)_wrap_xfce_panel_plugin_register_menu, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "lookup_rc_file", (PyCFunction)_wrap_xfce_panel_plugin_lookup_rc_file, METH_NOARGS, + NULL }, + { "save_location", (PyCFunction)_wrap_xfce_panel_plugin_save_location, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "focus_widget", (PyCFunction)_wrap_xfce_panel_plugin_focus_widget, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_panel_hidden", (PyCFunction)_wrap_xfce_panel_plugin_set_panel_hidden, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyXfcePanelPlugin_Type = { +PyTypeObject G_GNUC_INTERNAL PyXfcePanelPlugin_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "pluginiface.PanelPlugin", /* tp_name */ - sizeof(PyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "pluginiface.PanelPlugin", /* tp_name */ + sizeof(PyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyXfcePanelPlugin_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyXfcePanelPlugin_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -310,8 +390,8 @@ /* ----------- functions ----------- */ -PyMethodDef pyplugin_iface_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pyplugin_iface_functions[] = { + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -321,47 +401,43 @@ PyObject *module; if ((module = PyImport_ImportModule("gobject")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); if (_PyGObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name GObject from gobject"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return; + return ; } if ((module = PyImport_ImportModule("gtk")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGtkWidget_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Widget"); + _PyGtkWidget_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Widget"); if (_PyGtkWidget_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Widget from gtk"); - return; + return ; } - _PyGtkMenuItem_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "MenuItem"); + _PyGtkMenuItem_Type = (PyTypeObject *)PyObject_GetAttrString(module, "MenuItem"); if (_PyGtkMenuItem_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name MenuItem from gtk"); - return; + return ; } - _PyGtkMenu_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Menu"); + _PyGtkMenu_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Menu"); if (_PyGtkMenu_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Menu from gtk"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gtk"); - return; + return ; } -#line 366 "plugin_iface.c" +#line 442 "plugin_iface.c" pyg_register_interface(d, "PanelPlugin", XFCE_TYPE_PANEL_PLUGIN, &PyXfcePanelPlugin_Type); } Modified: pyxfce/trunk/panel/plugin_iface.override =================================================================== --- pyxfce/trunk/panel/plugin_iface.override 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/plugin_iface.override 2009-01-11 14:26:42 UTC (rev 29152) @@ -6,7 +6,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-plugin-iface.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; Modified: pyxfce/trunk/panel/window.c =================================================================== --- pyxfce/trunk/panel/window.c 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/window.c 2009-01-11 14:26:42 UTC (rev 29152) @@ -8,7 +8,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-window.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; @@ -25,7 +25,7 @@ /* ---------- forward type declarations ---------- */ -PyTypeObject PyXfcePanelWindow_Type; +PyTypeObject G_GNUC_INTERNAL PyXfcePanelWindow_Type; #line 31 "window.c" @@ -38,20 +38,21 @@ { static char* kwlist[] = { NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":support.PanelWindow.__init__", kwlist)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + ":support.PanelWindow.__init__", + kwlist)) return -1; pygobject_constructv(self, 0, NULL); - if (!self->obj) { - PyErr_SetString(PyExc_RuntimeError, "could not create %(typename)s object"); + PyErr_SetString( + PyExc_RuntimeError, + "could not create support.PanelWindow object"); return -1; } - return 0; } - static PyObject * _wrap_xfce_panel_window_set_orientation(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -59,11 +60,13 @@ GtkOrientation orientation; PyObject *py_orientation = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:XfcePanelWindow.set_orientation", kwlist, &py_orientation)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:XfcePanelWindow.set_orientation", kwlist, &py_orientation)) return NULL; - if (pyg_enum_get_value(GTK_TYPE_ORIENTATION, py_orientation, (gint *)&orientation)) + if (pyg_enum_get_value(GTK_TYPE_ORIENTATION, py_orientation, (gpointer)&orientation)) return NULL; + xfce_panel_window_set_orientation(XFCE_PANEL_WINDOW(self->obj), orientation); + Py_INCREF(Py_None); return Py_None; } @@ -73,7 +76,9 @@ { gint ret; + ret = xfce_panel_window_get_orientation(XFCE_PANEL_WINDOW(self->obj)); + return pyg_enum_from_gtype(GTK_TYPE_ORIENTATION, ret); } @@ -84,11 +89,13 @@ PyObject *py_handle_style = NULL; XfceHandleStyle handle_style; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:XfcePanelWindow.set_handle_style", kwlist, &py_handle_style)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:XfcePanelWindow.set_handle_style", kwlist, &py_handle_style)) return NULL; - if (pyg_enum_get_value(XFCE_TYPE_HANDLE_STYLE, py_handle_style, (gint *)&handle_style)) + if (pyg_enum_get_value(XFCE_TYPE_HANDLE_STYLE, py_handle_style, (gpointer)&handle_style)) return NULL; + xfce_panel_window_set_handle_style(XFCE_PANEL_WINDOW(self->obj), handle_style); + Py_INCREF(Py_None); return Py_None; } @@ -98,7 +105,9 @@ { gint ret; + ret = xfce_panel_window_get_handle_style(XFCE_PANEL_WINDOW(self->obj)); + return pyg_enum_from_gtype(XFCE_TYPE_HANDLE_STYLE, ret); } @@ -108,9 +117,11 @@ static char *kwlist[] = { "top_border", "bottom_border", "left_border", "right_border", NULL }; int top_border, bottom_border, left_border, right_border; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iiii:XfcePanelWindow.set_show_border", kwlist, &top_border, &bottom_border, &left_border, &right_border)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"iiii:XfcePanelWindow.set_show_border", kwlist, &top_border, &bottom_border, &left_border, &right_border)) return NULL; + xfce_panel_window_set_show_border(XFCE_PANEL_WINDOW(self->obj), top_border, bottom_border, left_border, right_border); + Py_INCREF(Py_None); return Py_None; } @@ -121,9 +132,11 @@ static char *kwlist[] = { "movable", NULL }; int movable; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:XfcePanelWindow.set_movable", kwlist, &movable)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:XfcePanelWindow.set_movable", kwlist, &movable)) return NULL; + xfce_panel_window_set_movable(XFCE_PANEL_WINDOW(self->obj), movable); + Py_INCREF(Py_None); return Py_None; } @@ -133,61 +146,70 @@ { int ret; + ret = xfce_panel_window_get_movable(XFCE_PANEL_WINDOW(self->obj)); + return PyBool_FromLong(ret); } -static PyMethodDef _PyXfcePanelWindow_methods[] = { - { "set_orientation", (PyCFunction)_wrap_xfce_panel_window_set_orientation, METH_VARARGS|METH_KEYWORDS }, - { "get_orientation", (PyCFunction)_wrap_xfce_panel_window_get_orientation, METH_NOARGS }, - { "set_handle_style", (PyCFunction)_wrap_xfce_panel_window_set_handle_style, METH_VARARGS|METH_KEYWORDS }, - { "get_handle_style", (PyCFunction)_wrap_xfce_panel_window_get_handle_style, METH_NOARGS }, - { "set_show_border", (PyCFunction)_wrap_xfce_panel_window_set_show_border, METH_VARARGS|METH_KEYWORDS }, - { "set_movable", (PyCFunction)_wrap_xfce_panel_window_set_movable, METH_VARARGS|METH_KEYWORDS }, - { "get_movable", (PyCFunction)_wrap_xfce_panel_window_get_movable, METH_NOARGS }, - { NULL, NULL, 0 } +static const PyMethodDef _PyXfcePanelWindow_methods[] = { + { "set_orientation", (PyCFunction)_wrap_xfce_panel_window_set_orientation, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_orientation", (PyCFunction)_wrap_xfce_panel_window_get_orientation, METH_NOARGS, + NULL }, + { "set_handle_style", (PyCFunction)_wrap_xfce_panel_window_set_handle_style, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_handle_style", (PyCFunction)_wrap_xfce_panel_window_get_handle_style, METH_NOARGS, + NULL }, + { "set_show_border", (PyCFunction)_wrap_xfce_panel_window_set_show_border, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_movable", (PyCFunction)_wrap_xfce_panel_window_set_movable, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_movable", (PyCFunction)_wrap_xfce_panel_window_get_movable, METH_NOARGS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyXfcePanelWindow_Type = { +PyTypeObject G_GNUC_INTERNAL PyXfcePanelWindow_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "support.PanelWindow", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "support.PanelWindow", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyXfcePanelWindow_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyXfcePanelWindow_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)_wrap_xfce_panel_window_new, /* tp_init */ + (initproc)_wrap_xfce_panel_window_new, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -198,8 +220,8 @@ /* ----------- functions ----------- */ -PyMethodDef pywindow_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pywindow_functions[] = { + { NULL, NULL, 0, NULL } }; @@ -208,6 +230,9 @@ void pywindow_add_constants(PyObject *module, const gchar *strip_prefix) { +#ifdef VERSION + PyModule_AddStringConstant(module, "__version__", VERSION); +#endif pyg_enum_add(module, "HandleStyle", strip_prefix, XFCE_TYPE_HANDLE_STYLE); if (PyErr_Occurred()) @@ -221,42 +246,38 @@ PyObject *module; if ((module = PyImport_ImportModule("gobject")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); if (_PyGObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name GObject from gobject"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return; + return ; } if ((module = PyImport_ImportModule("gtk")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGtkWidget_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Widget"); + _PyGtkWidget_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Widget"); if (_PyGtkWidget_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Widget from gtk"); - return; + return ; } - _PyGtkWindow_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Window"); + _PyGtkWindow_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Window"); if (_PyGtkWindow_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Window from gtk"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gtk"); - return; + return ; } -#line 260 "window.c" +#line 281 "window.c" pygobject_register_class(d, "XfcePanelWindow", XFCE_TYPE_PANEL_WINDOW, &PyXfcePanelWindow_Type, Py_BuildValue("(O)", &PyGtkWindow_Type)); pyg_set_object_has_new_constructor(XFCE_TYPE_PANEL_WINDOW); } Modified: pyxfce/trunk/panel/window.override =================================================================== --- pyxfce/trunk/panel/window.override 2009-01-11 13:44:31 UTC (rev 29151) +++ pyxfce/trunk/panel/window.override 2009-01-11 14:26:42 UTC (rev 29152) @@ -6,7 +6,7 @@ #include "pygobject.h" #include <gtk/gtk.h> #include <libxfce4panel/xfce-panel-window.h> -#include <libxfce4panel/xfce-panel-enum-types.h> +#include <libxfce4panel/libxfce4panel-enum-types.h> extern PyTypeObject PyGtkWidget_Type; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits