summaryrefslogtreecommitdiffstats
path: root/bindings/python/gpod.i.in
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/gpod.i.in')
-rw-r--r--bindings/python/gpod.i.in43
1 files changed, 25 insertions, 18 deletions
diff --git a/bindings/python/gpod.i.in b/bindings/python/gpod.i.in
index f8364eb..b7da152 100644
--- a/bindings/python/gpod.i.in
+++ b/bindings/python/gpod.i.in
@@ -47,6 +47,7 @@ version = '.'.join(map(str, version_info))
%module(docstring=DOCSTRING) gpod
%{
+#include "@top_builddir@/config.h"
#include "db-artwork-debug.h"
#include "db-artwork-parser.h"
#include "db-image-parser.h"
@@ -55,7 +56,12 @@ version = '.'.join(map(str, version_info))
#include "itdb.h"
#include "itdb_device.h"
#include "itdb_private.h"
+#ifdef HAVE_GDKPIXBUF
+#ifdef HAVE_PYGOBJECT
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <pygobject.h>
+#endif
+#endif
/* include prototypes for all functions so builds using
@@ -77,7 +83,6 @@ PyObject* sw_get_photo(GList *list, gint index);
PyObject* sw_get_artwork_thumbnails(Itdb_Artwork *artwork);
PyObject* sw_get_photoalbum_members(Itdb_PhotoAlbum *album);
PyObject* sw_ipod_device_to_dict(Itdb_Device *device);
-PyObject* sw_save_itdb_thumb(Itdb_PhotoDB *itdb, Itdb_Thumb *thumb, const gchar *filename);
void sw__track_extra_destroy (PyObject *data);
void hash_table_to_pydict(gpointer key, gpointer value, gpointer user_data);
void SWIG_init(void);
@@ -287,29 +292,19 @@ PyObject* sw_get_photo(GList *list, gint index) {
}
}
- PyObject* sw_save_itdb_thumb(Itdb_PhotoDB *itdb, Itdb_Thumb *thumb, const gchar *filename) {
- GdkPixbuf *pixbuf;
-
- pixbuf = itdb_thumb_get_gdk_pixbuf (itdb->device, thumb);
-
- if (pixbuf != NULL) {
- gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL);
- gdk_pixbuf_unref (pixbuf);
- Py_INCREF(Py_True);
- return Py_True;
- } else {
- Py_INCREF(Py_False);
- return Py_False;
- }
- }
-
%}
%init %{
+#ifdef HAVE_GDKPIXBUF
+#ifdef HAVE_PYGOBJECT
g_type_init ();
+ init_pygobject ();
+#endif
+#endif
%}
%include "gpod_doc.i"
+%include "@top_builddir@/config.h"
# be nicer to decode these utf8 strings into Unicode objects in the C
# layer. Here we are leaving it to the Python side, and just giving
@@ -436,6 +431,19 @@ typedef long time_t;
typedef int gboolean;
typedef int gint;
+#ifdef HAVE_GDKPIXBUF
+#ifdef HAVE_PYGOBJECT
+%typemap(out) gpointer itdb_thumb_get_gdk_pixbuf {
+ $result = pygobject_new((GObject *)$1);
+ g_object_unref($1);
+}
+
+%typemap(in) gpointer pixbuf {
+ $1 = GDK_PIXBUF(pygobject_get($input));
+}
+#endif
+#endif
+
#define G_BEGIN_DECLS
#define G_END_DECLS
@@ -455,6 +463,5 @@ PyObject* sw_get_photo(GList *list, gint index);
PyObject* sw_get_photoalbum_members(Itdb_PhotoAlbum *album);
PyObject* sw_get_artwork_thumbnails(Itdb_Artwork *artwork);
PyObject* sw_ipod_device_to_dict(Itdb_Device *device);
-PyObject* sw_save_itdb_thumb(Itdb_PhotoDB *itdb, Itdb_Thumb *thumb, const gchar *filename);
%include "@top_srcdir@/src/itdb.h"