summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Frécinaux <code@istique.net>2009-12-21 00:16:16 +0100
committerSteve Frécinaux <code@istique.net>2009-12-21 10:48:32 +0100
commit21408484d22e6c0c121c248b3d9db91356b4315b (patch)
tree298d202567df19fdce0ed2250208a14f3708b8bc
parentd8729ea04f41addf93feb4ba02446775ac942dc2 (diff)
downloadlibpeas-21408484d22e6c0c121c248b3d9db91356b4315b.tar.gz
Add python bindings for libpeasui.
-rw-r--r--.gitignore2
-rw-r--r--loaders/python/bindings/Makefile.am74
-rw-r--r--loaders/python/bindings/libpeasui.override14
-rw-r--r--loaders/python/bindings/libpeasuimodule.c54
4 files changed, 129 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index 264adb7..935da60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,8 @@ Makefile.in
/intltool-update.in
/loaders/python/bindings/libpeas.defs
/loaders/python/bindings/libpeas.c
+/loaders/python/bindings/libpeasui.defs
+/loaders/python/bindings/libpeasui.c
/libtool
/ltmain.sh
/m4
diff --git a/loaders/python/bindings/Makefile.am b/loaders/python/bindings/Makefile.am
index 8a52fc5..2b9ab5a 100644
--- a/loaders/python/bindings/Makefile.am
+++ b/loaders/python/bindings/Makefile.am
@@ -1,10 +1,14 @@
-BINDINGS_HDRS = \
+PEAS_BINDINGS_HDRS = \
$(top_srcdir)/libpeas/peas-plugin.h \
- $(top_srcdir)/libpeas/peas-plugin-info.h \
+ $(top_srcdir)/libpeas/peas-plugin-info.h \
$(top_srcdir)/libpeas/peas-engine.h
+PEAS_UI_BINDINGS_HDRS = \
+ $(top_srcdir)/libpeasui/peas-ui-plugin-manager.h
+
pyexec_LTLIBRARIES = \
- libpeas.la
+ libpeas.la \
+ libpeasui.la
libpeas_la_SOURCES = \
libpeasmodule.c
@@ -12,28 +16,49 @@ libpeas_la_SOURCES = \
nodist_libpeas_la_SOURCES = \
libpeas.c
-libpeas_la_LDFLAGS = \
+libpeasui_la_SOURCES = \
+ libpeasuimodule.c
+
+nodist_libpeasui_la_SOURCES = \
+ libpeasui.c
+
+AM_LDFLAGS = \
-module -avoid-version \
-export-symbol-regex initlibpeas
-libpeas_la_LIBADD = \
+libpeas_la_LDFLAGS = $(AM_LIBADD)
+libpeasui_la_LDFLAGS = $(AM_LIBADD)
+
+AM_LIBADD = \
$(top_builddir)/libpeas/libpeas-2.0.la \
+ $(PEAS_LIBS) \
$(PYTHON_LIB_LOC) \
$(PYTHON_LIBS) \
$(PYTHON_EXTRA_LIBS) \
$(PYGTK_LIBS)
-libpeas_la_CFLAGS = \
+libpeas_la_LIBADD = $(AM_LIBADD)
+libpeasui_la_LIBADD = \
+ $(AM_LIBADD) \
+ $(top_builddir)/libpeasui/libpeasui-2.0.la \
+ $(PEASUI_LIBS)
+
+AM_CFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
$(PEAS_CFLAGS) \
$(NO_STRICT_ALIASING_CFLAGS) \
$(PYGTK_CFLAGS) \
- $(PYTHON_CFLAGS) \
- $(AM_CFLAGS)
+ $(PYTHON_CFLAGS)
+
+libpeas_la_CFLAGS = $(AM_CFLAGS)
+libpeasui_la_CFLAGS = $(AM_CFLAGS) $(PEASUI_CFLAGS)
-libpeas.defs: $(BINDINGS_HDRS) libpeas.defs.extra
- $(AM_V_GEN) ( $(PYGTK_H2DEF) -n Peas $(BINDINGS_HDRS); cat $(srcdir)/libpeas.defs.extra ) > $@
+libpeas.defs: $(PEAS_BINDINGS_HDRS) libpeas.defs.extra
+ $(AM_V_GEN) ( $(PYGTK_H2DEF) \
+ --namespace Peas \
+ $(PEAS_BINDINGS_HDRS); \
+ cat $(srcdir)/libpeas.defs.extra ) > $@
libpeas.c: libpeas.defs libpeas.override
$(AM_V_GEN) ( $(PYGTK_CODEGEN) \
@@ -42,16 +67,35 @@ libpeas.c: libpeas.defs libpeas.override
--prefix pypeas \
libpeas.defs ) > $@
+libpeasui.defs: $(PEAS_UI_BINDINGS_HDRS)
+ $(AM_V_GEN) ( $(PYGTK_H2DEF) \
+ --modulename peas_ui \
+ --namespace PeasUI \
+ $(PEAS_UI_BINDINGS_HDRS) \
+ | sed 's/PEASUI/PEAS_UI/' ) > $@
+
+libpeasui.c: libpeasui.defs libpeasui.override
+ $(AM_V_GEN) ( $(PYGTK_CODEGEN) \
+ --register $(PYGTK_DEFSDIR)/gtk-types.defs \
+ --register libpeas.defs \
+ --override $(srcdir)/libpeasui.override \
+ --prefix pypeasui \
+ libpeasui.defs ) > $@
+
defsdir = $(datadir)/pygtk/2.0/defs
-defs_DATA = libpeas.defs
+defs_DATA = \
+ libpeas.defs \
+ libpeasui.defs
BUILT_SOURCES = \
- libpeas.defs \
- libpeas.c
+ $(nodist_libpeas_la_SOURCES) \
+ $(nodist_libpeasui_la_SOURCES) \
+ $(defs_DATA)
EXTRA_DIST = \
- libpeas.override \
- libpeas.defs.extra
+ libpeas.override \
+ libpeas.defs.extra \
+ libpeasui.override
CLEANFILES = $(BUILT_SOURCES)
diff --git a/loaders/python/bindings/libpeasui.override b/loaders/python/bindings/libpeasui.override
new file mode 100644
index 0000000..bb4036f
--- /dev/null
+++ b/loaders/python/bindings/libpeasui.override
@@ -0,0 +1,14 @@
+%%
+modulename libpeasui
+%%
+ignore-glob
+ *_get_type
+%%
+import gtk.VBox as PyGtkVBox_Type
+%%
+headers
+#define NO_IMPORT
+#include "pygobject.h"
+#include <pygtk/pygtk.h>
+
+#include <libpeasui/peas-ui-plugin-manager.h>
diff --git a/loaders/python/bindings/libpeasuimodule.c b/loaders/python/bindings/libpeasuimodule.c
new file mode 100644
index 0000000..97b18fe
--- /dev/null
+++ b/loaders/python/bindings/libpeasuimodule.c
@@ -0,0 +1,54 @@
+/*
+ * libpeasmodule.c
+ * This file is part of libpeas
+ *
+ * Copyright (C) 2009 - Steve Frécinaux
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#include <Python.h>
+#include <pyglib.h>
+#include <pygobject.h>
+#include <pygtk/pygtk.h>
+
+#include "config.h"
+
+void pypeasui_register_classes (PyObject *d);
+extern PyMethodDef pypeasui_functions[];
+
+DL_EXPORT(void)
+initlibpeasui (void)
+{
+ PyObject *m, *d;
+ PyObject *tuple;
+
+ m = Py_InitModule ("libpeasui", pypeasui_functions);
+ d = PyModule_GetDict (m);
+
+ init_pygobject_check (2, 16, 2);
+ init_pygtk ();
+
+ pypeasui_register_classes (d);
+
+ /* libpeas version */
+ tuple = Py_BuildValue ("(iii)",
+ PEAS_MAJOR_VERSION,
+ PEAS_MINOR_VERSION,
+ PEAS_MICRO_VERSION);
+ PyDict_SetItemString (d, "version", tuple);
+ Py_DECREF (tuple);
+}