/** * gimp_thumbnail_save_thumb_local: * @thumbnail: a #GimpThumbnail object * @pixbuf: a #GdkPixbuf representing the preview thumbnail * @software: a string describing the software saving the thumbnail * @error: return location for possible errors * * Saves a preview thumbnail for the image associated with @thumbnail * to the local thumbnail repository. Local thumbnails have been added * with version 0.7 of the spec. * * Please see also gimp_thumbnail_save_thumb(). The notes made there * apply here as well. * * Return value: %TRUE if a thumbnail was successfully written, * %FALSE otherwise * * Since: 2.2 **/ gboolean gimp_thumbnail_save_thumb_local (GimpThumbnail *thumbnail, GdkPixbuf *pixbuf, const gchar *software, GError **error) { GimpThumbSize size; gchar *name; gchar *filename; gchar *dirname; gboolean success; g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE); g_return_val_if_fail (thumbnail->image_uri != NULL, FALSE); g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE); g_return_val_if_fail (software != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); GIMP_THUMB_DEBUG_CALL (thumbnail); size = MAX (gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf)); if (size < 1) return TRUE; filename = _gimp_thumb_filename_from_uri (thumbnail->image_uri); if (! filename) return TRUE; dirname = g_path_get_dirname (filename); g_free (filename); name = gimp_thumb_name_from_uri_local (thumbnail->image_uri, size); if (! name) { g_free (dirname); return TRUE; } if (! gimp_thumb_ensure_thumb_dir_local (dirname, size, error)) { g_free (name); g_free (dirname); return FALSE; } g_free (dirname); success = gimp_thumbnail_save (thumbnail, size, name, pixbuf, software, error); g_free (name); return success; }
static PyObject * _wrap_gimp_thumb_ensure_thumb_dir_local(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "dirname", "size", NULL }; char *dirname; PyObject *py_size = NULL; int ret; GError *error = NULL; GimpThumbSize size; if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sO:ensure_thumb_dir_local", kwlist, &dirname, &py_size)) return NULL; if (pyg_enum_get_value(GIMP_TYPE_THUMB_SIZE, py_size, (gpointer)&size)) return NULL; ret = gimp_thumb_ensure_thumb_dir_local(dirname, size, &error); if (pyg_error_check(&error)) return NULL; return PyBool_FromLong(ret); }