From 5c1676dfe6d2f3c837a5e074117b45613fd29a72 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:30:19 +0200 Subject: Adding upstream version 2.10.34. Signed-off-by: Daniel Baumann --- plug-ins/pygimp/gimpthumb.override | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 plug-ins/pygimp/gimpthumb.override (limited to 'plug-ins/pygimp/gimpthumb.override') diff --git a/plug-ins/pygimp/gimpthumb.override b/plug-ins/pygimp/gimpthumb.override new file mode 100644 index 0000000..c43e539 --- /dev/null +++ b/plug-ins/pygimp/gimpthumb.override @@ -0,0 +1,102 @@ +%% +headers +#include + +#define NO_IMPORT_PYGOBJECT +#include + +#include + +#include + +/* TODO: Add a header for these */ +void gimpthumb_register_classes(PyObject *d); +void gimpthumb_add_constants(PyObject *module, const gchar *strip_prefix); +%% +modulename gimpthumb +%% +import gobject.GObject as PyGObject_Type +import gtk.gdk.Pixbuf as PyGdkPixbuf_Type +%% +ignore-glob + *_get_type +%% +override gimp_thumb_init kwargs +static PyObject * +_wrap_gimp_thumb_init(PyObject *self, PyObject *args, PyObject *kwargs) +{ + char *creator, *thumb_basedir = NULL; + + static char *kwlist[] = { "creator", "thumb_basedir", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s|z:init", kwlist, + &creator, &thumb_basedir)) + return NULL; + + return PyBool_FromLong(gimp_thumb_init(creator, thumb_basedir)); +} +%% +override gimp_thumb_find_thumb kwargs +static PyObject * +_wrap_gimp_thumb_find_thumb(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + gchar *uri, *ret; + PyObject *py_size, *py_ret; + GimpThumbSize size; + + static char *kwlist[] = { "uri", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:find_thumb", kwlist, + &uri, &py_size)) + return NULL; + + if (pyg_enum_get_value(GIMP_TYPE_THUMB_SIZE, py_size, (gint *)&size)) + return NULL; + + ret = gimp_thumb_find_thumb(uri, &size); + + if (ret == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + + py_ret = Py_BuildValue("sN", ret, + pyg_enum_from_gtype(GIMP_TYPE_THUMB_SIZE, size)); + g_free(ret); + return py_ret; +} +%% +override gimp_thumb_file_test kwargs +static PyObject * +_wrap_gimp_thumb_file_test(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + gchar *filename; + GimpThumbFileType ret; + gint64 mtime, size; + gint err_no; + + static char *kwlist[] = { "filename", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:file_test", kwlist, + &filename)) + return NULL; + + ret = gimp_thumb_file_test(filename, &mtime, &size, &err_no); + + if (ret == GIMP_THUMB_FILE_TYPE_NONE) { + PyObject *v = Py_BuildValue("iss", + err_no, g_strerror(err_no), filename); + if (v != NULL) { + PyErr_SetObject(PyExc_IOError, v); + Py_DECREF(v); + } + + return NULL; + } + + return Py_BuildValue("NNN", + pyg_enum_from_gtype(GIMP_TYPE_THUMB_FILE_TYPE, ret), + PyLong_FromLongLong(mtime), + PyLong_FromLongLong(size)); +} -- cgit v1.2.3