Updating branch refs/heads/master to 5d30bc1232fc6a6c50cff22f5c2f8ca3197cc957 (commit) from c397903391346d2078219ba03488f2ffa27cac6c (commit)
commit 5d30bc1232fc6a6c50cff22f5c2f8ca3197cc957 Author: Danny Milosavljevic <dan...@xfce.org> Date: Wed Dec 29 23:42:39 2010 +0100 add xfconf files. xfconf/binding.c | 70 +++++ xfconf/binding.defs | 58 ++++ xfconf/channel.c | 501 ++++++++++++++++++++++++++++++++++ xfconf/channel.defs | 408 +++++++++++++++++++++++++++ gui/filechooser.c => xfconf/errors.c | 36 ++-- xfconf/errors.defs | 40 +++ util/rc.c => xfconf/types.c | 26 +- xfconf/types.defs | 56 ++++ 8 files changed, 1162 insertions(+), 33 deletions(-) diff --git a/xfconf/binding.c b/xfconf/binding.c new file mode 100644 index 0000000..144c89c --- /dev/null +++ b/xfconf/binding.c @@ -0,0 +1,70 @@ +/* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */ + +#include <Python.h> + + + +#line 6 "binding.override" +#include "pygobject.h" +#include <glib.h> +#include <xfconf/xfconf.h> + +#line 13 "binding.c" + + +/* ---------- types from other modules ---------- */ +static PyTypeObject *_PyGObject_Type; +#define PyGObject_Type (*_PyGObject_Type) + + +/* ---------- forward type declarations ---------- */ + +#line 23 "binding.c" + + + +/* ----------- functions ----------- */ + +static PyObject * +_wrap_xfconf_g_property_unbind(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "id", NULL }; + unsigned long id; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"k:g_property_unbind", kwlist, &id)) + return NULL; + + xfconf_g_property_unbind(id); + + Py_INCREF(Py_None); + return Py_None; +} + +const PyMethodDef pybinding_functions[] = { + { "g_property_unbind", (PyCFunction)_wrap_xfconf_g_property_unbind, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } +}; + +/* initialise stuff extension classes */ +void +pybinding_register_classes(PyObject *d) +{ + PyObject *module; + + if ((module = PyImport_ImportModule("gobject")) != NULL) { + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); + if (_PyGObject_Type == NULL) { + PyErr_SetString(PyExc_ImportError, + "cannot import name GObject from gobject"); + return ; + } + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gobject"); + return ; + } + + +#line 70 "binding.c" +} diff --git a/xfconf/binding.defs b/xfconf/binding.defs new file mode 100644 index 0000000..fa0880f --- /dev/null +++ b/xfconf/binding.defs @@ -0,0 +1,58 @@ +;; -*- scheme -*- +; object definitions ... +;; Enumerations and flags ... + + +;; From xfconf-binding.h + +(define-function g_property_bind + (c-name "xfconf_g_property_bind") + (return-type "gulong") + (parameters + '("XfconfChannel*" "channel") + '("const-gchar*" "xfconf_property") + '("GType" "xfconf_property_type") + '("gpointer" "object") + '("const-gchar*" "object_property") + ) +) + +(define-function g_property_bind_gdkcolor + (c-name "xfconf_g_property_bind_gdkcolor") + (return-type "gulong") + (parameters + '("XfconfChannel*" "channel") + '("const-gchar*" "xfconf_property") + '("gpointer" "object") + '("const-gchar*" "object_property") + ) +) + +(define-function g_property_unbind + (c-name "xfconf_g_property_unbind") + (return-type "none") + (parameters + '("gulong" "id") + ) +) + +(define-function g_property_unbind_by_property + (c-name "xfconf_g_property_unbind_by_property") + (return-type "none") + (parameters + '("XfconfChannel*" "channel") + '("const-gchar*" "xfconf_property") + '("gpointer" "object") + '("const-gchar*" "object_property") + ) +) + +(define-function g_property_unbind_all + (c-name "xfconf_g_property_unbind_all") + (return-type "none") + (parameters + '("gpointer" "channel_or_object") + ) +) + + diff --git a/xfconf/channel.c b/xfconf/channel.c new file mode 100644 index 0000000..2e4004a --- /dev/null +++ b/xfconf/channel.c @@ -0,0 +1,501 @@ +/* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */ + +#include <Python.h> + + + +#line 6 "channel.override" +#include "pygobject.h" +#include <glib.h> +#include <xfconf/xfconf.h> + +#line 13 "channel.c" + + +/* ---------- types from other modules ---------- */ +static PyTypeObject *_PyGObject_Type; +#define PyGObject_Type (*_PyGObject_Type) + + +/* ---------- forward type declarations ---------- */ +PyTypeObject G_GNUC_INTERNAL PyXfconfChannel_Type; + +#line 24 "channel.c" + + + +/* ----------- XfconfChannel ----------- */ + +static int +_wrap_xfconf_channel_new(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "channel_name", NULL }; + char *channel_name; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:XfconfChannel.__init__", kwlist, &channel_name)) + return -1; + self->obj = (GObject *)xfconf_channel_new(channel_name); + + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create XfconfChannel object"); + return -1; + } + pygobject_register_wrapper((PyObject *)self); + return 0; +} + +static PyObject * +_wrap_xfconf_channel_has_property(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", NULL }; + char *property; + int ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:XfconfChannel.has_property", kwlist, &property)) + return NULL; + + ret = xfconf_channel_has_property(XFCONF_CHANNEL(self->obj), property); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_is_property_locked(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", NULL }; + char *property; + int ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:XfconfChannel.is_property_locked", kwlist, &property)) + return NULL; + + ret = xfconf_channel_is_property_locked(XFCONF_CHANNEL(self->obj), property); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_reset_property(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property_base", "recursive", NULL }; + char *property_base; + int recursive; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"si:XfconfChannel.reset_property", kwlist, &property_base, &recursive)) + return NULL; + + xfconf_channel_reset_property(XFCONF_CHANNEL(self->obj), property_base, recursive); + + Py_INCREF(Py_None); + return Py_None; +} + +#line 49 "channel.override" +static PyObject * +_wrap_xfconf_channel_get_properties(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property_base", NULL }; + GHashTable *ret; + char* path; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:XfconfChannel.get_properties", kwlist, &path)) + return NULL; + ret = xfconf_channel_get_properties(XFCONF_CHANNEL(self->obj), path); + if (ret) { + GHashTableIter iter; + gpointer key, value; + PyObject* py_ret; + py_ret = PyDict_New(); + g_hash_table_iter_init(&iter, ret); + while(g_hash_table_iter_next(&iter, &key, &value)) { + PyDict_SetItem(py_ret, PyString_FromString((const char*) key), pyg_value_as_pyobject((GValue*) value, TRUE)); + } + g_hash_table_destroy(ret); + return py_ret; + } + Py_INCREF(Py_None); + return Py_None; +} +#line 122 "channel.c" + + +static PyObject * +_wrap_xfconf_channel_get_string(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property, *default_value; + gchar *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ss:XfconfChannel.get_string", kwlist, &property, &default_value)) + return NULL; + + ret = xfconf_channel_get_string(XFCONF_CHANNEL(self->obj), property, default_value); + + if (ret) { + PyObject *py_ret = PyString_FromString(ret); + g_free(ret); + return py_ret; + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_xfconf_channel_set_string(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property, *value; + int ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ss:XfconfChannel.set_string", kwlist, &property, &value)) + return NULL; + + ret = xfconf_channel_set_string(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_get_int(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property; + int default_value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"si:XfconfChannel.get_int", kwlist, &property, &default_value)) + return NULL; + + ret = xfconf_channel_get_int(XFCONF_CHANNEL(self->obj), property, default_value); + + return PyInt_FromLong(ret); +} + +static PyObject * +_wrap_xfconf_channel_set_int(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property; + int value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"si:XfconfChannel.set_int", kwlist, &property, &value)) + return NULL; + + ret = xfconf_channel_set_int(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_get_uint(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property; + guint32 ret; + unsigned long default_value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sk:XfconfChannel.get_uint", kwlist, &property, &default_value)) + return NULL; + + ret = xfconf_channel_get_uint(XFCONF_CHANNEL(self->obj), property, default_value); + + return PyLong_FromUnsignedLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_set_uint(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property; + int ret; + unsigned long value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sk:XfconfChannel.set_uint", kwlist, &property, &value)) + return NULL; + + ret = xfconf_channel_set_uint(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_get_uint64(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property; + PyObject *py_default_value = NULL; + guint64 default_value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sO!:XfconfChannel.get_uint64", kwlist, &property, &PyLong_Type, &py_default_value)) + return NULL; + default_value = PyLong_AsUnsignedLongLong(py_default_value); + + ret = xfconf_channel_get_uint64(XFCONF_CHANNEL(self->obj), property, default_value); + + return PyLong_FromUnsignedLongLong(ret); +} + +static PyObject * +_wrap_xfconf_channel_set_uint64(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property; + PyObject *py_value = NULL; + int ret; + guint64 value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sO!:XfconfChannel.set_uint64", kwlist, &property, &PyLong_Type, &py_value)) + return NULL; + value = PyLong_AsUnsignedLongLong(py_value); + + ret = xfconf_channel_set_uint64(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_get_double(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property; + double default_value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sd:XfconfChannel.get_double", kwlist, &property, &default_value)) + return NULL; + + ret = xfconf_channel_get_double(XFCONF_CHANNEL(self->obj), property, default_value); + + return PyFloat_FromDouble(ret); +} + +static PyObject * +_wrap_xfconf_channel_set_double(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property; + double value; + int ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sd:XfconfChannel.set_double", kwlist, &property, &value)) + return NULL; + + ret = xfconf_channel_set_double(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_get_bool(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "default_value", NULL }; + char *property; + int default_value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"si:XfconfChannel.get_bool", kwlist, &property, &default_value)) + return NULL; + + ret = xfconf_channel_get_bool(XFCONF_CHANNEL(self->obj), property, default_value); + + return PyBool_FromLong(ret); + +} + +static PyObject * +_wrap_xfconf_channel_set_bool(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "property", "value", NULL }; + char *property; + int value, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"si:XfconfChannel.set_bool", kwlist, &property, &value)) + return NULL; + + ret = xfconf_channel_set_bool(XFCONF_CHANNEL(self->obj), property, value); + + return PyBool_FromLong(ret); + +} + +static const PyMethodDef _PyXfconfChannel_methods[] = { + { "has_property", (PyCFunction)_wrap_xfconf_channel_has_property, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "is_property_locked", (PyCFunction)_wrap_xfconf_channel_is_property_locked, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "reset_property", (PyCFunction)_wrap_xfconf_channel_reset_property, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_properties", (PyCFunction)_wrap_xfconf_channel_get_properties, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_string", (PyCFunction)_wrap_xfconf_channel_get_string, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_string", (PyCFunction)_wrap_xfconf_channel_set_string, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_int", (PyCFunction)_wrap_xfconf_channel_get_int, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_int", (PyCFunction)_wrap_xfconf_channel_set_int, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_uint", (PyCFunction)_wrap_xfconf_channel_get_uint, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_uint", (PyCFunction)_wrap_xfconf_channel_set_uint, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_uint64", (PyCFunction)_wrap_xfconf_channel_get_uint64, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_uint64", (PyCFunction)_wrap_xfconf_channel_set_uint64, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_double", (PyCFunction)_wrap_xfconf_channel_get_double, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_double", (PyCFunction)_wrap_xfconf_channel_set_double, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_bool", (PyCFunction)_wrap_xfconf_channel_get_bool, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_bool", (PyCFunction)_wrap_xfconf_channel_set_bool, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } +}; + +PyTypeObject G_GNUC_INTERNAL PyXfconfChannel_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "classgroup.Channel", /* 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 */ + (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 */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + 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 */ + (struct PyMethodDef*)_PyXfconfChannel_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_xfconf_channel_new, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ +}; + + + +/* ----------- functions ----------- */ + +#line 25 "channel.override" +static PyObject * +_wrap_xfconf_list_channels(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { NULL }; + gchar **ret; + int i; + int count; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, ":list_channels", kwlist)) + return NULL; + ret = xfconf_list_channels(); + if (ret) { + count = g_strv_length(ret); + PyObject *py_ret = PyList_New(count); + for(i = 0; i < count; ++i) + PyList_SetItem(py_ret, i, PyString_FromString(ret[i])); + g_strfreev(ret); + return py_ret; + } + Py_INCREF(Py_None); + return Py_None; +} +#line 435 "channel.c" + + +static PyObject * +_wrap_xfconf_channel_get(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "channel_name", NULL }; + char *channel_name; + XfconfChannel *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:channel_get", kwlist, &channel_name)) + return NULL; + + ret = xfconf_channel_get(channel_name); + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} + +static PyObject * +_wrap_xfconf_channel_new_with_property_base(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "channel_name", "property_base", NULL }; + char *channel_name, *property_base; + XfconfChannel *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ss:channel_new_with_property_base", kwlist, &channel_name, &property_base)) + return NULL; + + ret = xfconf_channel_new_with_property_base(channel_name, property_base); + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} + +const PyMethodDef pychannel_functions[] = { + { "list_channels", (PyCFunction)_wrap_xfconf_list_channels, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "channel_get", (PyCFunction)_wrap_xfconf_channel_get, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "channel_new_with_property_base", (PyCFunction)_wrap_xfconf_channel_new_with_property_base, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } +}; + +/* initialise stuff extension classes */ +void +pychannel_register_classes(PyObject *d) +{ + PyObject *module; + + if ((module = PyImport_ImportModule("gobject")) != NULL) { + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); + if (_PyGObject_Type == NULL) { + PyErr_SetString(PyExc_ImportError, + "cannot import name GObject from gobject"); + return ; + } + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gobject"); + return ; + } + + +#line 500 "channel.c" + pygobject_register_class(d, "XfconfChannel", XFCONF_TYPE_CHANNEL, &PyXfconfChannel_Type, Py_BuildValue("(O)", &PyGObject_Type)); +} diff --git a/xfconf/channel.defs b/xfconf/channel.defs new file mode 100644 index 0000000..9e81c17 --- /dev/null +++ b/xfconf/channel.defs @@ -0,0 +1,408 @@ +(define-object Channel + (in-module "Xfce") + (parent "GObject") + (c-name "XfconfChannel") + (gtype-id "XFCONF_TYPE_CHANNEL") +) + +(define-function list_channels + (c-name "xfconf_list_channels") + (return-type "gchar**") + (parameters + ) +) + +;; -*- scheme -*- +; object definitions ... +;; Enumerations and flags ... + + +;; From xfconf-channel.h + +(define-function channel_get_type + (c-name "xfconf_channel_get_type") + (return-type "GType") + (parameters + ) +) + +(define-function channel_get + (c-name "xfconf_channel_get") + (return-type "XfconfChannel*") + (parameters + '("const-gchar*" "channel_name") + ) +) + +(define-function channel_new + (c-name "xfconf_channel_new") + (is-constructor-of "XfconfChannel") + (return-type "XfconfChannel*") + (parameters + '("const-gchar*" "channel_name") + ) +) + +(define-function channel_new_with_property_base + (c-name "xfconf_channel_new_with_property_base") + (return-type "XfconfChannel*") + (parameters + '("const-gchar*" "channel_name") + '("const-gchar*" "property_base") + ) +) + +(define-method has_property + (of-object "XfconfChannel") + (c-name "xfconf_channel_has_property") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + ) +) + +(define-method is_property_locked + (of-object "XfconfChannel") + (c-name "xfconf_channel_is_property_locked") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + ) +) + +(define-method reset_property + (of-object "XfconfChannel") + (c-name "xfconf_channel_reset_property") + (return-type "none") + (parameters + '("const-gchar*" "property_base") + '("gboolean" "recursive") + ) +) + +(define-method get_properties + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_properties") + (return-type "GHashTable*") + (parameters + '("const-gchar*" "property_base") + ) +) + +(define-method get_string + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_string") + (return-type "gchar*") + (parameters + '("const-gchar*" "property") + '("const-gchar*" "default_value") + ) +) + +(define-method set_string + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_string") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gchar*" "value") + ) +) + +(define-method get_int + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_int") + (return-type "gint32") + (parameters + '("const-gchar*" "property") + '("gint32" "default_value") + ) +) + +(define-method set_int + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_int") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gint32" "value") + ) +) + +(define-method get_uint + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_uint") + (return-type "guint32") + (parameters + '("const-gchar*" "property") + '("guint32" "default_value") + ) +) + +(define-method set_uint + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_uint") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("guint32" "value") + ) +) + +(define-method get_uint64 + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_uint64") + (return-type "guint64") + (parameters + '("const-gchar*" "property") + '("guint64" "default_value") + ) +) + +(define-method set_uint64 + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_uint64") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("guint64" "value") + ) +) + +(define-method get_double + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_double") + (return-type "gdouble") + (parameters + '("const-gchar*" "property") + '("gdouble" "default_value") + ) +) + +(define-method set_double + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_double") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gdouble" "value") + ) +) + +(define-method get_bool + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_bool") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gboolean" "default_value") + ) +) + +(define-method set_bool + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_bool") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gboolean" "value") + ) +) + +(define-method get_string_list + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_string_list") + (return-type "gchar**") + (parameters + '("const-gchar*" "property") + ) +) + +(define-method set_string_list + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_string_list") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gchar*-const*" "values") + ) +) + +(define-method get_property + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_property") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GValue*" "value") + ) +) + +(define-method set_property + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_property") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-GValue*" "value") + ) +) + +(define-method get_array + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_array") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GType" "first_value_type") + ) + (varargs #t) +) + +(define-method get_array_valist + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_array_valist") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GType" "first_value_type") + '("va_list" "var_args") + ) +) + +(define-method get_arrayv + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_arrayv") + (return-type "GPtrArray*") + (parameters + '("const-gchar*" "property") + ) +) + +(define-method set_array + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_array") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GType" "first_value_type") + ) + (varargs #t) +) + +(define-method set_array_valist + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_array_valist") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GType" "first_value_type") + '("va_list" "var_args") + ) +) + +(define-method set_arrayv + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_arrayv") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("GPtrArray*" "values") + ) +) + +(define-method get_named_struct + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_named_struct") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gchar*" "struct_name") + '("gpointer" "value_struct") + ) +) + +(define-method set_named_struct + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_named_struct") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gchar*" "struct_name") + '("gpointer" "value_struct") + ) +) + +(define-method get_struct + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_struct") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gpointer" "value_struct") + '("GType" "first_member_type") + ) + (varargs #t) +) + +(define-method get_struct_valist + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_struct_valist") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gpointer" "value_struct") + '("GType" "first_member_type") + '("va_list" "var_args") + ) +) + +(define-method get_structv + (of-object "XfconfChannel") + (c-name "xfconf_channel_get_structv") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("gpointer" "value_struct") + '("guint" "n_members") + '("GType*" "member_types") + ) +) + +(define-method set_struct + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_struct") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gpointer" "value_struct") + '("GType" "first_member_type") + ) + (varargs #t) +) + +(define-method set_struct_valist + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_struct_valist") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gpointer" "value_struct") + '("GType" "first_member_type") + '("va_list" "var_args") + ) +) + +(define-method set_structv + (of-object "XfconfChannel") + (c-name "xfconf_channel_set_structv") + (return-type "gboolean") + (parameters + '("const-gchar*" "property") + '("const-gpointer" "value_struct") + '("guint" "n_members") + '("GType*" "member_types") + ) +) + + diff --git a/gui/filechooser.c b/xfconf/errors.c similarity index 54% copy from gui/filechooser.c copy to xfconf/errors.c index 406d953..5ff8ac0 100644 --- a/gui/filechooser.c +++ b/xfconf/errors.c @@ -4,15 +4,12 @@ -#line 6 "filechooser.override" +#line 6 "errors.override" #include "pygobject.h" -#include <gtk/gtk.h> -#include <libxfcegui4/libxfcegui4.h> -#include <libxfcegui4/gui-enum-types.h> +#include <glib.h> +#include <xfconf/xfconf.h> -#define XFCE_TYPE_FILE_CHOOSER_ACTION GUI_TYPE_FILE_CHOOSER_ACTION - -#line 16 "filechooser.c" +#line 13 "errors.c" /* ---------- types from other modules ---------- */ @@ -22,23 +19,26 @@ static PyTypeObject *_PyGObject_Type; /* ---------- forward type declarations ---------- */ -#line 26 "filechooser.c" +#line 23 "errors.c" /* ----------- functions ----------- */ -PyMethodDef pyfilechooser_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pyerrors_functions[] = { + { NULL, NULL, 0, NULL } }; /* ----------- enums and flags ----------- */ void -pyfilechooser_add_constants(PyObject *module, const gchar *strip_prefix) +pyerrors_add_constants(PyObject *module, const gchar *strip_prefix) { - pyg_enum_add(module, "FileChooserAction", strip_prefix, XFCE_TYPE_FILE_CHOOSER_ACTION); +#ifdef VERSION + PyModule_AddStringConstant(module, "__version__", VERSION); +#endif + pyg_enum_add(module, "Error", strip_prefix, XFCONF_TYPE_ERROR); if (PyErr_Occurred()) PyErr_Print(); @@ -46,25 +46,23 @@ pyfilechooser_add_constants(PyObject *module, const gchar *strip_prefix) /* initialise stuff extension classes */ void -pyfilechooser_register_classes(PyObject *d) +pyerrors_register_classes(PyObject *d) { 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 70 "filechooser.c" +#line 68 "errors.c" } diff --git a/xfconf/errors.defs b/xfconf/errors.defs new file mode 100644 index 0000000..9ba36e7 --- /dev/null +++ b/xfconf/errors.defs @@ -0,0 +1,40 @@ +;; -*- scheme -*- +; object definitions ... +;; Enumerations and flags ... + +(define-enum Error + (in-module "Xfconf") + (c-name "XfconfError") + (gtype-id "XFCONF_TYPE_ERROR") + (values + '("unknown" "XFCONF_ERROR_UNKNOWN") + '("channel-not-found" "XFCONF_ERROR_CHANNEL_NOT_FOUND") + '("property-not-found" "XFCONF_ERROR_PROPERTY_NOT_FOUND") + '("read-failure" "XFCONF_ERROR_READ_FAILURE") + '("write-failure" "XFCONF_ERROR_WRITE_FAILURE") + '("permission-denied" "XFCONF_ERROR_PERMISSION_DENIED") + '("internal-error" "XFCONF_ERROR_INTERNAL_ERROR") + '("no-backend" "XFCONF_ERROR_NO_BACKEND") + '("invalid-property" "XFCONF_ERROR_INVALID_PROPERTY") + '("invalid-channel" "XFCONF_ERROR_INVALID_CHANNEL") + ) +) + + +;; From xfconf-errors.h + +(define-function error_get_type + (c-name "xfconf_error_get_type") + (return-type "GType") + (parameters + ) +) + +(define-function get_error_quark + (c-name "xfconf_get_error_quark") + (return-type "GQuark") + (parameters + ) +) + + diff --git a/util/rc.c b/xfconf/types.c similarity index 66% copy from util/rc.c copy to xfconf/types.c index b400e14..45547d0 100644 --- a/util/rc.c +++ b/xfconf/types.c @@ -4,12 +4,12 @@ -#line 6 "rc.override" +#line 6 "types.override" #include "pygobject.h" -#include <gtk/gtk.h> -#include <libxfce4util/libxfce4util.h> +#include <glib.h> +#include <xfconf/xfconf.h> -#line 13 "rc.c" +#line 13 "types.c" /* ---------- types from other modules ---------- */ @@ -19,37 +19,35 @@ static PyTypeObject *_PyGObject_Type; /* ---------- forward type declarations ---------- */ -#line 23 "rc.c" +#line 23 "types.c" /* ----------- functions ----------- */ -PyMethodDef pyrc_functions[] = { - { NULL, NULL, 0 } +const PyMethodDef pytypes_functions[] = { + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ void -pyrc_register_classes(PyObject *d) +pytypes_register_classes(PyObject *d) { 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 "types.c" } diff --git a/xfconf/types.defs b/xfconf/types.defs new file mode 100644 index 0000000..c986923 --- /dev/null +++ b/xfconf/types.defs @@ -0,0 +1,56 @@ +;; -*- scheme -*- +; object definitions ... +;; Enumerations and flags ... + + +;; From xfconf-types.h + +(define-function uint16_get_type + (c-name "xfconf_uint16_get_type") + (return-type "GType") + (parameters + ) +) + +(define-function g_value_get_uint16 + (c-name "xfconf_g_value_get_uint16") + (return-type "guint16") + (parameters + '("const-GValue*" "value") + ) +) + +(define-function g_value_set_uint16 + (c-name "xfconf_g_value_set_uint16") + (return-type "none") + (parameters + '("GValue*" "value") + '("guint16" "v_uint16") + ) +) + +(define-function int16_get_type + (c-name "xfconf_int16_get_type") + (return-type "GType") + (parameters + ) +) + +(define-function g_value_get_int16 + (c-name "xfconf_g_value_get_int16") + (return-type "gint16") + (parameters + '("const-GValue*" "value") + ) +) + +(define-function g_value_set_int16 + (c-name "xfconf_g_value_set_int16") + (return-type "none") + (parameters + '("GValue*" "value") + '("gint16" "v_int16") + ) +) + + _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits