[Xfce4-commits] <pyxfce:master> init xfconf, add list_channels.
Danny Milosavljevic
noreply at xfce.org
Tue Dec 28 23:52:01 CET 2010
Updating branch refs/heads/master
to ed71ded18db1b056936cb44537aea2a84e640a76 (commit)
from 815985420f03d4b020a24037861829a0a86ddb62 (commit)
commit ed71ded18db1b056936cb44537aea2a84e640a76
Author: Danny Milosavljevic <dannym at xfce.org>
Date: Tue Dec 28 23:48:50 2010 +0100
init xfconf, add list_channels.
xfconf/channel.override | 23 +++++++++++++++++++++++
xfconf/gen | 8 ++++++++
xfconf/xfconfmodule.c | 6 ++++++
3 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/xfconf/channel.override b/xfconf/channel.override
index fa9bf76..c17574f 100644
--- a/xfconf/channel.override
+++ b/xfconf/channel.override
@@ -21,3 +21,26 @@ ignore-glob
%%
ignore-win32
%%
+override xfconf_list_channels kwargs
+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;
+}
diff --git a/xfconf/gen b/xfconf/gen
index bfe32eb..ad3f8fc 100755
--- a/xfconf/gen
+++ b/xfconf/gen
@@ -41,6 +41,14 @@ cat >P << EOF
(c-name "XfconfChannel")
(gtype-id "XFCONF_TYPE_CHANNEL")
)
+
+(define-function list_channels
+ (c-name "xfconf_list_channels")
+ (return-type "gchar**")
+ (parameters
+ )
+)
+
EOF
cat P channel.defs > channel.defs.new && mv channel.defs.new channel.defs
diff --git a/xfconf/xfconfmodule.c b/xfconf/xfconfmodule.c
index 597538b..5cf0de0 100644
--- a/xfconf/xfconfmodule.c
+++ b/xfconf/xfconfmodule.c
@@ -64,10 +64,16 @@ my_register1()
DL_EXPORT(void)
init_xfconf(void)
{
+ GError* error = NULL;
+
/* set the default python encoding to utf-8 */
PyUnicode_SetDefaultEncoding("utf-8");
init_pygobject ();
+ if(!xfconf_init(&error)) {
+ fprintf (stderr, "Unable to initialize xfconf: %s\n", error->message);
+ g_error_free(error);
+ }
my_register1 ();
}
More information about the Xfce4-commits
mailing list