Author: dannym Date: 2009-07-06 16:44:35 +0000 (Mon, 06 Jul 2009) New Revision: 30205
Modified: pyxfce/branches/4.6/util/desktopentry.c pyxfce/branches/4.6/util/fileutils.c pyxfce/branches/4.6/util/i18n.c pyxfce/branches/4.6/util/kiosk.c pyxfce/branches/4.6/util/miscutils.c pyxfce/branches/4.6/util/rc.c pyxfce/branches/4.6/util/resource.c pyxfce/branches/4.6/util/utf8.c Log: pyxfce 4.6: util: update to PyGTK 2.14. Modified: pyxfce/branches/4.6/util/desktopentry.c =================================================================== --- pyxfce/branches/4.6/util/desktopentry.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/desktopentry.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -18,7 +18,7 @@ /* ---------- forward type declarations ---------- */ -PyTypeObject PyXfceDesktopEntry_Type; +PyTypeObject G_GNUC_INTERNAL PyXfceDesktopEntry_Type; #line 24 "desktopentry.c" @@ -31,7 +31,9 @@ { const gchar *ret; + ret = xfce_desktop_entry_get_file(XFCE_DESKTOP_ENTRY(self->obj)); + if (ret) return PyString_FromString(ret); Py_INCREF(Py_None); @@ -56,7 +58,7 @@ Py_INCREF(Py_None); return Py_None; } -#line 60 "desktopentry.c" +#line 62 "desktopentry.c" #line 29 "desktopentry.override" @@ -83,7 +85,7 @@ Py_INCREF(Py_None); return Py_None; } -#line 87 "desktopentry.c" +#line 89 "desktopentry.c" static PyObject * @@ -93,60 +95,66 @@ char *key; int ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:XfceDesktopEntry.has_translated_entry", kwlist, &key)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:XfceDesktopEntry.has_translated_entry", kwlist, &key)) return NULL; + ret = xfce_desktop_entry_has_translated_entry(XFCE_DESKTOP_ENTRY(self->obj), key); + return PyBool_FromLong(ret); } -static PyMethodDef _PyXfceDesktopEntry_methods[] = { - { "get_file", (PyCFunction)_wrap_xfce_desktop_entry_get_file, METH_NOARGS }, - { "get_int", (PyCFunction)_wrap_xfce_desktop_entry_get_int, METH_VARARGS|METH_KEYWORDS }, - { "get_string", (PyCFunction)_wrap_xfce_desktop_entry_get_string, METH_VARARGS|METH_KEYWORDS }, - { "has_translated_entry", (PyCFunction)_wrap_xfce_desktop_entry_has_translated_entry, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +static const PyMethodDef _PyXfceDesktopEntry_methods[] = { + { "get_file", (PyCFunction)_wrap_xfce_desktop_entry_get_file, METH_NOARGS, + NULL }, + { "get_int", (PyCFunction)_wrap_xfce_desktop_entry_get_int, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_string", (PyCFunction)_wrap_xfce_desktop_entry_get_string, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "has_translated_entry", (PyCFunction)_wrap_xfce_desktop_entry_has_translated_entry, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyXfceDesktopEntry_Type = { +PyTypeObject G_GNUC_INTERNAL PyXfceDesktopEntry_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "desktopentry.DesktopEntry", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "desktopentry.DesktopEntry", /* 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 */ - _PyXfceDesktopEntry_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*)_PyXfceDesktopEntry_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)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -245,12 +253,13 @@ g_object_unref(desktop_entry); return py_desktop_entry; } -#line 249 "desktopentry.c" +#line 257 "desktopentry.c" -PyMethodDef pydesktopentry_functions[] = { - { "desktop_entry_new", (PyCFunction)_wrap_xfce_desktop_entry_new, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +const PyMethodDef pydesktopentry_functions[] = { + { "desktop_entry_new", (PyCFunction)_wrap_xfce_desktop_entry_new, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -260,22 +269,20 @@ 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 ; } -#line 279 "desktopentry.c" +#line 286 "desktopentry.c" pygobject_register_class(d, "XfceDesktopEntry", XFCE_TYPE_DESKTOP_ENTRY, &PyXfceDesktopEntry_Type, Py_BuildValue("(O)", &PyGObject_Type)); pyg_set_object_has_new_constructor(XFCE_TYPE_DESKTOP_ENTRY); } Modified: pyxfce/branches/4.6/util/fileutils.c =================================================================== --- pyxfce/branches/4.6/util/fileutils.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/fileutils.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -34,18 +34,21 @@ unsigned long mode; GError *error = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sk:mkdirhier", kwlist, &whole_path, &mode)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sk:mkdirhier", kwlist, &whole_path, &mode)) return NULL; + ret = xfce_mkdirhier(whole_path, mode, &error); + if (pyg_error_check(&error)) return NULL; return PyBool_FromLong(ret); } -PyMethodDef pyfileutils_functions[] = { - { "mkdirhier", (PyCFunction)_wrap_xfce_mkdirhier, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +const PyMethodDef pyfileutils_functions[] = { + { "mkdirhier", (PyCFunction)_wrap_xfce_mkdirhier, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -55,20 +58,18 @@ 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 ; } -#line 74 "fileutils.c" +#line 75 "fileutils.c" } Modified: pyxfce/branches/4.6/util/i18n.c =================================================================== --- pyxfce/branches/4.6/util/i18n.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/i18n.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -31,9 +31,11 @@ static char *kwlist[] = { "package", "localedir", "encoding", NULL }; char *package, *localedir, *encoding; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sss:textdomain", kwlist, &package, &localedir, &encoding)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sss:textdomain", kwlist, &package, &localedir, &encoding)) return NULL; + xfce_textdomain(package, localedir, encoding); + Py_INCREF(Py_None); return Py_None; } @@ -45,9 +47,11 @@ char *msgid, *msgval; const gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss:strip_context", kwlist, &msgid, &msgval)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ss:strip_context", kwlist, &msgid, &msgval)) return NULL; + ret = xfce_strip_context(msgid, msgval); + if (ret) return PyString_FromString(ret); Py_INCREF(Py_None); @@ -61,9 +65,11 @@ char *filename; gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:get_file_localized", kwlist, &filename)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:get_file_localized", kwlist, &filename)) return NULL; + ret = xfce_get_file_localized(filename); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -81,9 +87,11 @@ gsize length; gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sks:get_file_localized_r", kwlist, &buffer, &length, &filename)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sks:get_file_localized_r", kwlist, &buffer, &length, &filename)) return NULL; + ret = xfce_get_file_localized_r(buffer, length, filename); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -100,9 +108,11 @@ char *directory; gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:get_dir_localized", kwlist, &directory)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:get_dir_localized", kwlist, &directory)) return NULL; + ret = xfce_get_dir_localized(directory); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -120,9 +130,11 @@ gsize length; gchar *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sks:get_dir_localized_r", kwlist, &buffer, &length, &directory)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sks:get_dir_localized_r", kwlist, &buffer, &length, &directory)) return NULL; + ret = xfce_get_dir_localized_r(buffer, length, directory); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -139,21 +151,30 @@ char *locale1, *locale2; guint ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss:locale_match", kwlist, &locale1, &locale2)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ss:locale_match", kwlist, &locale1, &locale2)) return NULL; + ret = xfce_locale_match(locale1, locale2); + return PyLong_FromUnsignedLong(ret); } -PyMethodDef pyi18n_functions[] = { - { "textdomain", (PyCFunction)_wrap_xfce_textdomain, METH_VARARGS|METH_KEYWORDS }, - { "strip_context", (PyCFunction)_wrap_xfce_strip_context, METH_VARARGS|METH_KEYWORDS }, - { "get_file_localized", (PyCFunction)_wrap_xfce_get_file_localized, METH_VARARGS|METH_KEYWORDS }, - { "get_file_localized_r", (PyCFunction)_wrap_xfce_get_file_localized_r, METH_VARARGS|METH_KEYWORDS }, - { "get_dir_localized", (PyCFunction)_wrap_xfce_get_dir_localized, METH_VARARGS|METH_KEYWORDS }, - { "get_dir_localized_r", (PyCFunction)_wrap_xfce_get_dir_localized_r, METH_VARARGS|METH_KEYWORDS }, - { "locale_match", (PyCFunction)_wrap_xfce_locale_match, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +const PyMethodDef pyi18n_functions[] = { + { "textdomain", (PyCFunction)_wrap_xfce_textdomain, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "strip_context", (PyCFunction)_wrap_xfce_strip_context, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_file_localized", (PyCFunction)_wrap_xfce_get_file_localized, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_file_localized_r", (PyCFunction)_wrap_xfce_get_file_localized_r, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_dir_localized", (PyCFunction)_wrap_xfce_get_dir_localized, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_dir_localized_r", (PyCFunction)_wrap_xfce_get_dir_localized_r, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "locale_match", (PyCFunction)_wrap_xfce_locale_match, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -163,20 +184,18 @@ 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 ; } -#line 182 "i18n.c" +#line 201 "i18n.c" } Modified: pyxfce/branches/4.6/util/kiosk.c =================================================================== --- pyxfce/branches/4.6/util/kiosk.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/kiosk.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -25,8 +25,8 @@ /* ----------- functions ----------- */ -PyMethodDef pykiosk_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pykiosk_functions[] = { + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -36,20 +36,18 @@ 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 ; } -#line 55 "kiosk.c" +#line 53 "kiosk.c" } Modified: pyxfce/branches/4.6/util/miscutils.c =================================================================== --- pyxfce/branches/4.6/util/miscutils.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/miscutils.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -30,7 +30,9 @@ { const gchar *ret; + ret = xfce_version_string(); + if (ret) return PyString_FromString(ret); Py_INCREF(Py_None); @@ -42,7 +44,9 @@ { const gchar *ret; + ret = xfce_get_homedir(); + if (ret) return PyString_FromString(ret); Py_INCREF(Py_None); @@ -54,18 +58,23 @@ { const gchar *ret; + ret = xfce_get_userdir(); + if (ret) return PyString_FromString(ret); Py_INCREF(Py_None); return Py_None; } -PyMethodDef pymiscutils_functions[] = { - { "version_string", (PyCFunction)_wrap_xfce_version_string, METH_NOARGS }, - { "get_homedir", (PyCFunction)_wrap_xfce_get_homedir, METH_NOARGS }, - { "get_userdir", (PyCFunction)_wrap_xfce_get_userdir, METH_NOARGS }, - { NULL, NULL, 0 } +const PyMethodDef pymiscutils_functions[] = { + { "version_string", (PyCFunction)_wrap_xfce_version_string, METH_NOARGS, + NULL }, + { "get_homedir", (PyCFunction)_wrap_xfce_get_homedir, METH_NOARGS, + NULL }, + { "get_userdir", (PyCFunction)_wrap_xfce_get_userdir, METH_NOARGS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -75,20 +84,18 @@ 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 ; } -#line 94 "miscutils.c" +#line 101 "miscutils.c" } Modified: pyxfce/branches/4.6/util/rc.c =================================================================== --- pyxfce/branches/4.6/util/rc.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/rc.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -25,8 +25,8 @@ /* ----------- functions ----------- */ -PyMethodDef pyrc_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pyrc_functions[] = { + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -36,20 +36,18 @@ 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 ; } -#line 55 "rc.c" +#line 53 "rc.c" } Modified: pyxfce/branches/4.6/util/resource.c =================================================================== --- pyxfce/branches/4.6/util/resource.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/resource.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -35,11 +35,13 @@ gchar *ret; XfceResourceType type; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os:resource_lookup", kwlist, &py_type, &filename)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Os:resource_lookup", kwlist, &py_type, &filename)) return NULL; - if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gint *)&type)) + if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gpointer)&type)) return NULL; + ret = xfce_resource_lookup(type, filename); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -57,11 +59,13 @@ char *path; XfceResourceType type; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os:resource_push_path", kwlist, &py_type, &path)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Os:resource_push_path", kwlist, &py_type, &path)) return NULL; - if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gint *)&type)) + if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gpointer)&type)) return NULL; + xfce_resource_push_path(type, path); + Py_INCREF(Py_None); return Py_None; } @@ -73,11 +77,13 @@ PyObject *py_type = NULL; XfceResourceType type; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:resource_pop_path", kwlist, &py_type)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:resource_pop_path", kwlist, &py_type)) return NULL; - if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gint *)&type)) + if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gpointer)&type)) return NULL; + xfce_resource_pop_path(type); + Py_INCREF(Py_None); return Py_None; } @@ -92,11 +98,13 @@ gchar *ret; XfceResourceType type; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Osi:resource_save_location", kwlist, &py_type, &relpath, &create)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Osi:resource_save_location", kwlist, &py_type, &relpath, &create)) return NULL; - if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gint *)&type)) + if (pyg_enum_get_value(XFCE_TYPE_RESOURCE_TYPE, py_type, (gpointer)&type)) return NULL; + ret = xfce_resource_save_location(type, relpath, create); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -106,12 +114,16 @@ return Py_None; } -PyMethodDef pyresource_functions[] = { - { "resource_lookup", (PyCFunction)_wrap_xfce_resource_lookup, METH_VARARGS|METH_KEYWORDS }, - { "resource_push_path", (PyCFunction)_wrap_xfce_resource_push_path, METH_VARARGS|METH_KEYWORDS }, - { "resource_pop_path", (PyCFunction)_wrap_xfce_resource_pop_path, METH_VARARGS|METH_KEYWORDS }, - { "resource_save_location", (PyCFunction)_wrap_xfce_resource_save_location, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +const PyMethodDef pyresource_functions[] = { + { "resource_lookup", (PyCFunction)_wrap_xfce_resource_lookup, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "resource_push_path", (PyCFunction)_wrap_xfce_resource_push_path, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "resource_pop_path", (PyCFunction)_wrap_xfce_resource_pop_path, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "resource_save_location", (PyCFunction)_wrap_xfce_resource_save_location, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; @@ -120,6 +132,9 @@ void pyresource_add_constants(PyObject *module, const gchar *strip_prefix) { +#ifdef VERSION + PyModule_AddStringConstant(module, "__version__", VERSION); +#endif pyg_enum_add(module, "ResourceType", strip_prefix, XFCE_TYPE_RESOURCE_TYPE); if (PyErr_Occurred()) @@ -133,20 +148,18 @@ 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 ; } -#line 152 "resource.c" +#line 165 "resource.c" } Modified: pyxfce/branches/4.6/util/utf8.c =================================================================== --- pyxfce/branches/4.6/util/utf8.c 2009-07-06 16:44:10 UTC (rev 30204) +++ pyxfce/branches/4.6/util/utf8.c 2009-07-06 16:44:35 UTC (rev 30205) @@ -33,9 +33,11 @@ gchar *ret; gssize max_len; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sls:utf8_remove_controls", kwlist, &str, &max_len, &end)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sls:utf8_remove_controls", kwlist, &str, &max_len, &end)) return NULL; + ret = xfce_utf8_remove_controls(str, max_len, end); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -53,9 +55,11 @@ gchar *ret; gssize max_len; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sl:utf8_strndup", kwlist, &src, &max_len)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sl:utf8_strndup", kwlist, &src, &max_len)) return NULL; + ret = xfce_utf8_strndup(src, max_len); + if (ret) { PyObject *py_ret = PyString_FromString(ret); g_free(ret); @@ -65,10 +69,12 @@ return Py_None; } -PyMethodDef pyutf8_functions[] = { - { "utf8_remove_controls", (PyCFunction)_wrap_xfce_utf8_remove_controls, METH_VARARGS|METH_KEYWORDS }, - { "utf8_strndup", (PyCFunction)_wrap_xfce_utf8_strndup, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +const PyMethodDef pyutf8_functions[] = { + { "utf8_remove_controls", (PyCFunction)_wrap_xfce_utf8_remove_controls, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "utf8_strndup", (PyCFunction)_wrap_xfce_utf8_strndup, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -78,20 +84,18 @@ 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 ; } -#line 97 "utf8.c" +#line 101 "utf8.c" } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits