[Xfce4-commits] <pyxfce:master> add xfconf support.
Danny Milosavljevic
noreply at xfce.org
Tue Dec 28 23:38:01 CET 2010
Updating branch refs/heads/master
to 815985420f03d4b020a24037861829a0a86ddb62 (commit)
from cff81899796df74e8ac7ee478e829588b117e8de (commit)
commit 815985420f03d4b020a24037861829a0a86ddb62
Author: Danny Milosavljevic <dannym at xfce.org>
Date: Tue Dec 28 23:34:54 2010 +0100
add xfconf support.
Makefile.am | 4 +-
configure.ac | 3 +-
netk/gen | 2 +-
xfconf/Makefile.am | 55 ++++++++++++++
netk/template.override => xfconf/binding.override | 6 +-
netk/template.override => xfconf/channel.override | 6 +-
netk/template.override => xfconf/errors.override | 6 +-
xfconf/gen | 55 ++++++++++++++
netk/template.override => xfconf/types.override | 6 +-
netk/netk.py => xfconf/xfconf.py | 3 +-
netk/netkmodule.c => xfconf/xfconfmodule.c | 83 ++++++---------------
11 files changed, 152 insertions(+), 77 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a642c1d..810c84d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,8 +13,8 @@ if HAVE_MIGHTY_MOUSE
SUBDIR_MIGHTY_MOUSE = panel
endif
-SUBDIRS = gui netk util $(SUBDIR_MIGHTY_MOUSE)
-DIST_SUBDIRS = gui netk util $(SUBDIR_MIGHTY_MOUSE)
+SUBDIRS = gui netk util xfconf $(SUBDIR_MIGHTY_MOUSE)
+DIST_SUBDIRS = gui netk util xfconf $(SUBDIR_MIGHTY_MOUSE)
PLATFORM_VERSION = 4.2
PLATFORM_WIN32 =
diff --git a/configure.ac b/configure.ac
index fee8f0a..fe10f1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ dnl get rid of the -export-dynamic stuff from the configure flags ...
export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
BM_DEPEND([XFCE4_UTIL], [libxfce4util-1.0], [4.1.0])
-
+BM_DEPEND([XFCE4_XFCONF], [libxfconf-0], [4.6.2])
BM_DEPEND([XFCE4_GUI], [libxfcegui4-1.0], [4.3.90])
# new panel
@@ -88,5 +88,6 @@ AC_CONFIG_FILES(
netk/Makefile
panel/Makefile
util/Makefile
+ xfconf/Makefile
)
AC_OUTPUT
diff --git a/netk/gen b/netk/gen
index fb9c452..f1af90b 100755
--- a/netk/gen
+++ b/netk/gen
@@ -17,7 +17,7 @@ do
#echo "${defs}"
- python /usr/share/pygtk/2.0/codegen/h2def.py "$s" >"${defs}"
+ python /usr/lib/python2.6/site-packages/gtk-2.0/codegen/h2def.py "$s" >"${defs}"
fi
done
rm -f util.defs
diff --git a/xfconf/Makefile.am b/xfconf/Makefile.am
new file mode 100644
index 0000000..09d0e00
--- /dev/null
+++ b/xfconf/Makefile.am
@@ -0,0 +1,55 @@
+ at SET_MAKE@
+
+PLATFORM_VERSION = 4.2
+
+common_ldflags = -module -avoid-version -export-symbols-regex init_xfconf
+if PLATFORM_WIN32
+common_ldflags += -no-undefined
+endif
+
+INCLUDES = $(PYTHON_INCLUDES)
+
+CODEGEN_PATH = @CODEGEN_PATH@
+
+pyxfceexecdir = $(pyexecdir)/xfce4
+pyxfceexec_LTLIBRARIES = _xfconf.la
+pyxfceexec_PYTHON = xfconf.py
+_xfconf_la_CFLAGS = $(XFCE4_XFCONF_CFLAGS) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS)
+_xfconf_la_LDFLAGS = $(common_ldflags)
+_xfconf_la_LIBADD = $(XFCE4_XFCONF_LIBS) $(PYTHON_LIBS)
+_xfconf_la_SOURCES = \
+ binding.c \
+ channel.c \
+ errors.c \
+ types.c \
+ xfconfmodule.c
+
+defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs
+defs_DATA = \
+ binding.defs \
+ channel.defs \
+ errors.defs \
+ types.defs
+
+xfconf_overrides = binding.override channel.override errors.override types.override
+
+EXTRA_DIST = $(defs_DATA) $(xfconf_overrides) gen
+nodist__xfconf_la_SOURCES =
+
+PYGTK_DEFS="`pkg-config --variable=defsdir pygtk-2.0`"
+
+.defs.c:
+ (cd $(srcdir) \
+ && $(PYTHON) $(CODEGEN_PATH)/codegen.py \
+ $(PYGTK_CODEGEN_DEFINES) \
+ --override $*.override \
+ --register $(PYGTK_DEFS)/gtk-types.defs \
+ --register $(PYGTK_DEFS)/gdk-types.defs \
+ --register binding.defs \
+ --register channel.defs \
+ --register errors.defs \
+ --register types.defs \
+ --prefix py$* $*.defs) > gen-$*.c \
+ && cp gen-$*.c $*.c \
+ && rm -f gen-$*.c
+
diff --git a/netk/template.override b/xfconf/binding.override
similarity index 73%
copy from netk/template.override
copy to xfconf/binding.override
index 0a4011a..fa9bf76 100644
--- a/netk/template.override
+++ b/xfconf/binding.override
@@ -4,13 +4,13 @@
%%
headers
#include "pygobject.h"
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <glib.h>
+#include <xfconf/xfconf.h>
%%
include
%%
-modulename *
+modulename classgroup
%%
import gobject.GObject as PyGObject_Type
%%
diff --git a/netk/template.override b/xfconf/channel.override
similarity index 73%
copy from netk/template.override
copy to xfconf/channel.override
index 0a4011a..fa9bf76 100644
--- a/netk/template.override
+++ b/xfconf/channel.override
@@ -4,13 +4,13 @@
%%
headers
#include "pygobject.h"
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <glib.h>
+#include <xfconf/xfconf.h>
%%
include
%%
-modulename *
+modulename classgroup
%%
import gobject.GObject as PyGObject_Type
%%
diff --git a/netk/template.override b/xfconf/errors.override
similarity index 73%
copy from netk/template.override
copy to xfconf/errors.override
index 0a4011a..fa9bf76 100644
--- a/netk/template.override
+++ b/xfconf/errors.override
@@ -4,13 +4,13 @@
%%
headers
#include "pygobject.h"
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <glib.h>
+#include <xfconf/xfconf.h>
%%
include
%%
-modulename *
+modulename classgroup
%%
import gobject.GObject as PyGObject_Type
%%
diff --git a/xfconf/gen b/xfconf/gen
new file mode 100755
index 0000000..bfe32eb
--- /dev/null
+++ b/xfconf/gen
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+inc="`pkg-config --variable=includedir libxfconf-0`"/xfce4
+
+for s in "${inc}"/xfconf-0/xfconf/*.h
+do
+ #echo "XX $s"
+ t="${s##*/}"
+
+ t="${t%.h}"
+
+ if [ "${t#xfconf-}" != "$t" ]
+ then
+ defs="${t/-/_}.defs"
+ defs="${defs/-/_}"
+ defs="${defs/-/_}"
+
+ #echo "${defs}"
+
+ python2 /usr/lib/python2.6/site-packages/gtk-2.0/codegen/h2def.py "$s" >"${defs}"
+ fi
+done
+rm -f util.defs
+
+for s in xfconf_*.defs
+do
+ t="${s#xfconf_}"
+ mv "$s" "$t"
+done
+
+#mmv -o 'xfce-*.defs' '#1.defs'
+#rm -f libxfce4util.defs
+#rm -f libxfce4util-config.defs
+#rm -f generics.defs
+#rm -f debug.defs
+
+cat >P << EOF
+(define-object Channel
+ (in-module "Xfce")
+ (parent "GObject")
+ (c-name "XfconfChannel")
+ (gtype-id "XFCONF_TYPE_CHANNEL")
+)
+EOF
+cat P channel.defs > channel.defs.new && mv channel.defs.new channel.defs
+
+
+for s in *.defs
+do
+ if [ "$s" != "*.defs" ]
+ then
+ sed -e 's;(define-function xfconf_;(define-function ;' "$s" >"${s}.new" && mv "${s}.new" "$s"
+ fi
+done
+
diff --git a/netk/template.override b/xfconf/types.override
similarity index 73%
copy from netk/template.override
copy to xfconf/types.override
index 0a4011a..fa9bf76 100644
--- a/netk/template.override
+++ b/xfconf/types.override
@@ -4,13 +4,13 @@
%%
headers
#include "pygobject.h"
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <glib.h>
+#include <xfconf/xfconf.h>
%%
include
%%
-modulename *
+modulename classgroup
%%
import gobject.GObject as PyGObject_Type
%%
diff --git a/netk/netk.py b/xfconf/xfconf.py
similarity index 50%
copy from netk/netk.py
copy to xfconf/xfconf.py
index bfefdba..8567ca0 100644
--- a/netk/netk.py
+++ b/xfconf/xfconf.py
@@ -1,3 +1,4 @@
#!/usr/bin/env python
-from _netk import *
+from _xfconf import *
+
diff --git a/netk/netkmodule.c b/xfconf/xfconfmodule.c
similarity index 52%
copy from netk/netkmodule.c
copy to xfconf/xfconfmodule.c
index d119fe5..597538b 100644
--- a/netk/netkmodule.c
+++ b/xfconf/xfconfmodule.c
@@ -11,50 +11,23 @@
#include <pygobject.h>
#include <pyerrors.h>
-extern PyMethodDef pyapplication_functions[];
-extern PyMethodDef pyclass_group_functions[];
-extern PyMethodDef pyenum_types_functions[];
-extern PyMethodDef pypager_functions[];
-extern PyMethodDef pyscreen_functions[];
-extern PyMethodDef pytasklist_functions[];
-extern PyMethodDef pytrayicon_functions[];
-extern PyMethodDef pyutil_functions[];
-extern PyMethodDef pywindow_action_menu_functions[];
-extern PyMethodDef pywindow_functions[];
-extern PyMethodDef pywindow_menu_functions[];
-extern PyMethodDef pyworkspace_functions[];
-void pyapplication_register_classes(PyObject *d);
-void pyclass_group_register_classes(PyObject *d);
-void pyenum_types_register_classes(PyObject *d);
-void pypager_register_classes(PyObject *d);
-void pyscreen_register_classes(PyObject *d);
-void pytasklist_register_classes(PyObject *d);
-void pytrayicon_register_classes(PyObject *d);
-void pyutil_register_classes(PyObject *d);
-void pywindow_action_menu_register_classes(PyObject *d);
-void pywindow_register_classes(PyObject *d);
-void pywindow_menu_register_classes(PyObject *d);
-void pyworkspace_register_classes(PyObject *d);
-
-void pywindow_add_constants(PyObject *module, const gchar *strip_prefix);
-void pypager_add_constants(PyObject *module, const gchar *strip_prefix);
-void pytasklist_add_constants(PyObject *module, const gchar *strip_prefix);
+extern const PyMethodDef pybinding_functions[];
+extern const PyMethodDef pychannel_functions[];
+extern const PyMethodDef pyerrors_functions[];
+extern const PyMethodDef pytypes_functions[];
+void pybinding_register_classes(PyObject *d);
+void pychannel_register_classes(PyObject *d);
+void pyerrors_register_classes(PyObject *d);
+void pytypes_register_classes(PyObject *d);
+void pyerrors_add_constants(PyObject *module, const gchar *strip_prefix);
static PyMethodDef all_functions[1000];
-static PyMethodDef* each_functions[] = {
- pyapplication_functions,
- pyclass_group_functions,
- pyenum_types_functions,
- pypager_functions,
- pyscreen_functions,
- pytasklist_functions,
- pytrayicon_functions,
- pyutil_functions,
- pywindow_action_menu_functions,
- pywindow_functions,
- pywindow_menu_functions,
- pyworkspace_functions,
+static const PyMethodDef* each_functions[] = {
+ pybinding_functions,
+ pychannel_functions,
+ pyerrors_functions,
+ pytypes_functions,
};
static void
@@ -78,28 +51,18 @@ my_register1()
}
}
- m = Py_InitModule("_netk", all_functions);
- pywindow_add_constants(m, "NETK_");
- pypager_add_constants(m, "NETK_");
- pytasklist_add_constants(m, "NETK_");
+ m = Py_InitModule("_xfconf", all_functions);
+ pyerrors_add_constants(m, "XFCONF_");
d = PyModule_GetDict(m);
- pyapplication_register_classes (d);
- pyclass_group_register_classes (d);
- pyenum_types_register_classes (d);
- pypager_register_classes (d);
- pyscreen_register_classes (d);
- pytasklist_register_classes (d);
- pytrayicon_register_classes (d);
- pyutil_register_classes (d);
- pywindow_action_menu_register_classes (d);
- pywindow_register_classes (d);
- pywindow_menu_register_classes (d);
- pyworkspace_register_classes (d);
+ pybinding_register_classes(d);
+ pychannel_register_classes(d);
+ pyerrors_register_classes(d);
+ pytypes_register_classes(d);
}
DL_EXPORT(void)
-init_netk(void)
+init_xfconf(void)
{
/* set the default python encoding to utf-8 */
PyUnicode_SetDefaultEncoding("utf-8");
@@ -115,7 +78,7 @@ my_register(char const *name, PyMethodDef afunctions[], void (aregister)(PyObjec
{
PyObject *m, *d;
char tmp[2049];
- snprintf (tmp, 2049, "netk.%s", name);
+ snprintf (tmp, 2049, "xfconf.%s", name);
m = Py_InitModule(tmp, afunctions);
d = PyModule_GetDict(m);
(*aregister)(d);
@@ -123,7 +86,7 @@ my_register(char const *name, PyMethodDef afunctions[], void (aregister)(PyObjec
}
DL_EXPORT(void)
-init_netk(void)
+init_xfconf(void)
{
/* set the default python encoding to utf-8 */
PyUnicode_SetDefaultEncoding("utf-8");
More information about the Xfce4-commits
mailing list