summaryrefslogtreecommitdiffstats
path: root/pygtk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 00:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 00:06:44 +0000
commit44cf8ec67278bd1ab6c7f83a9993f7a5686a9541 (patch)
tree5eec4b0d1a3f163d279c3c27c03324ba49fa235a /pygtk
parentInitial commit. (diff)
downloadzbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.tar.xz
zbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.zip
Adding upstream version 0.23.93.upstream/0.23.93upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pygtk')
-rw-r--r--pygtk/Makefile.am.inc24
-rw-r--r--pygtk/zbarpygtk.override20
-rw-r--r--pygtk/zbarpygtkmodule.c46
3 files changed, 90 insertions, 0 deletions
diff --git a/pygtk/Makefile.am.inc b/pygtk/Makefile.am.inc
new file mode 100644
index 0000000..033d601
--- /dev/null
+++ b/pygtk/Makefile.am.inc
@@ -0,0 +1,24 @@
+pyexec_LTLIBRARIES += pygtk/zbarpygtk.la
+pygtk_zbarpygtk_la_CPPFLAGS = \
+ $(GTK_CFLAGS) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS) $(AM_CPPFLAGS)
+pygtk_zbarpygtk_la_LDFLAGS = -shared -module -avoid-version -export-dynamic \
+ -export-symbols-regex initzbarpygtk $(PYTHON_LDFLAGS)
+pygtk_zbarpygtk_la_LIBADD = \
+ $(PYGTK_LIBS) gtk/libzbargtk.la $(AM_LIBADD)
+
+pygtk_zbarpygtk_la_DEPENDENCIES = gtk/libzbargtk.la
+dist_pygtk_zbarpygtk_la_SOURCES = pygtk/zbarpygtkmodule.c
+nodist_pygtk_zbarpygtk_la_SOURCES = pygtk/zbarpygtk.c
+BUILT_SOURCES += pygtk/zbarpygtk.c pygtk/zbarpygtk.defs
+CLEANFILES += pygtk/zbarpygtk.c pygtk/zbarpygtk.defs
+EXTRA_DIST += pygtk/zbarpygtk.override
+
+# FIXME ugly hack to fixup new name... now non-standard?
+pygtk/zbarpygtk.defs: include/zbar/zbargtk.h
+ $(PYTHON) $(PYGTK_H2DEF) $< | \
+ $(SED) -e 's/Z_TYPE_BAR_/ZBAR_TYPE_/' > $@
+
+pygtk/%.c: pygtk/%.defs $(srcdir)/pygtk/zbarpygtk.override
+ $(PYGTK_CODEGEN) --prefix zbarpygtk \
+ --register $(PYGTK_DEFS)/gdk-types.defs \
+ --override $(srcdir)/pygtk/zbarpygtk.override $< > $@
diff --git a/pygtk/zbarpygtk.override b/pygtk/zbarpygtk.override
new file mode 100644
index 0000000..a66ceb9
--- /dev/null
+++ b/pygtk/zbarpygtk.override
@@ -0,0 +1,20 @@
+%%
+headers
+#include <Python.h>
+#include <pygobject.h>
+#include <zbar/zbargtk.h>
+%%
+modulename zbarpygtk
+%%
+import gtk.Widget as PyGtkWidget_Type
+import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
+%%
+ignore-type
+ ZBarGtkError
+%%
+ignore-glob
+ *_get_type
+%%
+ignore
+ zbar_gtk_image_from_pixbuf # until base library wrappers are in place
+%%
diff --git a/pygtk/zbarpygtkmodule.c b/pygtk/zbarpygtkmodule.c
new file mode 100644
index 0000000..5e354e7
--- /dev/null
+++ b/pygtk/zbarpygtkmodule.c
@@ -0,0 +1,46 @@
+/*------------------------------------------------------------------------
+ * Copyright 2008-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+ *
+ * This file is part of the ZBar Bar Code Reader.
+ *
+ * The ZBar Bar Code Reader is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * The ZBar Bar Code Reader 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 Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with the ZBar Bar Code Reader; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * http://sourceforge.net/projects/zbar
+ *------------------------------------------------------------------------*/
+
+/* avoid "multiple definition" darwin link errors
+ * for symbols defined in pygobject.h (bug #2052681)
+ */
+#define NO_IMPORT_PYGOBJECT
+
+#include <pygobject.h>
+
+void zbarpygtk_register_classes(PyObject *);
+extern PyMethodDef zbarpygtk_functions[];
+
+DL_EXPORT(void)
+initzbarpygtk(void)
+{
+ init_pygobject();
+
+ PyObject *mod = Py_InitModule("zbarpygtk", zbarpygtk_functions);
+ PyObject *dict = PyModule_GetDict(mod);
+
+ zbarpygtk_register_classes(dict);
+
+ if (PyErr_Occurred())
+ Py_FatalError("unable to initialise module zbarpygtk");
+}