static PyObject * _wrap_gimp_thumbnail_has_failed(PyGObject *self) { int ret; ret = gimp_thumbnail_has_failed(GIMP_THUMBNAIL(self->obj)); return PyBool_FromLong(ret); }
static gboolean gimp_thumb_box_auto_thumbnail (GimpThumbBox *box) { Gimp *gimp = box->imagefile->gimp; GimpThumbnail *thumb = box->imagefile->thumbnail; const gchar *uri = gimp_object_get_name (GIMP_OBJECT (box->imagefile)); box->idle_id = 0; if (thumb->image_state == GIMP_THUMB_STATE_NOT_FOUND) return FALSE; switch (thumb->thumb_state) { case GIMP_THUMB_STATE_NOT_FOUND: case GIMP_THUMB_STATE_OLD: if (thumb->image_filesize < gimp->config->thumbnail_filesize_limit && ! gimp_thumbnail_has_failed (thumb) && file_procedure_find_by_extension (gimp->plug_in_manager->load_procs, uri)) { if (thumb->image_filesize > 0) { gchar *size; gchar *text; size = gimp_memsize_to_string (thumb->image_filesize); text = g_strdup_printf ("%s\n%s", size, _("Creating preview...")); gtk_label_set_text (GTK_LABEL (box->info), text); g_free (text); g_free (size); } else { gtk_label_set_text (GTK_LABEL (box->info), _("Creating preview...")); } gimp_imagefile_create_thumbnail_weak (box->imagefile, box->context, GIMP_PROGRESS (box), gimp->config->thumbnail_size, TRUE); } break; default: break; } return FALSE; }
static void gimp_thumb_box_create_thumbnail (GimpThumbBox *box, const gchar *uri, GimpThumbnailSize size, gboolean force, GimpProgress *progress) { gchar *filename = file_utils_filename_from_uri (uri); GimpThumbnail *thumb; gchar *basename; if (filename) { gboolean regular = g_file_test (filename, G_FILE_TEST_IS_REGULAR); g_free (filename); if (! regular) return; } thumb = gimp_imagefile_get_thumbnail (box->imagefile); basename = file_utils_uri_display_basename (uri); gtk_label_set_text (GTK_LABEL (box->filename), basename); g_free (basename); gimp_object_set_name (GIMP_OBJECT (box->imagefile), uri); if (force || (gimp_thumbnail_peek_thumb (thumb, size) < GIMP_THUMB_STATE_FAILED && ! gimp_thumbnail_has_failed (thumb))) { GError *error = NULL; if (! gimp_imagefile_create_thumbnail (box->imagefile, box->context, progress, size, ! force, &error)) { gimp_message_literal (box->context->gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR, error->message); g_clear_error (&error); } } }