summaryrefslogtreecommitdiffstats
path: root/libgimpthumb
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:13:10 +0000
commit3c57dd931145d43f2b0aef96c4d178135956bf91 (patch)
tree3de698981e9f0cc2c4f9569b19a5f3595e741f6b /libgimpthumb
parentInitial commit. (diff)
downloadgimp-3c57dd931145d43f2b0aef96c4d178135956bf91.tar.xz
gimp-3c57dd931145d43f2b0aef96c4d178135956bf91.zip
Adding upstream version 2.10.36.upstream/2.10.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libgimpthumb')
-rw-r--r--libgimpthumb/Makefile.am137
-rw-r--r--libgimpthumb/Makefile.in1145
-rw-r--r--libgimpthumb/gimp-thumbnail-list.c251
-rw-r--r--libgimpthumb/gimpthumb-enums.c75
-rw-r--r--libgimpthumb/gimpthumb-enums.h118
-rw-r--r--libgimpthumb/gimpthumb-error.c52
-rw-r--r--libgimpthumb/gimpthumb-error.h64
-rw-r--r--libgimpthumb/gimpthumb-types.h38
-rw-r--r--libgimpthumb/gimpthumb-utils.c870
-rw-r--r--libgimpthumb/gimpthumb-utils.h73
-rw-r--r--libgimpthumb/gimpthumb.def32
-rw-r--r--libgimpthumb/gimpthumb.h38
-rw-r--r--libgimpthumb/gimpthumbnail.c1400
-rw-r--r--libgimpthumb/gimpthumbnail.h135
14 files changed, 4428 insertions, 0 deletions
diff --git a/libgimpthumb/Makefile.am b/libgimpthumb/Makefile.am
new file mode 100644
index 0000000..2655379
--- /dev/null
+++ b/libgimpthumb/Makefile.am
@@ -0,0 +1,137 @@
+## Process this file with automake to produce Makefile.in
+
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
+
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+xobjective_cxx = "-xobjective-c++"
+xnone = "-xnone"
+framework_cocoa = -framework Cocoa
+endif
+
+if OS_WIN32
+gimpthumb_def = gimpthumb.def
+libgimpthumb_export_symbols = -export-symbols $(srcdir)/gimpthumb.def
+
+install-libtool-import-lib:
+ $(INSTALL) .libs/libgimpthumb-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+ $(INSTALL) $(srcdir)/gimpthumb.def $(DESTDIR)$(libdir)
+
+uninstall-libtool-import-lib:
+ -rm $(DESTDIR)$(libdir)/libgimpthumb-$(GIMP_API_VERSION).dll.a
+ -rm $(DESTDIR)$(libdir)/gimpthumb.def
+else
+install-libtool-import-lib:
+uninstall-libtool-import-lib:
+endif
+
+if MS_LIB_AVAILABLE
+noinst_DATA = gimpthumb-$(GIMP_API_VERSION).lib
+
+install-ms-lib:
+ $(INSTALL) gimpthumb-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+
+uninstall-ms-lib:
+ -rm $(DESTDIR)$(libdir)/gimpthumb-$(GIMP_API_VERSION).lib
+
+gimpthumb-@GIMP_API_VERSION@.lib: gimpthumb.def
+ lib -name:libgimpthumb-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimpthumb.def -out:$@
+
+else
+install-ms-lib:
+uninstall-ms-lib:
+endif
+
+libgimpthumbincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimpthumb
+
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"LibGimpThumb\" \
+ -DGIMP_THUMB_COMPILATION \
+ -I$(top_srcdir) \
+ $(GDK_PIXBUF_CFLAGS) \
+ $(GIO_CFLAGS) \
+ -I$(includedir)
+
+AM_CFLAGS = \
+ $(xobjective_c)
+
+AM_CXXFLAGS = \
+ $(xobjective_cxx)
+
+AM_LDFLAGS = \
+ $(xnone)
+
+EXTRA_DIST = \
+ gimpthumb.def
+
+lib_LTLIBRARIES = libgimpthumb-@GIMP_API_VERSION@.la
+
+libgimpthumb_@GIMP_API_VERSION@_la_SOURCES = \
+ gimpthumb.h \
+ gimpthumb-enums.c \
+ gimpthumb-enums.h \
+ gimpthumb-error.c \
+ gimpthumb-error.h \
+ gimpthumb-types.h \
+ gimpthumb-utils.c \
+ gimpthumb-utils.h \
+ gimpthumbnail.c \
+ gimpthumbnail.h
+
+libgimpthumbinclude_HEADERS = \
+ gimpthumb.h \
+ gimpthumb-enums.h \
+ gimpthumb-error.h \
+ gimpthumb-types.h \
+ gimpthumb-utils.h \
+ gimpthumbnail.h
+
+libgimpthumb_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimpbase) \
+ $(libgimpthumb_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+libgimpthumb_@GIMP_API_VERSION@_la_LIBADD = \
+ $(GDK_PIXBUF_LIBS) \
+ $(GIO_LIBS)
+
+
+noinst_PROGRAMS = gimp-thumbnail-list
+
+gimp_thumbnail_list_SOURCES = gimp-thumbnail-list.c
+
+gimp_thumbnail_list_LDADD = \
+ libgimpthumb-$(GIMP_API_VERSION).la \
+ $(GDK_PIXBUF_LIBS) \
+ $(GIO_LIBS)
+
+
+install-data-local: install-ms-lib install-libtool-import-lib
+
+uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
+
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-tec
+CLEANFILES = $(gen_sources)
+
+gimpthumb-enums.c: $(srcdir)/gimpthumb-enums.h $(GIMP_MKENUMS) Makefile.am
+ $(AM_V_GEN) $(GIMP_MKENUMS) \
+ --fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"gimpthumb-enums.h\"" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
+ --vprod " { @VALUENAME@, @valuedesc@, \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n type = g_@type@_register_static (\"@EnumName@\", values);\n\n return type;\n}\n" \
+ $< > xgen-tec \
+ && cp xgen-tec $(@F) \
+ && rm -f xgen-tec
diff --git a/libgimpthumb/Makefile.in b/libgimpthumb/Makefile.in
new file mode 100644
index 0000000..9348cb0
--- /dev/null
+++ b/libgimpthumb/Makefile.in
@@ -0,0 +1,1145 @@
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = gimp-thumbnail-list$(EXEEXT)
+subdir = libgimpthumb
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/m4macros/alsa.m4 \
+ $(top_srcdir)/m4macros/ax_compare_version.m4 \
+ $(top_srcdir)/m4macros/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4macros/ax_gcc_func_attribute.m4 \
+ $(top_srcdir)/m4macros/ax_prog_cc_for_build.m4 \
+ $(top_srcdir)/m4macros/ax_prog_perl_version.m4 \
+ $(top_srcdir)/m4macros/detectcflags.m4 \
+ $(top_srcdir)/m4macros/pythondev.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(libgimpthumbinclude_HEADERS) \
+ $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" \
+ "$(DESTDIR)$(libgimpthumbincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libgimpthumb_@GIMP_API_VERSION@_la_DEPENDENCIES = \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libgimpthumb_@GIMP_API_VERSION@_la_OBJECTS = gimpthumb-enums.lo \
+ gimpthumb-error.lo gimpthumb-utils.lo gimpthumbnail.lo
+libgimpthumb_@GIMP_API_VERSION@_la_OBJECTS = \
+ $(am_libgimpthumb_@GIMP_API_VERSION@_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libgimpthumb_@GIMP_API_VERSION@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
+ --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+ $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libgimpthumb_@GIMP_API_VERSION@_la_LDFLAGS) $(LDFLAGS) -o $@
+am_gimp_thumbnail_list_OBJECTS = gimp-thumbnail-list.$(OBJEXT)
+gimp_thumbnail_list_OBJECTS = $(am_gimp_thumbnail_list_OBJECTS)
+gimp_thumbnail_list_DEPENDENCIES = \
+ libgimpthumb-$(GIMP_API_VERSION).la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/gimp-thumbnail-list.Po \
+ ./$(DEPDIR)/gimpthumb-enums.Plo \
+ ./$(DEPDIR)/gimpthumb-error.Plo \
+ ./$(DEPDIR)/gimpthumb-utils.Plo ./$(DEPDIR)/gimpthumbnail.Plo
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libgimpthumb_@GIMP_API_VERSION@_la_SOURCES) \
+ $(gimp_thumbnail_list_SOURCES)
+DIST_SOURCES = $(libgimpthumb_@GIMP_API_VERSION@_la_SOURCES) \
+ $(gimp_thumbnail_list_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(noinst_DATA)
+HEADERS = $(libgimpthumbinclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+AA_LIBS = @AA_LIBS@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALL_LINGUAS = @ALL_LINGUAS@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+ALTIVEC_EXTRA_CFLAGS = @ALTIVEC_EXTRA_CFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPSTREAM_UTIL = @APPSTREAM_UTIL@
+AR = @AR@
+AS = @AS@
+ATK_CFLAGS = @ATK_CFLAGS@
+ATK_LIBS = @ATK_LIBS@
+ATK_REQUIRED_VERSION = @ATK_REQUIRED_VERSION@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BABL_CFLAGS = @BABL_CFLAGS@
+BABL_LIBS = @BABL_LIBS@
+BABL_REQUIRED_VERSION = @BABL_REQUIRED_VERSION@
+BUG_REPORT_URL = @BUG_REPORT_URL@
+BUILD_EXEEXT = @BUILD_EXEEXT@
+BUILD_OBJEXT = @BUILD_OBJEXT@
+BZIP2_LIBS = @BZIP2_LIBS@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CAIRO_PDF_CFLAGS = @CAIRO_PDF_CFLAGS@
+CAIRO_PDF_LIBS = @CAIRO_PDF_LIBS@
+CAIRO_PDF_REQUIRED_VERSION = @CAIRO_PDF_REQUIRED_VERSION@
+CAIRO_REQUIRED_VERSION = @CAIRO_REQUIRED_VERSION@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DESKTOP_DATADIR = @DESKTOP_DATADIR@
+DESKTOP_FILE_VALIDATE = @DESKTOP_FILE_VALIDATE@
+DLLTOOL = @DLLTOOL@
+DOC_SHOOTER = @DOC_SHOOTER@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_AA = @FILE_AA@
+FILE_EXR = @FILE_EXR@
+FILE_HEIF = @FILE_HEIF@
+FILE_JP2_LOAD = @FILE_JP2_LOAD@
+FILE_JPEGXL = @FILE_JPEGXL@
+FILE_MNG = @FILE_MNG@
+FILE_PDF_SAVE = @FILE_PDF_SAVE@
+FILE_PS = @FILE_PS@
+FILE_WMF = @FILE_WMF@
+FILE_XMC = @FILE_XMC@
+FILE_XPM = @FILE_XPM@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+FONTCONFIG_REQUIRED_VERSION = @FONTCONFIG_REQUIRED_VERSION@
+FREETYPE2_REQUIRED_VERSION = @FREETYPE2_REQUIRED_VERSION@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GDBUS_CODEGEN = @GDBUS_CODEGEN@
+GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
+GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@
+GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
+GDK_PIXBUF_REQUIRED_VERSION = @GDK_PIXBUF_REQUIRED_VERSION@
+GEGL = @GEGL@
+GEGL_CFLAGS = @GEGL_CFLAGS@
+GEGL_LIBS = @GEGL_LIBS@
+GEGL_MAJOR_MINOR_VERSION = @GEGL_MAJOR_MINOR_VERSION@
+GEGL_REQUIRED_VERSION = @GEGL_REQUIRED_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GEXIV2_CFLAGS = @GEXIV2_CFLAGS@
+GEXIV2_LIBS = @GEXIV2_LIBS@
+GEXIV2_REQUIRED_VERSION = @GEXIV2_REQUIRED_VERSION@
+GIMP_API_VERSION = @GIMP_API_VERSION@
+GIMP_APP_VERSION = @GIMP_APP_VERSION@
+GIMP_BINARY_AGE = @GIMP_BINARY_AGE@
+GIMP_COMMAND = @GIMP_COMMAND@
+GIMP_DATA_VERSION = @GIMP_DATA_VERSION@
+GIMP_FULL_NAME = @GIMP_FULL_NAME@
+GIMP_INTERFACE_AGE = @GIMP_INTERFACE_AGE@
+GIMP_MAJOR_VERSION = @GIMP_MAJOR_VERSION@
+GIMP_MICRO_VERSION = @GIMP_MICRO_VERSION@
+GIMP_MINOR_VERSION = @GIMP_MINOR_VERSION@
+GIMP_MKENUMS = @GIMP_MKENUMS@
+GIMP_MODULES = @GIMP_MODULES@
+GIMP_PACKAGE_REVISION = @GIMP_PACKAGE_REVISION@
+GIMP_PKGCONFIG_VERSION = @GIMP_PKGCONFIG_VERSION@
+GIMP_PLUGINS = @GIMP_PLUGINS@
+GIMP_PLUGIN_VERSION = @GIMP_PLUGIN_VERSION@
+GIMP_REAL_VERSION = @GIMP_REAL_VERSION@
+GIMP_RELEASE = @GIMP_RELEASE@
+GIMP_SYSCONF_VERSION = @GIMP_SYSCONF_VERSION@
+GIMP_TOOL_VERSION = @GIMP_TOOL_VERSION@
+GIMP_UNSTABLE = @GIMP_UNSTABLE@
+GIMP_USER_VERSION = @GIMP_USER_VERSION@
+GIMP_VERSION = @GIMP_VERSION@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GIO_UNIX_CFLAGS = @GIO_UNIX_CFLAGS@
+GIO_UNIX_LIBS = @GIO_UNIX_LIBS@
+GIO_WINDOWS_CFLAGS = @GIO_WINDOWS_CFLAGS@
+GIO_WINDOWS_LIBS = @GIO_WINDOWS_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GLIB_REQUIRED_VERSION = @GLIB_REQUIRED_VERSION@
+GMODULE_NO_EXPORT_CFLAGS = @GMODULE_NO_EXPORT_CFLAGS@
+GMODULE_NO_EXPORT_LIBS = @GMODULE_NO_EXPORT_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GS_LIBS = @GS_LIBS@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_MAC_INTEGRATION_CFLAGS = @GTK_MAC_INTEGRATION_CFLAGS@
+GTK_MAC_INTEGRATION_LIBS = @GTK_MAC_INTEGRATION_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_UPDATE_ICON_CACHE = @GTK_UPDATE_ICON_CACHE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@
+HARFBUZZ_LIBS = @HARFBUZZ_LIBS@
+HARFBUZZ_REQUIRED_VERSION = @HARFBUZZ_REQUIRED_VERSION@
+HAVE_CXX14 = @HAVE_CXX14@
+HAVE_FINITE = @HAVE_FINITE@
+HAVE_ISFINITE = @HAVE_ISFINITE@
+HAVE_VFORK = @HAVE_VFORK@
+HOST_GLIB_COMPILE_RESOURCES = @HOST_GLIB_COMPILE_RESOURCES@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_REQUIRED_VERSION = @INTLTOOL_REQUIRED_VERSION@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+ISO_CODES_LOCALEDIR = @ISO_CODES_LOCALEDIR@
+ISO_CODES_LOCATION = @ISO_CODES_LOCATION@
+JPEG_LIBS = @JPEG_LIBS@
+JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
+JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
+JXL_CFLAGS = @JXL_CFLAGS@
+JXL_LIBS = @JXL_LIBS@
+JXL_THREADS_CFLAGS = @JXL_THREADS_CFLAGS@
+JXL_THREADS_LIBS = @JXL_THREADS_LIBS@
+LCMS_CFLAGS = @LCMS_CFLAGS@
+LCMS_LIBS = @LCMS_LIBS@
+LCMS_REQUIRED_VERSION = @LCMS_REQUIRED_VERSION@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+LIBBACKTRACE_LIBS = @LIBBACKTRACE_LIBS@
+LIBHEIF_CFLAGS = @LIBHEIF_CFLAGS@
+LIBHEIF_LIBS = @LIBHEIF_LIBS@
+LIBHEIF_REQUIRED_VERSION = @LIBHEIF_REQUIRED_VERSION@
+LIBJXL_REQUIRED_VERSION = @LIBJXL_REQUIRED_VERSION@
+LIBLZMA_REQUIRED_VERSION = @LIBLZMA_REQUIRED_VERSION@
+LIBMYPAINT_CFLAGS = @LIBMYPAINT_CFLAGS@
+LIBMYPAINT_LIBS = @LIBMYPAINT_LIBS@
+LIBMYPAINT_REQUIRED_VERSION = @LIBMYPAINT_REQUIRED_VERSION@
+LIBOBJS = @LIBOBJS@
+LIBPNG_REQUIRED_VERSION = @LIBPNG_REQUIRED_VERSION@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@
+LIBUNWIND_LIBS = @LIBUNWIND_LIBS@
+LIBUNWIND_REQUIRED_VERSION = @LIBUNWIND_REQUIRED_VERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_CURRENT_MINUS_AGE = @LT_CURRENT_MINUS_AGE@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAIL = @MAIL@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MIME_INFO_CFLAGS = @MIME_INFO_CFLAGS@
+MIME_INFO_LIBS = @MIME_INFO_LIBS@
+MIME_TYPES = @MIME_TYPES@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MMX_EXTRA_CFLAGS = @MMX_EXTRA_CFLAGS@
+MNG_CFLAGS = @MNG_CFLAGS@
+MNG_LIBS = @MNG_LIBS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+MYPAINT_BRUSHES_CFLAGS = @MYPAINT_BRUSHES_CFLAGS@
+MYPAINT_BRUSHES_LIBS = @MYPAINT_BRUSHES_LIBS@
+NATIVE_GLIB_CFLAGS = @NATIVE_GLIB_CFLAGS@
+NATIVE_GLIB_LIBS = @NATIVE_GLIB_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENEXR_CFLAGS = @OPENEXR_CFLAGS@
+OPENEXR_LIBS = @OPENEXR_LIBS@
+OPENEXR_REQUIRED_VERSION = @OPENEXR_REQUIRED_VERSION@
+OPENJPEG_CFLAGS = @OPENJPEG_CFLAGS@
+OPENJPEG_LIBS = @OPENJPEG_LIBS@
+OPENJPEG_REQUIRED_VERSION = @OPENJPEG_REQUIRED_VERSION@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOCAIRO_CFLAGS = @PANGOCAIRO_CFLAGS@
+PANGOCAIRO_LIBS = @PANGOCAIRO_LIBS@
+PANGOCAIRO_REQUIRED_VERSION = @PANGOCAIRO_REQUIRED_VERSION@
+PATHSEP = @PATHSEP@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_REQUIRED_VERSION = @PERL_REQUIRED_VERSION@
+PERL_VERSION = @PERL_VERSION@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PNG_CFLAGS = @PNG_CFLAGS@
+PNG_LIBS = @PNG_LIBS@
+POFILES = @POFILES@
+POPPLER_CFLAGS = @POPPLER_CFLAGS@
+POPPLER_DATA_CFLAGS = @POPPLER_DATA_CFLAGS@
+POPPLER_DATA_LIBS = @POPPLER_DATA_LIBS@
+POPPLER_DATA_REQUIRED_VERSION = @POPPLER_DATA_REQUIRED_VERSION@
+POPPLER_LIBS = @POPPLER_LIBS@
+POPPLER_REQUIRED_VERSION = @POPPLER_REQUIRED_VERSION@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PYBIN_PATH = @PYBIN_PATH@
+PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
+PYCAIRO_LIBS = @PYCAIRO_LIBS@
+PYGIMP_EXTRA_CFLAGS = @PYGIMP_EXTRA_CFLAGS@
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_CODEGEN = @PYGTK_CODEGEN@
+PYGTK_DEFSDIR = @PYGTK_DEFSDIR@
+PYGTK_LIBS = @PYGTK_LIBS@
+PYLINK_LIBS = @PYLINK_LIBS@
+PYTHON = @PYTHON@
+PYTHON2_REQUIRED_VERSION = @PYTHON2_REQUIRED_VERSION@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RSVG_REQUIRED_VERSION = @RSVG_REQUIRED_VERSION@
+RT_LIBS = @RT_LIBS@
+SCREENSHOT_LIBS = @SCREENSHOT_LIBS@
+SED = @SED@
+SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOCKET_LIBS = @SOCKET_LIBS@
+SSE2_EXTRA_CFLAGS = @SSE2_EXTRA_CFLAGS@
+SSE4_1_EXTRA_CFLAGS = @SSE4_1_EXTRA_CFLAGS@
+SSE_EXTRA_CFLAGS = @SSE_EXTRA_CFLAGS@
+STRIP = @STRIP@
+SVG_CFLAGS = @SVG_CFLAGS@
+SVG_LIBS = @SVG_LIBS@
+SYMPREFIX = @SYMPREFIX@
+TIFF_LIBS = @TIFF_LIBS@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
+WEBKIT_LIBS = @WEBKIT_LIBS@
+WEBKIT_REQUIRED_VERSION = @WEBKIT_REQUIRED_VERSION@
+WEBPDEMUX_CFLAGS = @WEBPDEMUX_CFLAGS@
+WEBPDEMUX_LIBS = @WEBPDEMUX_LIBS@
+WEBPMUX_CFLAGS = @WEBPMUX_CFLAGS@
+WEBPMUX_LIBS = @WEBPMUX_LIBS@
+WEBP_CFLAGS = @WEBP_CFLAGS@
+WEBP_LIBS = @WEBP_LIBS@
+WEBP_REQUIRED_VERSION = @WEBP_REQUIRED_VERSION@
+WEB_PAGE = @WEB_PAGE@
+WIN32_LARGE_ADDRESS_AWARE = @WIN32_LARGE_ADDRESS_AWARE@
+WINDRES = @WINDRES@
+WMF_CFLAGS = @WMF_CFLAGS@
+WMF_CONFIG = @WMF_CONFIG@
+WMF_LIBS = @WMF_LIBS@
+WMF_REQUIRED_VERSION = @WMF_REQUIRED_VERSION@
+XDG_EMAIL = @XDG_EMAIL@
+XFIXES_CFLAGS = @XFIXES_CFLAGS@
+XFIXES_LIBS = @XFIXES_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_REQUIRED_VERSION = @XGETTEXT_REQUIRED_VERSION@
+XMC_CFLAGS = @XMC_CFLAGS@
+XMC_LIBS = @XMC_LIBS@
+XMKMF = @XMKMF@
+XMLLINT = @XMLLINT@
+XMU_LIBS = @XMU_LIBS@
+XPM_LIBS = @XPM_LIBS@
+XSLTPROC = @XSLTPROC@
+XVFB_RUN = @XVFB_RUN@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gimpdatadir = @gimpdatadir@
+gimpdir = @gimpdir@
+gimplocaledir = @gimplocaledir@
+gimpplugindir = @gimpplugindir@
+gimpsysconfdir = @gimpsysconfdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+manpage_gimpdir = @manpage_gimpdir@
+mkdir_p = @mkdir_p@
+ms_librarian = @ms_librarian@
+mypaint_brushes_dir = @mypaint_brushes_dir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+@PLATFORM_WIN32_TRUE@no_undefined = -no-undefined
+@PLATFORM_OSX_TRUE@xobjective_c = "-xobjective-c"
+@PLATFORM_OSX_TRUE@xobjective_cxx = "-xobjective-c++"
+@PLATFORM_OSX_TRUE@xnone = "-xnone"
+@PLATFORM_OSX_TRUE@framework_cocoa = -framework Cocoa
+@OS_WIN32_TRUE@gimpthumb_def = gimpthumb.def
+@OS_WIN32_TRUE@libgimpthumb_export_symbols = -export-symbols $(srcdir)/gimpthumb.def
+@MS_LIB_AVAILABLE_TRUE@noinst_DATA = gimpthumb-$(GIMP_API_VERSION).lib
+libgimpthumbincludedir = $(includedir)/gimp-$(GIMP_API_VERSION)/libgimpthumb
+AM_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"LibGimpThumb\" \
+ -DGIMP_THUMB_COMPILATION \
+ -I$(top_srcdir) \
+ $(GDK_PIXBUF_CFLAGS) \
+ $(GIO_CFLAGS) \
+ -I$(includedir)
+
+AM_CFLAGS = \
+ $(xobjective_c)
+
+AM_CXXFLAGS = \
+ $(xobjective_cxx)
+
+AM_LDFLAGS = \
+ $(xnone)
+
+EXTRA_DIST = \
+ gimpthumb.def
+
+lib_LTLIBRARIES = libgimpthumb-@GIMP_API_VERSION@.la
+libgimpthumb_@GIMP_API_VERSION@_la_SOURCES = \
+ gimpthumb.h \
+ gimpthumb-enums.c \
+ gimpthumb-enums.h \
+ gimpthumb-error.c \
+ gimpthumb-error.h \
+ gimpthumb-types.h \
+ gimpthumb-utils.c \
+ gimpthumb-utils.h \
+ gimpthumbnail.c \
+ gimpthumbnail.h
+
+libgimpthumbinclude_HEADERS = \
+ gimpthumb.h \
+ gimpthumb-enums.h \
+ gimpthumb-error.h \
+ gimpthumb-types.h \
+ gimpthumb-utils.h \
+ gimpthumbnail.h
+
+libgimpthumb_@GIMP_API_VERSION@_la_LDFLAGS = \
+ -version-info $(LT_VERSION_INFO) \
+ $(no_undefined) \
+ $(libgimpbase) \
+ $(libgimpthumb_export_symbols) \
+ $(framework_cocoa) \
+ $(xnone)
+
+libgimpthumb_@GIMP_API_VERSION@_la_LIBADD = \
+ $(GDK_PIXBUF_LIBS) \
+ $(GIO_LIBS)
+
+gimp_thumbnail_list_SOURCES = gimp-thumbnail-list.c
+gimp_thumbnail_list_LDADD = \
+ libgimpthumb-$(GIMP_API_VERSION).la \
+ $(GDK_PIXBUF_LIBS) \
+ $(GIO_LIBS)
+
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-tec
+CLEANFILES = $(gen_sources)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libgimpthumb/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libgimpthumb/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libgimpthumb-@GIMP_API_VERSION@.la: $(libgimpthumb_@GIMP_API_VERSION@_la_OBJECTS) $(libgimpthumb_@GIMP_API_VERSION@_la_DEPENDENCIES) $(EXTRA_libgimpthumb_@GIMP_API_VERSION@_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libgimpthumb_@GIMP_API_VERSION@_la_LINK) -rpath $(libdir) $(libgimpthumb_@GIMP_API_VERSION@_la_OBJECTS) $(libgimpthumb_@GIMP_API_VERSION@_la_LIBADD) $(LIBS)
+
+gimp-thumbnail-list$(EXEEXT): $(gimp_thumbnail_list_OBJECTS) $(gimp_thumbnail_list_DEPENDENCIES) $(EXTRA_gimp_thumbnail_list_DEPENDENCIES)
+ @rm -f gimp-thumbnail-list$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(gimp_thumbnail_list_OBJECTS) $(gimp_thumbnail_list_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp-thumbnail-list.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthumb-enums.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthumb-error.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthumb-utils.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimpthumbnail.Plo@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-libgimpthumbincludeHEADERS: $(libgimpthumbinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(libgimpthumbinclude_HEADERS)'; test -n "$(libgimpthumbincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libgimpthumbincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libgimpthumbincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libgimpthumbincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(libgimpthumbincludedir)" || exit $$?; \
+ done
+
+uninstall-libgimpthumbincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libgimpthumbinclude_HEADERS)'; test -n "$(libgimpthumbincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libgimpthumbincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libgimpthumbincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/gimp-thumbnail-list.Po
+ -rm -f ./$(DEPDIR)/gimpthumb-enums.Plo
+ -rm -f ./$(DEPDIR)/gimpthumb-error.Plo
+ -rm -f ./$(DEPDIR)/gimpthumb-utils.Plo
+ -rm -f ./$(DEPDIR)/gimpthumbnail.Plo
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-libgimpthumbincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/gimp-thumbnail-list.Po
+ -rm -f ./$(DEPDIR)/gimpthumb-enums.Plo
+ -rm -f ./$(DEPDIR)/gimpthumb-error.Plo
+ -rm -f ./$(DEPDIR)/gimpthumb-utils.Plo
+ -rm -f ./$(DEPDIR)/gimpthumbnail.Plo
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES \
+ uninstall-libgimpthumbincludeHEADERS uninstall-local
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-data-local install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libLTLIBRARIES \
+ install-libgimpthumbincludeHEADERS install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \
+ uninstall-libgimpthumbincludeHEADERS uninstall-local
+
+.PRECIOUS: Makefile
+
+
+@OS_WIN32_TRUE@install-libtool-import-lib:
+@OS_WIN32_TRUE@ $(INSTALL) .libs/libgimpthumb-$(GIMP_API_VERSION).dll.a $(DESTDIR)$(libdir)
+@OS_WIN32_TRUE@ $(INSTALL) $(srcdir)/gimpthumb.def $(DESTDIR)$(libdir)
+
+@OS_WIN32_TRUE@uninstall-libtool-import-lib:
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/libgimpthumb-$(GIMP_API_VERSION).dll.a
+@OS_WIN32_TRUE@ -rm $(DESTDIR)$(libdir)/gimpthumb.def
+@OS_WIN32_FALSE@install-libtool-import-lib:
+@OS_WIN32_FALSE@uninstall-libtool-import-lib:
+
+@MS_LIB_AVAILABLE_TRUE@install-ms-lib:
+@MS_LIB_AVAILABLE_TRUE@ $(INSTALL) gimpthumb-$(GIMP_API_VERSION).lib $(DESTDIR)$(libdir)
+
+@MS_LIB_AVAILABLE_TRUE@uninstall-ms-lib:
+@MS_LIB_AVAILABLE_TRUE@ -rm $(DESTDIR)$(libdir)/gimpthumb-$(GIMP_API_VERSION).lib
+
+@MS_LIB_AVAILABLE_TRUE@gimpthumb-@GIMP_API_VERSION@.lib: gimpthumb.def
+@MS_LIB_AVAILABLE_TRUE@ lib -name:libgimpthumb-$(GIMP_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gimpthumb.def -out:$@
+
+@MS_LIB_AVAILABLE_FALSE@install-ms-lib:
+@MS_LIB_AVAILABLE_FALSE@uninstall-ms-lib:
+
+install-data-local: install-ms-lib install-libtool-import-lib
+
+uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
+
+gimpthumb-enums.c: $(srcdir)/gimpthumb-enums.h $(GIMP_MKENUMS) Makefile.am
+ $(AM_V_GEN) $(GIMP_MKENUMS) \
+ --fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"gimpthumb-enums.h\"" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
+ --vprod " { @VALUENAME@, @valuedesc@, \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n type = g_@type@_register_static (\"@EnumName@\", values);\n\n return type;\n}\n" \
+ $< > xgen-tec \
+ && cp xgen-tec $(@F) \
+ && rm -f xgen-tec
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libgimpthumb/gimp-thumbnail-list.c b/libgimpthumb/gimp-thumbnail-list.c
new file mode 100644
index 0000000..2086af2
--- /dev/null
+++ b/libgimpthumb/gimp-thumbnail-list.c
@@ -0,0 +1,251 @@
+/*
+ * gimp-thumbnail-list.c
+ */
+
+#include <string.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libgimpthumb/gimpthumb.h>
+
+
+#define STATE_NONE -1
+#define STATE_ERROR -2
+
+
+static gboolean parse_option_state (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error);
+static gboolean parse_option_path (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error);
+static void process_folder (const gchar *folder);
+static void process_thumbnail (const gchar *filename);
+
+
+static GimpThumbState option_state = STATE_NONE;
+static gboolean option_verbose = FALSE;
+static gchar *option_path = NULL;
+
+
+static const GOptionEntry main_entries[] =
+{
+ {
+ "state", 's', 0,
+ G_OPTION_ARG_CALLBACK, parse_option_state,
+ "Filter by thumbnail state "
+ "(unknown|remote|folder|special|not-found|exists|old|failed|ok|error)",
+ "<state>"
+ },
+ {
+ "path", 'p', 0,
+ G_OPTION_ARG_CALLBACK, parse_option_path,
+ "Filter by original file's path",
+ "<path>"
+ },
+ {
+ "verbose", 'v', 0,
+ G_OPTION_ARG_NONE, &option_verbose,
+ "Print additional info per matched file", NULL
+ },
+ { NULL }
+};
+
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ GOptionContext *context;
+ GDir *dir;
+ const gchar *thumb_folder;
+ const gchar *folder;
+ GError *error = NULL;
+
+ gimp_thumb_init ("gimp-thumbnail-list", NULL);
+
+ thumb_folder = gimp_thumb_get_thumb_base_dir ();
+
+ context = g_option_context_new (NULL);
+ g_option_context_add_main_entries (context, main_entries, NULL);
+
+ if (! g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_printerr ("%s\n", error->message);
+ return -1;
+ }
+
+ dir = g_dir_open (thumb_folder, 0, &error);
+
+ if (! dir)
+ g_error ("Error opening %s: %s", thumb_folder, error->message);
+
+ while ((folder = g_dir_read_name (dir)))
+ {
+ gchar *filename;
+
+ filename = g_build_filename (thumb_folder, folder, NULL);
+
+ if (g_file_test (filename, G_FILE_TEST_IS_DIR))
+ process_folder (filename);
+
+ g_free (filename);
+ }
+
+ g_dir_close (dir);
+
+ return 0;
+}
+
+static gboolean
+parse_option_state (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ if (strcmp (value, "unknown") == 0)
+ option_state = GIMP_THUMB_STATE_UNKNOWN;
+ else if (strcmp (value, "remote") == 0)
+ option_state = GIMP_THUMB_STATE_REMOTE;
+ else if (strcmp (value, "folder") == 0)
+ option_state = GIMP_THUMB_STATE_FOLDER;
+ else if (strcmp (value, "special") == 0)
+ option_state = GIMP_THUMB_STATE_SPECIAL;
+ else if (strcmp (value, "not-found") == 0)
+ option_state = GIMP_THUMB_STATE_NOT_FOUND;
+ else if (strcmp (value, "exists") == 0)
+ option_state = GIMP_THUMB_STATE_EXISTS;
+ else if (strcmp (value, "old") == 0)
+ option_state = GIMP_THUMB_STATE_OLD;
+ else if (strcmp (value, "failed") == 0)
+ option_state = GIMP_THUMB_STATE_FAILED;
+ else if (strcmp (value, "ok") == 0)
+ option_state = GIMP_THUMB_STATE_OK;
+ else if (strcmp (value, "error") == 0)
+ option_state = STATE_ERROR;
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+parse_option_path (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ option_path = g_strdup (value);
+
+ return TRUE;
+}
+
+static void
+process_folder (const gchar *folder)
+{
+ GDir *dir;
+ const gchar *name;
+ GError *error = NULL;
+
+#if 0
+ g_print ("processing folder: %s\n", folder);
+#endif
+
+ dir = g_dir_open (folder, 0, &error);
+
+ if (! dir)
+ {
+ g_printerr ("Error opening '%s': %s", folder, error->message);
+ return;
+ }
+
+ while ((name = g_dir_read_name (dir)))
+ {
+ gchar *filename;
+
+ filename = g_build_filename (folder, name, NULL);
+
+ if (g_file_test (filename, G_FILE_TEST_IS_DIR))
+ process_folder (filename);
+ else
+ process_thumbnail (filename);
+
+ g_free (filename);
+ }
+
+ g_dir_close (dir);
+}
+
+static void
+process_thumbnail (const gchar *filename)
+{
+ GimpThumbnail *thumbnail;
+ GError *error = NULL;
+
+ thumbnail = gimp_thumbnail_new ();
+
+ if (! gimp_thumbnail_set_from_thumb (thumbnail, filename, &error))
+ {
+ if (option_state == STATE_ERROR)
+ {
+ if (option_verbose)
+ g_print ("%s '%s'\n", filename, error->message);
+ else
+ g_print ("%s\n", filename);
+ }
+
+ g_clear_error (&error);
+ }
+ else
+ {
+ GimpThumbState state = gimp_thumbnail_peek_image (thumbnail);
+
+ if ((option_state == STATE_NONE || state == option_state)
+
+ &&
+
+ (option_path == NULL ||
+ strstr (thumbnail->image_uri, option_path)))
+ {
+ if (option_verbose)
+ g_print ("%s '%s'\n", filename, thumbnail->image_uri);
+ else
+ g_print ("%s\n", filename);
+ }
+
+#if 0
+ switch (foo)
+ {
+ case GIMP_THUMB_STATE_REMOTE:
+ g_print ("%s Remote image '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ case GIMP_THUMB_STATE_FOLDER:
+ g_print ("%s Folder '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ case GIMP_THUMB_STATE_SPECIAL:
+ g_print ("%s Special file '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ case GIMP_THUMB_STATE_NOT_FOUND:
+ g_print ("%s Image not found '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ case GIMP_THUMB_STATE_OLD:
+ g_print ("%s Thumbnail old '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ case GIMP_THUMB_STATE_FAILED:
+ g_print ("%s EEEEEEEEK '%s'\n", filename, thumbnail->image_uri);
+ break;
+
+ default:
+ g_print ("%s '%s'\n", filename, thumbnail->image_uri);
+ break;
+ }
+#endif
+ }
+
+ g_object_unref (thumbnail);
+}
diff --git a/libgimpthumb/gimpthumb-enums.c b/libgimpthumb/gimpthumb-enums.c
new file mode 100644
index 0000000..b7924e8
--- /dev/null
+++ b/libgimpthumb/gimpthumb-enums.c
@@ -0,0 +1,75 @@
+
+/* Generated data (by gimp-mkenums) */
+
+#include "config.h"
+#include <glib-object.h>
+#include "gimpthumb-enums.h"
+
+/* enumerations from "../../libgimpthumb/gimpthumb-enums.h" */
+GType
+gimp_thumb_file_type_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_THUMB_FILE_TYPE_NONE, "GIMP_THUMB_FILE_TYPE_NONE", "none" },
+ { GIMP_THUMB_FILE_TYPE_REGULAR, "GIMP_THUMB_FILE_TYPE_REGULAR", "regular" },
+ { GIMP_THUMB_FILE_TYPE_FOLDER, "GIMP_THUMB_FILE_TYPE_FOLDER", "folder" },
+ { GIMP_THUMB_FILE_TYPE_SPECIAL, "GIMP_THUMB_FILE_TYPE_SPECIAL", "special" },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ type = g_enum_register_static ("GimpThumbFileType", values);
+
+ return type;
+}
+
+GType
+gimp_thumb_size_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_THUMB_SIZE_FAIL, "GIMP_THUMB_SIZE_FAIL", "fail" },
+ { GIMP_THUMB_SIZE_NORMAL, "GIMP_THUMB_SIZE_NORMAL", "normal" },
+ { GIMP_THUMB_SIZE_LARGE, "GIMP_THUMB_SIZE_LARGE", "large" },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ type = g_enum_register_static ("GimpThumbSize", values);
+
+ return type;
+}
+
+GType
+gimp_thumb_state_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_THUMB_STATE_UNKNOWN, "GIMP_THUMB_STATE_UNKNOWN", "unknown" },
+ { GIMP_THUMB_STATE_REMOTE, "GIMP_THUMB_STATE_REMOTE", "remote" },
+ { GIMP_THUMB_STATE_FOLDER, "GIMP_THUMB_STATE_FOLDER", "folder" },
+ { GIMP_THUMB_STATE_SPECIAL, "GIMP_THUMB_STATE_SPECIAL", "special" },
+ { GIMP_THUMB_STATE_NOT_FOUND, "GIMP_THUMB_STATE_NOT_FOUND", "not-found" },
+ { GIMP_THUMB_STATE_EXISTS, "GIMP_THUMB_STATE_EXISTS", "exists" },
+ { GIMP_THUMB_STATE_OLD, "GIMP_THUMB_STATE_OLD", "old" },
+ { GIMP_THUMB_STATE_FAILED, "GIMP_THUMB_STATE_FAILED", "failed" },
+ { GIMP_THUMB_STATE_OK, "GIMP_THUMB_STATE_OK", "ok" },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ type = g_enum_register_static ("GimpThumbState", values);
+
+ return type;
+}
+
+
+/* Generated data ends here */
+
diff --git a/libgimpthumb/gimpthumb-enums.h b/libgimpthumb/gimpthumb-enums.h
new file mode 100644
index 0000000..8414673
--- /dev/null
+++ b/libgimpthumb/gimpthumb-enums.h
@@ -0,0 +1,118 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_THUMB_ENUMS_H__
+#define __GIMP_THUMB_ENUMS_H__
+
+G_BEGIN_DECLS
+
+
+/**
+ * SECTION: gimpthumb-enums
+ * @title: GimpThumb-enums
+ * @short_description: Enumerations used by libgimpthumb
+ *
+ * Enumerations used by libgimpthumb
+ **/
+
+
+/**
+ * GimpThumbFileType:
+ * @GIMP_THUMB_FILE_TYPE_NONE: file does not exist
+ * @GIMP_THUMB_FILE_TYPE_REGULAR: a regular file
+ * @GIMP_THUMB_FILE_TYPE_FOLDER: a directory
+ * @GIMP_THUMB_FILE_TYPE_SPECIAL: a special file (device node, fifo, socket, ...)
+ *
+ * File types as returned by gimp_thumb_file_test().
+ **/
+#define GIMP_TYPE_THUMB_FILE_TYPE (gimp_thumb_file_type_get_type ())
+
+GType gimp_thumb_file_type_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_THUMB_FILE_TYPE_NONE,
+ GIMP_THUMB_FILE_TYPE_REGULAR,
+ GIMP_THUMB_FILE_TYPE_FOLDER,
+ GIMP_THUMB_FILE_TYPE_SPECIAL
+} GimpThumbFileType;
+
+
+/**
+ * GimpThumbSize:
+ * @GIMP_THUMB_SIZE_FAIL: special size used to indicate a thumbnail
+ * creation failure
+ * @GIMP_THUMB_SIZE_NORMAL: normal thumbnail size (128 pixels)
+ * @GIMP_THUMB_SIZE_LARGE: large thumbnail size (256 pixels)
+ *
+ * Possible thumbnail sizes as defined by the Thumbnail Managing
+ * Standard.
+ **/
+#define GIMP_TYPE_THUMB_SIZE (gimp_thumb_size_get_type ())
+
+GType gimp_thumb_size_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_THUMB_SIZE_FAIL = 0,
+ GIMP_THUMB_SIZE_NORMAL = 128,
+ GIMP_THUMB_SIZE_LARGE = 256
+} GimpThumbSize;
+
+
+/**
+ * GimpThumbState:
+ * @GIMP_THUMB_STATE_UNKNOWN: nothing is known about the file/thumbnail
+ * @GIMP_THUMB_STATE_REMOTE: the file is on a remote file system
+ * @GIMP_THUMB_STATE_FOLDER: the file is a directory
+ * @GIMP_THUMB_STATE_SPECIAL: the file is a special file
+ * @GIMP_THUMB_STATE_NOT_FOUND: the file/thumbnail doesn't exist
+ * @GIMP_THUMB_STATE_EXISTS: the file/thumbnail exists
+ * @GIMP_THUMB_STATE_OLD: the thumbnail may be outdated
+ * @GIMP_THUMB_STATE_FAILED: the thumbnail couldn't be created
+ * @GIMP_THUMB_STATE_OK: the thumbnail exists and matches the image
+ *
+ * Possible image and thumbnail file states used by libgimpthumb.
+ **/
+#define GIMP_TYPE_THUMB_STATE (gimp_thumb_state_get_type ())
+
+GType gimp_thumb_state_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_THUMB_STATE_UNKNOWN,
+ GIMP_THUMB_STATE_REMOTE,
+ GIMP_THUMB_STATE_FOLDER,
+ GIMP_THUMB_STATE_SPECIAL,
+ GIMP_THUMB_STATE_NOT_FOUND,
+ GIMP_THUMB_STATE_EXISTS,
+ GIMP_THUMB_STATE_OLD,
+ GIMP_THUMB_STATE_FAILED,
+ GIMP_THUMB_STATE_OK
+} GimpThumbState;
+
+
+G_END_DECLS
+
+#endif /* __GIMP_THUMB_ENUMS_H__ */
diff --git a/libgimpthumb/gimpthumb-error.c b/libgimpthumb/gimpthumb-error.c
new file mode 100644
index 0000000..f4ab620
--- /dev/null
+++ b/libgimpthumb/gimpthumb-error.c
@@ -0,0 +1,52 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "gimpthumb-error.h"
+
+
+/**
+ * SECTION: gimpthumb-error
+ * @title: GimpThumb-error
+ * @short_description: Error codes used by libgimpthumb
+ *
+ * Error codes used by libgimpthumb
+ **/
+
+
+/**
+ * gimp_thumb_error_quark:
+ *
+ * This function is never called directly. Use GIMP_THUMB_ERROR() instead.
+ *
+ * Return value: the #GQuark that defines the GimpThumb error domain.
+ **/
+GQuark
+gimp_thumb_error_quark (void)
+{
+ return g_quark_from_static_string ("gimp-thumb-error-quark");
+}
diff --git a/libgimpthumb/gimpthumb-error.h b/libgimpthumb/gimpthumb-error.h
new file mode 100644
index 0000000..9dec6e8
--- /dev/null
+++ b/libgimpthumb/gimpthumb-error.h
@@ -0,0 +1,64 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_THUMB_H_INSIDE__) && !defined (GIMP_THUMB_COMPILATION)
+#error "Only <libgimpthumb/gimpthumb.h> can be included directly."
+#endif
+
+#ifndef __GIMP_THUMB_ERROR_H__
+#define __GIMP_THUMB_ERROR_H__
+
+G_BEGIN_DECLS
+
+
+/**
+ * GimpThumbError:
+ * @GIMP_THUMB_ERROR_OPEN: there was a problem opening the file
+ * @GIMP_THUMB_ERROR_OPEN_ENOENT: the file doesn't exist
+ * @GIMP_THUMB_ERROR_MKDIR: there was a problem creating a directory
+ *
+ * These are the possible error codes used when a #GError is set by
+ * libgimpthumb.
+ **/
+typedef enum
+{
+ GIMP_THUMB_ERROR_OPEN,
+ GIMP_THUMB_ERROR_OPEN_ENOENT,
+ GIMP_THUMB_ERROR_MKDIR
+} GimpThumbError;
+
+
+/**
+ * GIMP_THUMB_ERROR:
+ *
+ * Identifier for the libgimpthumb error domain.
+ **/
+#define GIMP_THUMB_ERROR (gimp_thumb_error_quark ())
+
+GQuark gimp_thumb_error_quark (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif /* __GIMP_THUMB_ERROR_H__ */
diff --git a/libgimpthumb/gimpthumb-types.h b/libgimpthumb/gimpthumb-types.h
new file mode 100644
index 0000000..29aa4e3
--- /dev/null
+++ b/libgimpthumb/gimpthumb-types.h
@@ -0,0 +1,38 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_THUMB_TYPES_H__
+#define __GIMP_THUMB_TYPES_H__
+
+
+#include <libgimpthumb/gimpthumb-enums.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GimpThumbnail GimpThumbnail;
+
+G_END_DECLS
+
+
+#endif /* __GIMP_THUMB_TYPES_H__ */
diff --git a/libgimpthumb/gimpthumb-utils.c b/libgimpthumb/gimpthumb-utils.c
new file mode 100644
index 0000000..59dd830
--- /dev/null
+++ b/libgimpthumb/gimpthumb-utils.c
@@ -0,0 +1,870 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef PLATFORM_OSX
+#include <AppKit/AppKit.h>
+#endif
+
+#include <gio/gio.h>
+#include <glib/gstdio.h>
+
+#ifdef G_OS_WIN32
+#include "libgimpbase/gimpwin32-io.h"
+#endif
+
+#include "gimpthumb-error.h"
+#include "gimpthumb-types.h"
+#include "gimpthumb-utils.h"
+
+#include "libgimp/libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpthumb-utils
+ * @title: GimpThumb-utils
+ * @short_description: Utility functions provided and used by libgimpthumb
+ *
+ * Utility functions provided and used by libgimpthumb
+ **/
+
+
+static gint gimp_thumb_size (GimpThumbSize size);
+static gchar * gimp_thumb_png_lookup (const gchar *name,
+ const gchar *basedir,
+ GimpThumbSize *size) G_GNUC_MALLOC;
+static const gchar * gimp_thumb_png_name (const gchar *uri);
+static void gimp_thumb_exit (void);
+
+
+
+static gboolean gimp_thumb_initialized = FALSE;
+static gint thumb_num_sizes = 0;
+static gint *thumb_sizes = NULL;
+static const gchar **thumb_sizenames = NULL;
+static gchar *thumb_dir = NULL;
+static gchar **thumb_subdirs = NULL;
+static gchar *thumb_fail_subdir = NULL;
+
+
+/**
+ * gimp_thumb_init:
+ * @creator: an ASCII string that identifies the thumbnail creator
+ * @thumb_basedir: an absolute path or %NULL to use the default
+ *
+ * This function initializes the thumbnail system. It must be called
+ * before any other functions from libgimpthumb are used. You may call
+ * it more than once if you want to change the @thumb_basedir but if
+ * you do that, you should make sure that no thread is still using the
+ * library. Apart from this function, libgimpthumb is multi-thread
+ * safe.
+ *
+ * The @creator string must be 7bit ASCII and should contain the name
+ * of the software that creates the thumbnails. It is used to handle
+ * thumbnail creation failures. See the spec for more details.
+ *
+ * Usually you will pass %NULL for @thumb_basedir. Thumbnails will
+ * then be stored in the user's personal thumbnail directory as
+ * defined in the spec. If you wish to use libgimpthumb to store
+ * application-specific thumbnails, you can specify a different base
+ * directory here.
+ *
+ * Return value: %TRUE if the library was successfully initialized.
+ **/
+gboolean
+gimp_thumb_init (const gchar *creator,
+ const gchar *thumb_basedir)
+{
+ GEnumClass *enum_class;
+ GEnumValue *enum_value;
+ gint i;
+
+ g_return_val_if_fail (creator != NULL, FALSE);
+ g_return_val_if_fail (thumb_basedir == NULL ||
+ g_path_is_absolute (thumb_basedir), FALSE);
+
+ if (gimp_thumb_initialized)
+ gimp_thumb_exit ();
+
+ if (thumb_basedir)
+ {
+ thumb_dir = g_strdup (thumb_basedir);
+ }
+ else
+ {
+#ifdef PLATFORM_OSX
+
+ NSAutoreleasePool *pool;
+ NSArray *path;
+ NSString *cache_dir;
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ path = NSSearchPathForDirectoriesInDomains (NSCachesDirectory,
+ NSUserDomainMask, YES);
+ cache_dir = [path objectAtIndex:0];
+
+ thumb_dir = g_build_filename ([cache_dir UTF8String], "org.freedesktop.thumbnails",
+ NULL);
+
+ [pool drain];
+
+#else
+
+ const gchar *cache_dir = g_get_user_cache_dir ();
+
+ if (cache_dir && g_file_test (cache_dir, G_FILE_TEST_IS_DIR))
+ {
+ thumb_dir = g_build_filename (cache_dir, "thumbnails", NULL);
+ }
+
+#endif
+
+ if (! thumb_dir)
+ {
+ gchar *name = g_filename_display_name (g_get_tmp_dir ());
+
+ g_message (_("Cannot determine a valid thumbnails directory.\n"
+ "Thumbnails will be stored in the folder for "
+ "temporary files (%s) instead."), name);
+ g_free (name);
+
+ thumb_dir = g_build_filename (g_get_tmp_dir (), ".thumbnails", NULL);
+ }
+ }
+
+ enum_class = g_type_class_ref (GIMP_TYPE_THUMB_SIZE);
+
+ thumb_num_sizes = enum_class->n_values;
+ thumb_sizes = g_new (gint, thumb_num_sizes);
+ thumb_sizenames = g_new (const gchar *, thumb_num_sizes);
+ thumb_subdirs = g_new (gchar *, thumb_num_sizes);
+
+ for (i = 0, enum_value = enum_class->values;
+ i < enum_class->n_values;
+ i++, enum_value++)
+ {
+ thumb_sizes[i] = enum_value->value;
+ thumb_sizenames[i] = enum_value->value_nick;
+ thumb_subdirs[i] = g_build_filename (thumb_dir,
+ enum_value->value_nick, NULL);
+ }
+
+ thumb_fail_subdir = thumb_subdirs[0];
+ thumb_subdirs[0] = g_build_filename (thumb_fail_subdir, creator, NULL);
+
+ g_type_class_unref (enum_class);
+
+ gimp_thumb_initialized = TRUE;
+
+ return gimp_thumb_initialized;
+}
+
+/**
+ * gimp_thumb_get_thumb_base_dir:
+ *
+ * Returns the base directory of thumbnails cache.
+ * It uses the Freedesktop Thumbnail Managing Standard on UNIX,
+ * "~/Library/Caches/org.freedesktop.thumbnails" on OSX, and a cache
+ * folder determined by glib on Windows (currently the common repository
+ * for temporary Internet files).
+ * The returned string belongs to GIMP and must not be changed nor freed.
+ *
+ * Returns: the thumbnails cache directory.
+ *
+ * Since: 2.10
+ **/
+const gchar *
+gimp_thumb_get_thumb_base_dir (void)
+{
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+
+ return thumb_dir;
+}
+
+/**
+ * gimp_thumb_get_thumb_dir:
+ * @size: a GimpThumbSize
+ *
+ * Retrieve the name of the thumbnail folder for a specific size. The
+ * returned pointer will become invalid if gimp_thumb_init() is used
+ * again. It must not be changed or freed.
+ *
+ * Return value: the thumbnail directory in the encoding of the filesystem
+ **/
+const gchar *
+gimp_thumb_get_thumb_dir (GimpThumbSize size)
+{
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+
+ size = gimp_thumb_size (size);
+
+ return thumb_subdirs[size];
+}
+
+/**
+ * gimp_thumb_get_thumb_dir_local:
+ * @dirname: the basename of the dir, without the actual dirname itself
+ * @size: a GimpThumbSize
+ *
+ * Retrieve the name of the local thumbnail folder for a specific
+ * size. Unlike gimp_thumb_get_thumb_dir() the returned string is not
+ * constant and should be free'd when it is not any longer needed.
+ *
+ * Return value: the thumbnail directory in the encoding of the filesystem
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_thumb_get_thumb_dir_local (const gchar *dirname,
+ GimpThumbSize size)
+{
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+ g_return_val_if_fail (dirname != NULL, NULL);
+ g_return_val_if_fail (size > GIMP_THUMB_SIZE_FAIL, NULL);
+
+ size = gimp_thumb_size (size);
+
+ return g_build_filename (dirname, thumb_sizenames[size], NULL);
+}
+
+/**
+ * gimp_thumb_ensure_thumb_dir:
+ * @size: a GimpThumbSize
+ * @error: return location for possible errors
+ *
+ * This function checks if the directory that is required to store
+ * thumbnails for a particular @size exist and attempts to create it
+ * if necessary.
+ *
+ * You shouldn't have to call this function directly since
+ * gimp_thumbnail_save_thumb() and gimp_thumbnail_save_failure() will
+ * do this for you.
+ *
+ * Return value: %TRUE is the directory exists, %FALSE if it could not
+ * be created
+ **/
+gboolean
+gimp_thumb_ensure_thumb_dir (GimpThumbSize size,
+ GError **error)
+{
+ g_return_val_if_fail (gimp_thumb_initialized, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ size = gimp_thumb_size (size);
+
+ if (g_file_test (thumb_subdirs[size], G_FILE_TEST_IS_DIR))
+ return TRUE;
+
+ if (g_file_test (thumb_dir, G_FILE_TEST_IS_DIR) ||
+ (g_mkdir_with_parents (thumb_dir, S_IRUSR | S_IWUSR | S_IXUSR) == 0))
+ {
+ if (size == 0)
+ g_mkdir_with_parents (thumb_fail_subdir, S_IRUSR | S_IWUSR | S_IXUSR);
+
+ g_mkdir_with_parents (thumb_subdirs[size], S_IRUSR | S_IWUSR | S_IXUSR);
+ }
+
+ if (g_file_test (thumb_subdirs[size], G_FILE_TEST_IS_DIR))
+ return TRUE;
+
+ g_set_error (error,
+ GIMP_THUMB_ERROR, GIMP_THUMB_ERROR_MKDIR,
+ _("Failed to create thumbnail folder '%s'."),
+ thumb_subdirs[size]);
+
+ return FALSE;
+}
+
+/**
+ * gimp_thumb_ensure_thumb_dir_local:
+ * @dirname: the basename of the dir, without the actual dirname itself
+ * @size: a GimpThumbSize
+ * @error: return location for possible errors
+ *
+ * This function checks if the directory that is required to store
+ * local thumbnails for a particular @size exist and attempts to
+ * create it if necessary.
+ *
+ * You shouldn't have to call this function directly since
+ * gimp_thumbnail_save_thumb_local() will do this for you.
+ *
+ * Return value: %TRUE is the directory exists, %FALSE if it could not
+ * be created
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_thumb_ensure_thumb_dir_local (const gchar *dirname,
+ GimpThumbSize size,
+ GError **error)
+{
+ gchar *basedir;
+ gchar *subdir;
+
+ g_return_val_if_fail (gimp_thumb_initialized, FALSE);
+ g_return_val_if_fail (dirname != NULL, FALSE);
+ g_return_val_if_fail (g_path_is_absolute (dirname), FALSE);
+ g_return_val_if_fail (size > GIMP_THUMB_SIZE_FAIL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ size = gimp_thumb_size (size);
+
+ subdir = g_build_filename (dirname,
+ ".thumblocal", thumb_sizenames[size],
+ NULL);
+
+ if (g_file_test (subdir, G_FILE_TEST_IS_DIR))
+ {
+ g_free (subdir);
+ return TRUE;
+ }
+
+ basedir = g_build_filename (dirname, ".thumblocal", NULL);
+
+ if (g_file_test (basedir, G_FILE_TEST_IS_DIR) ||
+ (g_mkdir (thumb_dir, S_IRUSR | S_IWUSR | S_IXUSR) == 0))
+ {
+ g_mkdir (subdir, S_IRUSR | S_IWUSR | S_IXUSR);
+ }
+
+ g_free (basedir);
+
+ if (g_file_test (subdir, G_FILE_TEST_IS_DIR))
+ {
+ g_free (subdir);
+ return TRUE;
+ }
+
+ g_set_error (error,
+ GIMP_THUMB_ERROR, GIMP_THUMB_ERROR_MKDIR,
+ _("Failed to create thumbnail folder '%s'."),
+ subdir);
+ g_free (subdir);
+
+ return FALSE;
+}
+
+/**
+ * gimp_thumb_name_from_uri:
+ * @uri: an escaped URI
+ * @size: a #GimpThumbSize
+ *
+ * Creates the name of the thumbnail file of the specified @size that
+ * belongs to an image file located at the given @uri.
+ *
+ * Return value: a newly allocated filename in the encoding of the
+ * filesystem or %NULL if @uri points to the user's
+ * thumbnail repository.
+ **/
+gchar *
+gimp_thumb_name_from_uri (const gchar *uri,
+ GimpThumbSize size)
+{
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ if (strstr (uri, thumb_dir))
+ return NULL;
+
+ size = gimp_thumb_size (size);
+
+ return g_build_filename (thumb_subdirs[size],
+ gimp_thumb_png_name (uri),
+ NULL);
+}
+
+/**
+ * gimp_thumb_name_from_uri_local:
+ * @uri: an escaped URI
+ * @size: a #GimpThumbSize
+ *
+ * Creates the name of a local thumbnail file of the specified @size
+ * that belongs to an image file located at the given @uri. Local
+ * thumbnails have been introduced with version 0.7 of the spec.
+ *
+ * Return value: a newly allocated filename in the encoding of the
+ * filesystem or %NULL if @uri is a remote file or
+ * points to the user's thumbnail repository.
+ *
+ * Since: 2.2
+ **/
+gchar *
+gimp_thumb_name_from_uri_local (const gchar *uri,
+ GimpThumbSize size)
+{
+ gchar *filename;
+ gchar *result = NULL;
+
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+ g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (size > GIMP_THUMB_SIZE_FAIL, NULL);
+
+ if (strstr (uri, thumb_dir))
+ return NULL;
+
+ filename = _gimp_thumb_filename_from_uri (uri);
+
+ if (filename)
+ {
+ const gchar *baseuri = strrchr (uri, '/');
+
+ if (baseuri && baseuri[0] && baseuri[1])
+ {
+ gchar *dirname = g_path_get_dirname (filename);
+ gint i = gimp_thumb_size (size);
+
+ result = g_build_filename (dirname,
+ ".thumblocal", thumb_sizenames[i],
+ gimp_thumb_png_name (uri),
+ NULL);
+
+ g_free (dirname);
+ }
+
+ g_free (filename);
+ }
+
+ return result;
+}
+
+/**
+ * gimp_thumb_find_thumb:
+ * @uri: an escaped URI
+ * @size: pointer to a #GimpThumbSize
+ *
+ * This function attempts to locate a thumbnail for the given
+ * @uri. First it tries the size that is stored at @size. If no
+ * thumbnail of that size is found, it will look for a larger
+ * thumbnail, then falling back to a smaller size.
+ *
+ * If the user's thumbnail repository doesn't provide a thumbnail but
+ * a local thumbnail repository exists for the folder the image is
+ * located in, the same search is done among the local thumbnails (if
+ * there are any).
+ *
+ * If a thumbnail is found, it's size is written to the variable
+ * pointer to by @size and the file location is returned.
+ *
+ * Return value: a newly allocated string in the encoding of the
+ * filesystem or %NULL if no thumbnail for @uri was found
+ **/
+gchar *
+gimp_thumb_find_thumb (const gchar *uri,
+ GimpThumbSize *size)
+{
+ gchar *result;
+
+ g_return_val_if_fail (gimp_thumb_initialized, NULL);
+ g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (size != NULL, NULL);
+ g_return_val_if_fail (*size > GIMP_THUMB_SIZE_FAIL, NULL);
+
+ result = gimp_thumb_png_lookup (gimp_thumb_png_name (uri), NULL, size);
+
+ if (! result)
+ {
+ gchar *filename = _gimp_thumb_filename_from_uri (uri);
+
+ if (filename)
+ {
+ const gchar *baseuri = strrchr (uri, '/');
+
+ if (baseuri && baseuri[0] && baseuri[1])
+ {
+ gchar *dirname = g_path_get_dirname (filename);
+
+ result = gimp_thumb_png_lookup (gimp_thumb_png_name (baseuri + 1),
+ dirname, size);
+
+ g_free (dirname);
+ }
+
+ g_free (filename);
+ }
+ }
+
+ return result;
+}
+
+/**
+ * gimp_thumb_file_test:
+ * @filename: a filename in the encoding of the filesystem
+ * @mtime: return location for modification time
+ * @size: return location for file size
+ * @err_no: return location for system "errno"
+ *
+ * This is a convenience and portability wrapper around stat(). It
+ * checks if the given @filename exists and returns modification time
+ * and file size in 64bit integer values.
+ *
+ * Return value: The type of the file, or #GIMP_THUMB_FILE_TYPE_NONE if
+ * the file doesn't exist.
+ **/
+GimpThumbFileType
+gimp_thumb_file_test (const gchar *filename,
+ gint64 *mtime,
+ gint64 *size,
+ gint *err_no)
+{
+ GimpThumbFileType type = GIMP_THUMB_FILE_TYPE_NONE;
+ GFile *file;
+ GFileInfo *info;
+
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ file = g_file_new_for_path (filename);
+
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE ","
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ G_FILE_QUERY_INFO_NONE,
+ NULL, NULL);
+
+ if (info)
+ {
+ if (mtime)
+ *mtime =
+ g_file_info_get_attribute_uint64 (info,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
+
+ if (size)
+ *size = g_file_info_get_size (info);
+
+ if (err_no)
+ *err_no = 0;
+
+ switch (g_file_info_get_attribute_uint32 (info,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE))
+ {
+ case G_FILE_TYPE_REGULAR:
+ type = GIMP_THUMB_FILE_TYPE_REGULAR;
+ break;
+
+ case G_FILE_TYPE_DIRECTORY:
+ type = GIMP_THUMB_FILE_TYPE_FOLDER;
+ break;
+
+ default:
+ type = GIMP_THUMB_FILE_TYPE_SPECIAL;
+ break;
+ }
+
+ g_object_unref (info);
+ }
+ else
+ {
+ if (mtime) *mtime = 0;
+ if (size) *size = 0;
+ if (err_no) *err_no = ENOENT;
+ }
+
+ g_object_unref (file);
+
+ return type;
+}
+
+/**
+ * gimp_thumbs_delete_for_uri:
+ * @uri: an escaped URI
+ *
+ * Deletes all thumbnails for the image file specified by @uri from the
+ * user's thumbnail repository.
+ *
+ * Since: 2.2
+ **/
+void
+gimp_thumbs_delete_for_uri (const gchar *uri)
+{
+ gint i;
+
+ g_return_if_fail (gimp_thumb_initialized);
+ g_return_if_fail (uri != NULL);
+
+ for (i = 0; i < thumb_num_sizes; i++)
+ {
+ gchar *filename = gimp_thumb_name_from_uri (uri, thumb_sizes[i]);
+
+ if (filename)
+ {
+ g_unlink (filename);
+ g_free (filename);
+ }
+ }
+}
+
+/**
+ * gimp_thumbs_delete_for_uri_local:
+ * @uri: an escaped URI
+ *
+ * Deletes all thumbnails for the image file specified by @uri from
+ * the local thumbnail repository.
+ *
+ * Since: 2.2
+ **/
+void
+gimp_thumbs_delete_for_uri_local (const gchar *uri)
+{
+ gint i;
+
+ g_return_if_fail (gimp_thumb_initialized);
+ g_return_if_fail (uri != NULL);
+
+ for (i = 0; i < thumb_num_sizes; i++)
+ {
+ gchar *filename = gimp_thumb_name_from_uri_local (uri, thumb_sizes[i]);
+
+ if (filename)
+ {
+ g_unlink (filename);
+ g_free (filename);
+ }
+ }
+}
+
+void
+_gimp_thumbs_delete_others (const gchar *uri,
+ GimpThumbSize size)
+{
+ gint i;
+
+ g_return_if_fail (gimp_thumb_initialized);
+ g_return_if_fail (uri != NULL);
+
+ size = gimp_thumb_size (size);
+
+ for (i = 0; i < thumb_num_sizes; i++)
+ {
+ gchar *filename;
+
+ if (i == size)
+ continue;
+
+ filename = gimp_thumb_name_from_uri (uri, thumb_sizes[i]);
+ if (filename)
+ {
+ g_unlink (filename);
+ g_free (filename);
+ }
+ }
+}
+
+gchar *
+_gimp_thumb_filename_from_uri (const gchar *uri)
+{
+ gchar *filename;
+ gchar *hostname;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ filename = g_filename_from_uri (uri, &hostname, NULL);
+
+ if (!filename)
+ return NULL;
+
+ if (hostname)
+ {
+ /* we have a file: URI with a hostname */
+
+#ifdef G_OS_WIN32
+ /* on Win32, create a valid UNC path and use it as the filename */
+ gchar *tmp = g_build_filename ("//", hostname, filename, NULL);
+
+ g_free (filename);
+ filename = tmp;
+#else
+ /* otherwise return NULL, caller should use URI then */
+ g_free (filename);
+ filename = NULL;
+#endif
+
+ g_free (hostname);
+ }
+
+ return filename;
+}
+
+static void
+gimp_thumb_exit (void)
+{
+ gint i;
+
+ g_free (thumb_dir);
+ g_free (thumb_sizes);
+ g_free (thumb_sizenames);
+ for (i = 0; i < thumb_num_sizes; i++)
+ g_free (thumb_subdirs[i]);
+ g_free (thumb_subdirs);
+ g_free (thumb_fail_subdir);
+
+ thumb_num_sizes = 0;
+ thumb_sizes = NULL;
+ thumb_sizenames = NULL;
+ thumb_dir = NULL;
+ thumb_subdirs = NULL;
+ thumb_fail_subdir = NULL;
+ gimp_thumb_initialized = FALSE;
+}
+
+static gint
+gimp_thumb_size (GimpThumbSize size)
+{
+ gint i = 0;
+
+ if (size > GIMP_THUMB_SIZE_FAIL)
+ {
+ for (i = 1;
+ i < thumb_num_sizes && thumb_sizes[i] < size;
+ i++)
+ /* nothing */;
+
+ if (i == thumb_num_sizes)
+ i--;
+ }
+
+ return i;
+}
+
+static gchar *
+gimp_thumb_png_lookup (const gchar *name,
+ const gchar *basedir,
+ GimpThumbSize *size)
+{
+ gchar *thumb_name = NULL;
+ gchar **subdirs = NULL;
+ gint i, n;
+
+ if (basedir)
+ {
+ gchar *dir = g_build_filename (basedir, ".thumblocal", NULL);
+
+ if (g_file_test (basedir, G_FILE_TEST_IS_DIR))
+ {
+ gint i;
+
+ subdirs = g_new (gchar *, thumb_num_sizes);
+
+ subdirs[0] = NULL; /* GIMP_THUMB_SIZE_FAIL */
+
+ for (i = 1; i < thumb_num_sizes; i++)
+ subdirs[i] = g_build_filename (dir, thumb_sizenames[i], NULL);
+ }
+
+ g_free (dir);
+ }
+ else
+ {
+ subdirs = thumb_subdirs;
+ }
+
+ if (! subdirs)
+ return NULL;
+
+ i = n = gimp_thumb_size (*size);
+
+ for (; i < thumb_num_sizes; i++)
+ {
+ if (! subdirs[i])
+ continue;
+
+ thumb_name = g_build_filename (subdirs[i], name, NULL);
+
+ if (gimp_thumb_file_test (thumb_name,
+ NULL, NULL,
+ NULL) == GIMP_THUMB_FILE_TYPE_REGULAR)
+ {
+ *size = thumb_sizes[i];
+ goto finish;
+ }
+
+ g_free (thumb_name);
+ }
+
+ for (i = n - 1; i >= 0; i--)
+ {
+ if (! subdirs[i])
+ continue;
+
+ thumb_name = g_build_filename (subdirs[i], name, NULL);
+
+ if (gimp_thumb_file_test (thumb_name,
+ NULL, NULL,
+ NULL) == GIMP_THUMB_FILE_TYPE_REGULAR)
+ {
+ *size = thumb_sizes[i];
+ goto finish;
+ }
+
+ g_free (thumb_name);
+ }
+
+ thumb_name = NULL;
+
+ finish:
+ if (basedir)
+ {
+ for (i = 0; i < thumb_num_sizes; i++)
+ g_free (subdirs[i]);
+ g_free (subdirs);
+ }
+
+ return thumb_name;
+}
+
+static const gchar *
+gimp_thumb_png_name (const gchar *uri)
+{
+ static gchar name[40];
+
+ GChecksum *checksum;
+ guchar digest[16];
+ gsize len = sizeof (digest);
+ gsize i;
+
+ checksum = g_checksum_new (G_CHECKSUM_MD5);
+ g_checksum_update (checksum, (const guchar *) uri, -1);
+ g_checksum_get_digest (checksum, digest, &len);
+ g_checksum_free (checksum);
+
+ for (i = 0; i < len; i++)
+ {
+ guchar n;
+
+ n = (digest[i] >> 4) & 0xF;
+ name[i * 2] = (n > 9) ? 'a' + n - 10 : '0' + n;
+
+ n = digest[i] & 0xF;
+ name[i * 2 + 1] = (n > 9) ? 'a' + n - 10 : '0' + n;
+ }
+
+ strncpy (name + 32, ".png", 5);
+
+ return (const gchar *) name;
+}
diff --git a/libgimpthumb/gimpthumb-utils.h b/libgimpthumb/gimpthumb-utils.h
new file mode 100644
index 0000000..7346e1a
--- /dev/null
+++ b/libgimpthumb/gimpthumb-utils.h
@@ -0,0 +1,73 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_THUMB_H_INSIDE__) && !defined (GIMP_THUMB_COMPILATION)
+#error "Only <libgimpthumb/gimpthumb.h> can be included directly."
+#endif
+
+#ifndef __GIMP_THUMB_UTILS_H__
+#define __GIMP_THUMB_UTILS_H__
+
+G_BEGIN_DECLS
+
+
+gboolean gimp_thumb_init (const gchar *creator,
+ const gchar *thumb_basedir);
+
+const gchar * gimp_thumb_get_thumb_base_dir (void);
+
+gchar * gimp_thumb_find_thumb (const gchar *uri,
+ GimpThumbSize *size) G_GNUC_MALLOC;
+
+GimpThumbFileType gimp_thumb_file_test (const gchar *filename,
+ gint64 *mtime,
+ gint64 *size,
+ gint *err_no);
+
+gchar * gimp_thumb_name_from_uri (const gchar *uri,
+ GimpThumbSize size) G_GNUC_MALLOC;
+const gchar * gimp_thumb_get_thumb_dir (GimpThumbSize size);
+gboolean gimp_thumb_ensure_thumb_dir (GimpThumbSize size,
+ GError **error);
+void gimp_thumbs_delete_for_uri (const gchar *uri);
+
+gchar * gimp_thumb_name_from_uri_local (const gchar *uri,
+ GimpThumbSize size) G_GNUC_MALLOC;
+gchar * gimp_thumb_get_thumb_dir_local (const gchar *dirname,
+ GimpThumbSize size) G_GNUC_MALLOC;
+gboolean gimp_thumb_ensure_thumb_dir_local (const gchar *dirname,
+ GimpThumbSize size,
+ GError **error);
+void gimp_thumbs_delete_for_uri_local (const gchar *uri);
+
+
+/* for internal use only */
+G_GNUC_INTERNAL void _gimp_thumbs_delete_others (const gchar *uri,
+ GimpThumbSize size);
+G_GNUC_INTERNAL gchar * _gimp_thumb_filename_from_uri (const gchar *uri);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_THUMB_UTILS_H__ */
diff --git a/libgimpthumb/gimpthumb.def b/libgimpthumb/gimpthumb.def
new file mode 100644
index 0000000..db8c44d
--- /dev/null
+++ b/libgimpthumb/gimpthumb.def
@@ -0,0 +1,32 @@
+EXPORTS
+ gimp_thumb_ensure_thumb_dir
+ gimp_thumb_ensure_thumb_dir_local
+ gimp_thumb_error_quark
+ gimp_thumb_file_test
+ gimp_thumb_file_type_get_type
+ gimp_thumb_find_thumb
+ gimp_thumb_get_thumb_base_dir
+ gimp_thumb_get_thumb_dir
+ gimp_thumb_get_thumb_dir_local
+ gimp_thumb_init
+ gimp_thumb_name_from_uri
+ gimp_thumb_name_from_uri_local
+ gimp_thumb_size_get_type
+ gimp_thumb_state_get_type
+ gimp_thumbnail_check_thumb
+ gimp_thumbnail_delete_failure
+ gimp_thumbnail_delete_others
+ gimp_thumbnail_get_type
+ gimp_thumbnail_has_failed
+ gimp_thumbnail_load_thumb
+ gimp_thumbnail_new
+ gimp_thumbnail_peek_image
+ gimp_thumbnail_peek_thumb
+ gimp_thumbnail_save_failure
+ gimp_thumbnail_save_thumb
+ gimp_thumbnail_save_thumb_local
+ gimp_thumbnail_set_filename
+ gimp_thumbnail_set_from_thumb
+ gimp_thumbnail_set_uri
+ gimp_thumbs_delete_for_uri
+ gimp_thumbs_delete_for_uri_local
diff --git a/libgimpthumb/gimpthumb.h b/libgimpthumb/gimpthumb.h
new file mode 100644
index 0000000..97a038a
--- /dev/null
+++ b/libgimpthumb/gimpthumb.h
@@ -0,0 +1,38 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_THUMB_H__
+#define __GIMP_THUMB_H__
+
+#define __GIMP_THUMB_H_INSIDE__
+
+#include <libgimpthumb/gimpthumb-types.h>
+
+#include <libgimpthumb/gimpthumb-error.h>
+#include <libgimpthumb/gimpthumb-utils.h>
+#include <libgimpthumb/gimpthumbnail.h>
+
+#undef __GIMP_THUMB_H_INSIDE__
+
+#endif /* __GIMP_THUMB_H__ */
diff --git a/libgimpthumb/gimpthumbnail.c b/libgimpthumb/gimpthumbnail.c
new file mode 100644
index 0000000..e7f9d3d
--- /dev/null
+++ b/libgimpthumb/gimpthumbnail.c
@@ -0,0 +1,1400 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2004 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <glib/gstdio.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpbase/gimpparam.h"
+
+#ifdef G_OS_WIN32
+#include "libgimpbase/gimpwin32-io.h"
+#include <process.h>
+#define _getpid getpid
+#endif
+
+#include "gimpthumb-types.h"
+#include "gimpthumb-error.h"
+#include "gimpthumb-utils.h"
+#include "gimpthumbnail.h"
+
+#include "libgimp/libgimp-intl.h"
+
+
+/**
+ * SECTION: gimpthumbnail
+ * @title: GimpThumbnail
+ * @short_description: The GimpThumbnail object
+ *
+ * The GimpThumbnail object
+ **/
+
+
+/* #define GIMP_THUMB_DEBUG */
+
+
+#if defined (GIMP_THUMB_DEBUG) && defined (__GNUC__)
+#define GIMP_THUMB_DEBUG_CALL(t) \
+ g_printerr ("%s: %s\n", \
+ __FUNCTION__, t->image_uri ? t->image_uri : "(null)")
+#else
+#define GIMP_THUMB_DEBUG_CALL(t) ((void)(0))
+#endif
+
+
+#define TAG_DESCRIPTION "tEXt::Description"
+#define TAG_SOFTWARE "tEXt::Software"
+#define TAG_THUMB_URI "tEXt::Thumb::URI"
+#define TAG_THUMB_MTIME "tEXt::Thumb::MTime"
+#define TAG_THUMB_FILESIZE "tEXt::Thumb::Size"
+#define TAG_THUMB_MIMETYPE "tEXt::Thumb::Mimetype"
+#define TAG_THUMB_IMAGE_WIDTH "tEXt::Thumb::Image::Width"
+#define TAG_THUMB_IMAGE_HEIGHT "tEXt::Thumb::Image::Height"
+#define TAG_THUMB_GIMP_TYPE "tEXt::Thumb::X-GIMP::Type"
+#define TAG_THUMB_GIMP_LAYERS "tEXt::Thumb::X-GIMP::Layers"
+
+
+enum
+{
+ PROP_0,
+ PROP_IMAGE_STATE,
+ PROP_IMAGE_URI,
+ PROP_IMAGE_MTIME,
+ PROP_IMAGE_FILESIZE,
+ PROP_IMAGE_MIMETYPE,
+ PROP_IMAGE_WIDTH,
+ PROP_IMAGE_HEIGHT,
+ PROP_IMAGE_TYPE,
+ PROP_IMAGE_NUM_LAYERS,
+ PROP_THUMB_STATE
+};
+
+
+static void gimp_thumbnail_finalize (GObject *object);
+static void gimp_thumbnail_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_thumbnail_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_thumbnail_reset_info (GimpThumbnail *thumbnail);
+
+static void gimp_thumbnail_update_image (GimpThumbnail *thumbnail);
+static void gimp_thumbnail_update_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size);
+
+static gboolean gimp_thumbnail_save (GimpThumbnail *thumbnail,
+ GimpThumbSize size,
+ const gchar *filename,
+ GdkPixbuf *pixbuf,
+ const gchar *software,
+ GError **error);
+#ifdef GIMP_THUMB_DEBUG
+static void gimp_thumbnail_debug_notify (GObject *object,
+ GParamSpec *pspec);
+#endif
+
+
+G_DEFINE_TYPE (GimpThumbnail, gimp_thumbnail, G_TYPE_OBJECT)
+
+#define parent_class gimp_thumbnail_parent_class
+
+
+static void
+gimp_thumbnail_class_init (GimpThumbnailClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gimp_thumbnail_finalize;
+ object_class->set_property = gimp_thumbnail_set_property;
+ object_class->get_property = gimp_thumbnail_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_STATE,
+ g_param_spec_enum ("image-state", NULL,
+ "State of the image associated to the thumbnail object",
+ GIMP_TYPE_THUMB_STATE,
+ GIMP_THUMB_STATE_UNKNOWN,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_URI,
+ g_param_spec_string ("image-uri", NULL,
+ "URI of the image file",
+ NULL,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_MTIME,
+ g_param_spec_int64 ("image-mtime", NULL,
+ "Modification time of the image file in seconds since the Epoch",
+ G_MININT64, G_MAXINT64, 0,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_FILESIZE,
+ g_param_spec_int64 ("image-filesize", NULL,
+ "Size of the image file in bytes",
+ 0, G_MAXINT64, 0,
+ GIMP_PARAM_READWRITE));
+ /**
+ * GimpThumbnail::image-mimetype:
+ *
+ * Image mimetype
+ *
+ * Since: 2.2
+ **/
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_MIMETYPE,
+ g_param_spec_string ("image-mimetype", NULL,
+ "Image mimetype",
+ NULL,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_WIDTH,
+ g_param_spec_int ("image-width", NULL,
+ "Width of the image in pixels",
+ 0, G_MAXINT, 0,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_HEIGHT,
+ g_param_spec_int ("image-height", NULL,
+ "Height of the image in pixels",
+ 0, G_MAXINT, 0,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_TYPE,
+ g_param_spec_string ("image-type", NULL,
+ "String describing the type of the image format",
+ NULL,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IMAGE_NUM_LAYERS,
+ g_param_spec_int ("image-num-layers", NULL,
+ "The number of layers in the image",
+ 0, G_MAXINT, 0,
+ GIMP_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_THUMB_STATE,
+ g_param_spec_enum ("thumb-state", NULL,
+ "State of the thumbnail file",
+ GIMP_TYPE_THUMB_STATE,
+ GIMP_THUMB_STATE_UNKNOWN,
+ GIMP_PARAM_READWRITE));
+}
+
+static void
+gimp_thumbnail_init (GimpThumbnail *thumbnail)
+{
+ thumbnail->image_state = GIMP_THUMB_STATE_UNKNOWN;
+ thumbnail->image_uri = NULL;
+ thumbnail->image_filename = NULL;
+ thumbnail->image_mtime = 0;
+ thumbnail->image_filesize = 0;
+ thumbnail->image_mimetype = NULL;
+ thumbnail->image_width = 0;
+ thumbnail->image_height = 0;
+ thumbnail->image_type = NULL;
+ thumbnail->image_num_layers = 0;
+
+ thumbnail->thumb_state = GIMP_THUMB_STATE_UNKNOWN;
+ thumbnail->thumb_size = -1;
+ thumbnail->thumb_filename = NULL;
+ thumbnail->thumb_mtime = 0;
+ thumbnail->thumb_filesize = 0;
+
+#ifdef GIMP_THUMB_DEBUG
+ g_signal_connect (thumbnail, "notify",
+ G_CALLBACK (gimp_thumbnail_debug_notify),
+ NULL);
+#endif
+}
+
+static void
+gimp_thumbnail_finalize (GObject *object)
+{
+ GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);
+
+ g_clear_pointer (&thumbnail->image_uri, g_free);
+ g_clear_pointer (&thumbnail->image_filename, g_free);
+ g_clear_pointer (&thumbnail->image_mimetype, g_free);
+ g_clear_pointer (&thumbnail->image_type, g_free);
+ g_clear_pointer (&thumbnail->thumb_filename, g_free);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_thumbnail_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);
+
+ switch (property_id)
+ {
+ case PROP_IMAGE_STATE:
+ thumbnail->image_state = g_value_get_enum (value);
+ break;
+ case PROP_IMAGE_URI:
+ gimp_thumbnail_set_uri (GIMP_THUMBNAIL (object),
+ g_value_get_string (value));
+ break;
+ case PROP_IMAGE_MTIME:
+ thumbnail->image_mtime = g_value_get_int64 (value);
+ break;
+ case PROP_IMAGE_FILESIZE:
+ thumbnail->image_filesize = g_value_get_int64 (value);
+ break;
+ case PROP_IMAGE_MIMETYPE:
+ g_free (thumbnail->image_mimetype);
+ thumbnail->image_mimetype = g_value_dup_string (value);
+ break;
+ case PROP_IMAGE_WIDTH:
+ thumbnail->image_width = g_value_get_int (value);
+ break;
+ case PROP_IMAGE_HEIGHT:
+ thumbnail->image_height = g_value_get_int (value);
+ break;
+ case PROP_IMAGE_TYPE:
+ g_free (thumbnail->image_type);
+ thumbnail->image_type = g_value_dup_string (value);
+ break;
+ case PROP_IMAGE_NUM_LAYERS:
+ thumbnail->image_num_layers = g_value_get_int (value);
+ break;
+ case PROP_THUMB_STATE:
+ thumbnail->thumb_state = g_value_get_enum (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_thumbnail_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object);
+
+ switch (property_id)
+ {
+ case PROP_IMAGE_STATE:
+ g_value_set_enum (value, thumbnail->image_state);
+ break;
+ case PROP_IMAGE_URI:
+ g_value_set_string (value, thumbnail->image_uri);
+ break;
+ case PROP_IMAGE_MTIME:
+ g_value_set_int64 (value, thumbnail->image_mtime);
+ break;
+ case PROP_IMAGE_FILESIZE:
+ g_value_set_int64 (value, thumbnail->image_filesize);
+ break;
+ case PROP_IMAGE_MIMETYPE:
+ g_value_set_string (value, thumbnail->image_mimetype);
+ break;
+ case PROP_IMAGE_WIDTH:
+ g_value_set_int (value, thumbnail->image_width);
+ break;
+ case PROP_IMAGE_HEIGHT:
+ g_value_set_int (value, thumbnail->image_height);
+ break;
+ case PROP_IMAGE_TYPE:
+ g_value_set_string (value, thumbnail->image_type);
+ break;
+ case PROP_IMAGE_NUM_LAYERS:
+ g_value_set_int (value, thumbnail->image_num_layers);
+ break;
+ case PROP_THUMB_STATE:
+ g_value_set_enum (value, thumbnail->thumb_state);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+/**
+ * gimp_thumbnail_new:
+ *
+ * Creates a new #GimpThumbnail object.
+ *
+ * Return value: a newly allocated GimpThumbnail object
+ **/
+GimpThumbnail *
+gimp_thumbnail_new (void)
+{
+ return g_object_new (GIMP_TYPE_THUMBNAIL, NULL);
+}
+
+/**
+ * gimp_thumbnail_set_uri:
+ * @thumbnail: a #GimpThumbnail object
+ * @uri: an escaped URI
+ *
+ * Sets the location of the image file associated with the #thumbnail.
+ *
+ * All information stored in the #GimpThumbnail is reset.
+ **/
+void
+gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
+ const gchar *uri)
+{
+ g_return_if_fail (GIMP_IS_THUMBNAIL (thumbnail));
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ if (thumbnail->image_uri)
+ g_free (thumbnail->image_uri);
+
+ thumbnail->image_uri = g_strdup (uri);
+
+ g_clear_pointer (&thumbnail->image_filename, g_free);
+ g_clear_pointer (&thumbnail->thumb_filename, g_free);
+
+ thumbnail->thumb_size = -1;
+ thumbnail->thumb_filesize = 0;
+ thumbnail->thumb_mtime = 0;
+
+ g_object_set (thumbnail,
+ "image-state", GIMP_THUMB_STATE_UNKNOWN,
+ "image-filesize", (gint64) 0,
+ "image-mtime", (gint64) 0,
+ "image-mimetype", NULL,
+ "image-width", 0,
+ "image-height", 0,
+ "image-type", NULL,
+ "image-num-layers", 0,
+ "thumb-state", GIMP_THUMB_STATE_UNKNOWN,
+ NULL);
+}
+
+/**
+ * gimp_thumbnail_set_filename:
+ * @thumbnail: a #GimpThumbnail object
+ * @filename: a local filename in the encoding of the filesystem
+ * @error: return location for possible errors
+ *
+ * Sets the location of the image file associated with the #thumbnail.
+ *
+ * Return value: %TRUE if the filename was successfully set,
+ * %FALSE otherwise
+ **/
+gboolean
+gimp_thumbnail_set_filename (GimpThumbnail *thumbnail,
+ const gchar *filename,
+ GError **error)
+{
+ gchar *uri = NULL;
+
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ if (filename)
+ uri = g_filename_to_uri (filename, NULL, error);
+
+ gimp_thumbnail_set_uri (thumbnail, uri);
+
+ g_free (uri);
+
+ return (!filename || uri);
+}
+
+/**
+ * gimp_thumbnail_set_from_thumb:
+ * @thumbnail: a #GimpThumbnail object
+ * @filename: filename of a local thumbnail file
+ * @error: return location for possible errors
+ *
+ * This function tries to load the thumbnail file pointed to by
+ * @filename and retrieves the URI of the original image file from
+ * it. This allows you to find the image file associated with a
+ * thumbnail file.
+ *
+ * This will only work with thumbnails from the global thumbnail
+ * directory that contain a valid Thumb::URI tag.
+ *
+ * Return value: %TRUE if the pixbuf could be loaded, %FALSE otherwise
+ **/
+gboolean
+gimp_thumbnail_set_from_thumb (GimpThumbnail *thumbnail,
+ const gchar *filename,
+ GError **error)
+{
+ GdkPixbuf *pixbuf;
+ const gchar *uri;
+
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE);
+ g_return_val_if_fail (filename != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ pixbuf = gdk_pixbuf_new_from_file (filename, error);
+ if (! pixbuf)
+ return FALSE;
+
+ uri = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI);
+ if (! uri)
+ {
+ g_set_error (error, GIMP_THUMB_ERROR, 0,
+ _("Thumbnail contains no Thumb::URI tag"));
+ g_object_unref (pixbuf);
+ return FALSE;
+ }
+
+ gimp_thumbnail_set_uri (thumbnail, uri);
+ g_object_unref (pixbuf);
+
+ return TRUE;
+}
+
+/**
+ * gimp_thumbnail_peek_image:
+ * @thumbnail: a #GimpThumbnail object
+ *
+ * Checks the image file associated with the @thumbnail and updates
+ * information such as state, filesize and modification time.
+ *
+ * Return value: the image's #GimpThumbState after the update
+ **/
+GimpThumbState
+gimp_thumbnail_peek_image (GimpThumbnail *thumbnail)
+{
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail),
+ GIMP_THUMB_STATE_UNKNOWN);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ gimp_thumbnail_update_image (thumbnail);
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+
+ return thumbnail->image_state;
+}
+
+/**
+ * gimp_thumbnail_peek_thumb:
+ * @thumbnail: a #GimpThumbnail object
+ * @size: the preferred size of the thumbnail image
+ *
+ * Checks if a thumbnail file for the @thumbnail exists. It doesn't
+ * load the thumbnail image and thus cannot check if the thumbnail is
+ * valid and uptodate for the image file asosciated with the
+ * @thumbnail.
+ *
+ * If you want to check the thumbnail, either attempt to load it using
+ * gimp_thumbnail_load_thumb(), or, if you don't need the resulting
+ * thumbnail pixbuf, use gimp_thumbnail_check_thumb().
+ *
+ * Return value: the thumbnail's #GimpThumbState after the update
+ **/
+GimpThumbState
+gimp_thumbnail_peek_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size)
+{
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail),
+ GIMP_THUMB_STATE_UNKNOWN);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ gimp_thumbnail_update_image (thumbnail);
+ gimp_thumbnail_update_thumb (thumbnail, size);
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+
+ return thumbnail->thumb_state;
+}
+
+/**
+ * gimp_thumbnail_check_thumb:
+ * @thumbnail: a #GimpThumbnail object
+ * @size: the preferred size of the thumbnail image
+ *
+ * Checks if a thumbnail file for the @thumbnail exists, loads it and
+ * verifies it is valid and uptodate for the image file asosciated
+ * with the @thumbnail.
+ *
+ * Return value: the thumbnail's #GimpThumbState after the update
+ *
+ * Since: 2.2
+ **/
+GimpThumbState
+gimp_thumbnail_check_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size)
+{
+ GdkPixbuf *pixbuf;
+
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ if (gimp_thumbnail_peek_thumb (thumbnail, size) == GIMP_THUMB_STATE_OK)
+ return GIMP_THUMB_STATE_OK;
+
+ pixbuf = gimp_thumbnail_load_thumb (thumbnail, size, NULL);
+
+ if (pixbuf)
+ g_object_unref (pixbuf);
+
+ return thumbnail->thumb_state;
+}
+
+static void
+gimp_thumbnail_update_image (GimpThumbnail *thumbnail)
+{
+ GimpThumbState state;
+ gint64 mtime = 0;
+ gint64 filesize = 0;
+
+ if (! thumbnail->image_uri)
+ return;
+
+ state = thumbnail->image_state;
+
+ switch (state)
+ {
+ case GIMP_THUMB_STATE_UNKNOWN:
+ g_return_if_fail (thumbnail->image_filename == NULL);
+
+ thumbnail->image_filename =
+ _gimp_thumb_filename_from_uri (thumbnail->image_uri);
+
+ if (! thumbnail->image_filename)
+ state = GIMP_THUMB_STATE_REMOTE;
+
+ break;
+
+ case GIMP_THUMB_STATE_REMOTE:
+ break;
+
+ default:
+ g_return_if_fail (thumbnail->image_filename != NULL);
+ break;
+ }
+
+ switch (state)
+ {
+ case GIMP_THUMB_STATE_REMOTE:
+ break;
+
+ default:
+ switch (gimp_thumb_file_test (thumbnail->image_filename,
+ &mtime, &filesize,
+ &thumbnail->image_not_found_errno))
+ {
+ case GIMP_THUMB_FILE_TYPE_REGULAR:
+ state = GIMP_THUMB_STATE_EXISTS;
+ break;
+
+ case GIMP_THUMB_FILE_TYPE_FOLDER:
+ state = GIMP_THUMB_STATE_FOLDER;
+ break;
+
+ case GIMP_THUMB_FILE_TYPE_SPECIAL:
+ state = GIMP_THUMB_STATE_SPECIAL;
+ break;
+
+ default:
+ state = GIMP_THUMB_STATE_NOT_FOUND;
+ break;
+ }
+ break;
+ }
+
+ if (state != thumbnail->image_state)
+ {
+ g_object_set (thumbnail,
+ "image-state", state,
+ NULL);
+ }
+
+ if (mtime != thumbnail->image_mtime || filesize != thumbnail->image_filesize)
+ {
+ g_object_set (thumbnail,
+ "image-mtime", mtime,
+ "image-filesize", filesize,
+ NULL);
+
+ if (thumbnail->thumb_state == GIMP_THUMB_STATE_OK)
+ g_object_set (thumbnail,
+ "thumb-state", GIMP_THUMB_STATE_OLD,
+ NULL);
+ }
+}
+
+static void
+gimp_thumbnail_update_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size)
+{
+ gchar *filename;
+ GimpThumbState state;
+ gint64 filesize = 0;
+ gint64 mtime = 0;
+
+ if (! thumbnail->image_uri)
+ return;
+
+ state = thumbnail->thumb_state;
+
+ filename = gimp_thumb_find_thumb (thumbnail->image_uri, &size);
+
+ /* We don't want to clear the GIMP_THUMB_STATE_FAILED state, because
+ * it is normal to have no filename if thumbnail creation failed. */
+ if (state != GIMP_THUMB_STATE_FAILED && ! filename)
+ state = GIMP_THUMB_STATE_NOT_FOUND;
+
+ switch (state)
+ {
+ case GIMP_THUMB_STATE_EXISTS:
+ case GIMP_THUMB_STATE_OLD:
+ case GIMP_THUMB_STATE_OK:
+ g_return_if_fail (thumbnail->thumb_filename != NULL);
+
+ if (thumbnail->thumb_size == size &&
+ thumbnail->thumb_filesize == filesize &&
+ thumbnail->thumb_mtime == mtime)
+ {
+ g_free (filename);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (thumbnail->thumb_filename)
+ g_free (thumbnail->thumb_filename);
+
+ thumbnail->thumb_filename = filename;
+
+ if (filename)
+ state = (size > GIMP_THUMB_SIZE_FAIL ?
+ GIMP_THUMB_STATE_EXISTS : GIMP_THUMB_STATE_FAILED);
+
+ thumbnail->thumb_size = size;
+ thumbnail->thumb_filesize = filesize;
+ thumbnail->thumb_mtime = mtime;
+
+ if (state != thumbnail->thumb_state)
+ {
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ g_object_set (thumbnail, "thumb-state", state, NULL);
+ gimp_thumbnail_reset_info (thumbnail);
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+ }
+}
+
+static void
+gimp_thumbnail_reset_info (GimpThumbnail *thumbnail)
+{
+ g_object_set (thumbnail,
+ "image-width", 0,
+ "image-height", 0,
+ "image-type", NULL,
+ "image-num-layers", 0,
+ NULL);
+}
+
+static void
+gimp_thumbnail_set_info_from_pixbuf (GimpThumbnail *thumbnail,
+ GdkPixbuf *pixbuf)
+{
+ const gchar *option;
+ gint num;
+
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ gimp_thumbnail_reset_info (thumbnail);
+
+ g_free (thumbnail->image_mimetype);
+ thumbnail->image_mimetype =
+ g_strdup (gdk_pixbuf_get_option (pixbuf, TAG_THUMB_MIMETYPE));
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_IMAGE_WIDTH);
+ if (option && sscanf (option, "%d", &num) == 1)
+ thumbnail->image_width = num;
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_IMAGE_HEIGHT);
+ if (option && sscanf (option, "%d", &num) == 1)
+ thumbnail->image_height = num;
+
+ thumbnail->image_type =
+ g_strdup (gdk_pixbuf_get_option (pixbuf, TAG_THUMB_GIMP_TYPE));
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_GIMP_LAYERS);
+ if (option && sscanf (option, "%d", &num) == 1)
+ thumbnail->image_num_layers = num;
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+}
+
+static gboolean
+gimp_thumbnail_save (GimpThumbnail *thumbnail,
+ GimpThumbSize size,
+ const gchar *filename,
+ GdkPixbuf *pixbuf,
+ const gchar *software,
+ GError **error)
+{
+ const gchar *keys[12];
+ gchar *values[12];
+ gchar *basename;
+ gchar *dirname;
+ gchar *tmpname;
+ gboolean success;
+ gint i = 0;
+
+ keys[i] = TAG_DESCRIPTION;
+ values[i] = g_strdup_printf ("Thumbnail of %s", thumbnail->image_uri);
+ i++;
+
+ keys[i] = TAG_SOFTWARE;
+ values[i] = g_strdup (software);
+ i++;
+
+ keys[i] = TAG_THUMB_URI;
+ values[i] = g_strdup (thumbnail->image_uri);
+ i++;
+
+ keys[i] = TAG_THUMB_MTIME;
+ values[i] = g_strdup_printf ("%" G_GINT64_FORMAT, thumbnail->image_mtime);
+ i++;
+
+ keys[i] = TAG_THUMB_FILESIZE;
+ values[i] = g_strdup_printf ("%" G_GINT64_FORMAT, thumbnail->image_filesize);
+ i++;
+
+ if (thumbnail->image_mimetype)
+ {
+ keys[i] = TAG_THUMB_MIMETYPE;
+ values[i] = g_strdup (thumbnail->image_mimetype);
+ i++;
+ }
+
+ if (thumbnail->image_width > 0)
+ {
+ keys[i] = TAG_THUMB_IMAGE_WIDTH;
+ values[i] = g_strdup_printf ("%d", thumbnail->image_width);
+ i++;
+ }
+
+ if (thumbnail->image_height > 0)
+ {
+ keys[i] = TAG_THUMB_IMAGE_HEIGHT;
+ values[i] = g_strdup_printf ("%d", thumbnail->image_height);
+ i++;
+ }
+
+ if (thumbnail->image_type)
+ {
+ keys[i] = TAG_THUMB_GIMP_TYPE;
+ values[i] = g_strdup (thumbnail->image_type);
+ i++;
+ }
+
+ if (thumbnail->image_num_layers > 0)
+ {
+ keys[i] = TAG_THUMB_GIMP_LAYERS;
+ values[i] = g_strdup_printf ("%d", thumbnail->image_num_layers);
+ i++;
+ }
+
+ keys[i] = NULL;
+ values[i] = NULL;
+
+ basename = g_path_get_basename (filename);
+ dirname = g_path_get_dirname (filename);
+
+ tmpname = g_strdup_printf ("%s%cgimp-thumb-%d-%.8s",
+ dirname, G_DIR_SEPARATOR, getpid (), basename);
+
+ g_free (dirname);
+ g_free (basename);
+
+ success = gdk_pixbuf_savev (pixbuf, tmpname, "png",
+ (gchar **) keys, values,
+ error);
+
+ for (i = 0; keys[i]; i++)
+ g_free (values[i]);
+
+ if (success)
+ {
+#ifdef GIMP_THUMB_DEBUG
+ g_printerr ("thumbnail saved to temporary file %s\n", tmpname);
+#endif
+
+ success = (g_rename (tmpname, filename) == 0);
+
+ if (! success)
+ g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
+ _("Could not create thumbnail for %s: %s"),
+ thumbnail->image_uri, g_strerror (errno));
+ }
+
+ if (success)
+ {
+#ifdef GIMP_THUMB_DEBUG
+ g_printerr ("temporary thumbnail file renamed to %s\n", filename);
+#endif
+
+ success = (g_chmod (filename, 0600) == 0);
+
+ if (! success)
+ g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
+ "Could not set permissions of thumbnail for %s: %s",
+ thumbnail->image_uri, g_strerror (errno));
+
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ gimp_thumbnail_update_thumb (thumbnail, size);
+
+ if (success &&
+ thumbnail->thumb_state == GIMP_THUMB_STATE_EXISTS &&
+ strcmp (filename, thumbnail->thumb_filename) == 0)
+ {
+ thumbnail->thumb_state = GIMP_THUMB_STATE_OK;
+ }
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+ }
+
+ g_unlink (tmpname);
+ g_free (tmpname);
+
+ return success;
+}
+
+#ifdef GIMP_THUMB_DEBUG
+static void
+gimp_thumbnail_debug_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ GValue value = G_VALUE_INIT;
+ gchar *str = NULL;
+ const gchar *name;
+
+ g_value_init (&value, pspec->value_type);
+ g_object_get_property (object, pspec->name, &value);
+
+ if (G_VALUE_HOLDS_STRING (&value))
+ {
+ str = g_value_dup_string (&value);
+ }
+ else if (g_value_type_transformable (pspec->value_type, G_TYPE_STRING))
+ {
+ GValue tmp = G_VALUE_INIT;
+
+ g_value_init (&tmp, G_TYPE_STRING);
+ g_value_transform (&value, &tmp);
+
+ str = g_value_dup_string (&tmp);
+
+ g_value_unset (&tmp);
+ }
+
+ g_value_unset (&value);
+
+ name = GIMP_THUMBNAIL (object)->image_uri;
+
+ g_printerr (" GimpThumb (%s) %s: %s\n",
+ name ? name : "(null)", pspec->name, str);
+
+ g_free (str);
+}
+#endif
+
+
+/**
+ * gimp_thumbnail_load_thumb:
+ * @thumbnail: a #GimpThumbnail object
+ * @size: the preferred #GimpThumbSize for the preview
+ * @error: return location for possible errors
+ *
+ * Attempts to load a thumbnail preview for the image associated with
+ * @thumbnail. Before you use this function you need need to set an
+ * image location using gimp_thumbnail_set_uri() or
+ * gimp_thumbnail_set_filename(). You can also peek at the thumb
+ * before loading it using gimp_thumbnail_peek_thumb.
+ *
+ * This function will return the best matching pixbuf for the
+ * specified @size. It returns the pixbuf as loaded from disk. It is
+ * left to the caller to scale it to the desired size. The returned
+ * pixbuf may also represent an outdated preview of the image file.
+ * In order to verify if the preview is uptodate, you should check the
+ * "thumb_state" property after calling this function.
+ *
+ * Return value: a preview pixbuf or %NULL if no thumbnail was found
+ **/
+GdkPixbuf *
+gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size,
+ GError **error)
+{
+ GimpThumbState state;
+ GdkPixbuf *pixbuf;
+ const gchar *option;
+ gint64 image_mtime;
+ gint64 image_size;
+
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), NULL);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ if (! thumbnail->image_uri)
+ return NULL;
+
+ state = gimp_thumbnail_peek_thumb (thumbnail, size);
+
+ if (state < GIMP_THUMB_STATE_EXISTS || state == GIMP_THUMB_STATE_FAILED)
+ return NULL;
+
+ pixbuf = gdk_pixbuf_new_from_file (thumbnail->thumb_filename, NULL);
+ if (! pixbuf)
+ return NULL;
+
+#ifdef GIMP_THUMB_DEBUG
+ g_printerr ("thumbnail loaded from %s\n", thumbnail->thumb_filename);
+#endif
+
+ g_object_freeze_notify (G_OBJECT (thumbnail));
+
+ /* URI and mtime from the thumbnail need to match our file */
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI);
+ if (!option)
+ goto finish;
+
+ if (strcmp (option, thumbnail->image_uri))
+ {
+ /* might be a local thumbnail, try if the local part matches */
+ const gchar *baseuri = strrchr (thumbnail->image_uri, '/');
+
+ if (!baseuri || strcmp (option, baseuri))
+ goto finish;
+ }
+
+ state = GIMP_THUMB_STATE_OLD;
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_MTIME);
+ if (!option || sscanf (option, "%" G_GINT64_FORMAT, &image_mtime) != 1)
+ goto finish;
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_FILESIZE);
+ if (option && sscanf (option, "%" G_GINT64_FORMAT, &image_size) != 1)
+ goto finish;
+
+ /* TAG_THUMB_FILESIZE is optional but must match if present */
+ if (image_mtime == thumbnail->image_mtime &&
+ (option == NULL || image_size == thumbnail->image_filesize))
+ {
+ if (thumbnail->thumb_size == GIMP_THUMB_SIZE_FAIL)
+ state = GIMP_THUMB_STATE_FAILED;
+ else
+ state = GIMP_THUMB_STATE_OK;
+ }
+
+ if (state == GIMP_THUMB_STATE_FAILED)
+ gimp_thumbnail_reset_info (thumbnail);
+ else
+ gimp_thumbnail_set_info_from_pixbuf (thumbnail, pixbuf);
+
+ finish:
+ if (thumbnail->thumb_size == GIMP_THUMB_SIZE_FAIL ||
+ (state != GIMP_THUMB_STATE_OLD && state != GIMP_THUMB_STATE_OK))
+ {
+ g_object_unref (pixbuf);
+ pixbuf = NULL;
+ }
+
+ g_object_set (thumbnail,
+ "thumb-state", state,
+ NULL);
+
+ g_object_thaw_notify (G_OBJECT (thumbnail));
+
+ return pixbuf;
+}
+
+/**
+ * gimp_thumbnail_save_thumb:
+ * @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 global thumbnail repository.
+ *
+ * The caller is responsible for setting the image file location, it's
+ * filesize, modification time. One way to set this info is to is to
+ * call gimp_thumbnail_set_uri() followed by gimp_thumbnail_peek_image().
+ * Since this won't work for remote images, it is left to the user of
+ * gimp_thumbnail_save_thumb() to do this or to set the information
+ * using the @thumbnail object properties.
+ *
+ * The image format type and the number of layers can optionally be
+ * set in order to be stored with the preview image.
+ *
+ * Return value: %TRUE if a thumbnail was successfully written,
+ * %FALSE otherwise
+ **/
+gboolean
+gimp_thumbnail_save_thumb (GimpThumbnail *thumbnail,
+ GdkPixbuf *pixbuf,
+ const gchar *software,
+ GError **error)
+{
+ GimpThumbSize size;
+ gchar *name;
+ 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;
+
+ name = gimp_thumb_name_from_uri (thumbnail->image_uri, size);
+ if (! name)
+ return TRUE;
+
+ if (! gimp_thumb_ensure_thumb_dir (size, error))
+ {
+ g_free (name);
+ return FALSE;
+ }
+
+ success = gimp_thumbnail_save (thumbnail,
+ size, name, pixbuf, software,
+ error);
+ g_free (name);
+
+ return success;
+}
+
+/**
+ * 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;
+}
+
+/**
+ * gimp_thumbnail_save_failure:
+ * @thumbnail: a #GimpThumbnail object
+ * @software: a string describing the software saving the thumbnail
+ * @error: return location for possible errors
+ *
+ * Saves a failure thumbnail for the image associated with
+ * @thumbnail. This is an empty pixbuf that indicates that an attempt
+ * to create a preview for the image file failed. It should be used to
+ * prevent the software from further attempts to create this thumbnail.
+ *
+ * Return value: %TRUE if a failure thumbnail was successfully written,
+ * %FALSE otherwise
+ **/
+gboolean
+gimp_thumbnail_save_failure (GimpThumbnail *thumbnail,
+ const gchar *software,
+ GError **error)
+{
+ GdkPixbuf *pixbuf;
+ gchar *name;
+ gchar *desc;
+ gchar *time_str;
+ gchar *size_str;
+ 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 (software != NULL, FALSE);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ name = gimp_thumb_name_from_uri (thumbnail->image_uri, GIMP_THUMB_SIZE_FAIL);
+ if (! name)
+ return TRUE;
+
+ if (! gimp_thumb_ensure_thumb_dir (GIMP_THUMB_SIZE_FAIL, error))
+ {
+ g_free (name);
+ return FALSE;
+ }
+
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 1, 1);
+
+ desc = g_strdup_printf ("Thumbnail failure for %s", thumbnail->image_uri);
+ time_str = g_strdup_printf ("%" G_GINT64_FORMAT, thumbnail->image_mtime);
+ size_str = g_strdup_printf ("%" G_GINT64_FORMAT, thumbnail->image_filesize);
+
+ success = gdk_pixbuf_save (pixbuf, name, "png", error,
+ TAG_DESCRIPTION, desc,
+ TAG_SOFTWARE, software,
+ TAG_THUMB_URI, thumbnail->image_uri,
+ TAG_THUMB_MTIME, time_str,
+ TAG_THUMB_FILESIZE, size_str,
+ NULL);
+ if (success)
+ {
+ success = (g_chmod (name, 0600) == 0);
+
+ if (success)
+ gimp_thumbnail_update_thumb (thumbnail, GIMP_THUMB_SIZE_NORMAL);
+ else
+ g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
+ "Could not set permissions of thumbnail '%s': %s",
+ name, g_strerror (errno));
+ }
+
+ g_object_unref (pixbuf);
+
+ g_free (size_str);
+ g_free (time_str);
+ g_free (desc);
+ g_free (name);
+
+ return success;
+}
+
+/**
+ * gimp_thumbnail_delete_failure:
+ * @thumbnail: a #GimpThumbnail object
+ *
+ * Removes a failure thumbnail if one exists. This function should be
+ * used after a thumbnail has been successfully created.
+ *
+ * Since: 2.2
+ **/
+void
+gimp_thumbnail_delete_failure (GimpThumbnail *thumbnail)
+{
+ gchar *filename;
+
+ g_return_if_fail (GIMP_IS_THUMBNAIL (thumbnail));
+ g_return_if_fail (thumbnail->image_uri != NULL);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ filename = gimp_thumb_name_from_uri (thumbnail->image_uri,
+ GIMP_THUMB_SIZE_FAIL);
+ if (filename)
+ {
+ g_unlink (filename);
+ g_free (filename);
+ }
+}
+
+/**
+ * gimp_thumbnail_delete_others:
+ * @thumbnail: a #GimpThumbnail object
+ * @size: the thumbnail size which should not be deleted
+ *
+ * Removes all other thumbnails from the global thumbnail
+ * repository. Only the thumbnail for @size is not deleted. This
+ * function should be used after a thumbnail has been successfully
+ * updated. See the spec for a more detailed description on when to
+ * delete thumbnails.
+ *
+ * Since: 2.2
+ **/
+void
+gimp_thumbnail_delete_others (GimpThumbnail *thumbnail,
+ GimpThumbSize size)
+{
+ g_return_if_fail (GIMP_IS_THUMBNAIL (thumbnail));
+ g_return_if_fail (thumbnail->image_uri != NULL);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ _gimp_thumbs_delete_others (thumbnail->image_uri, size);
+}
+
+/**
+ * gimp_thumbnail_has_failed:
+ * @thumbnail: a #GimpThumbnail object
+ *
+ * Checks if a valid failure thumbnail for the given thumbnail exists
+ * in the global thumbnail repository. This may be the case even if
+ * gimp_thumbnail_peek_thumb() doesn't return %GIMP_THUMB_STATE_FAILED
+ * since there might be a real thumbnail and a failure thumbnail for
+ * the same image file.
+ *
+ * The application should not attempt to create the thumbnail if a
+ * valid failure thumbnail exists.
+ *
+ * Return value: %TRUE if a failure thumbnail exists or
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_thumbnail_has_failed (GimpThumbnail *thumbnail)
+{
+ GdkPixbuf *pixbuf;
+ const gchar *option;
+ gchar *filename;
+ gint64 image_mtime;
+ gint64 image_size;
+ gboolean failed = FALSE;
+
+ g_return_val_if_fail (GIMP_IS_THUMBNAIL (thumbnail), FALSE);
+ g_return_val_if_fail (thumbnail->image_uri != NULL, FALSE);
+
+ GIMP_THUMB_DEBUG_CALL (thumbnail);
+
+ filename = gimp_thumb_name_from_uri (thumbnail->image_uri,
+ GIMP_THUMB_SIZE_FAIL);
+ if (! filename)
+ return FALSE;
+
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
+
+ if (! pixbuf)
+ return FALSE;
+
+ if (gimp_thumbnail_peek_image (thumbnail) < GIMP_THUMB_STATE_EXISTS)
+ goto finish;
+
+ /* URI and mtime from the thumbnail need to match our file */
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_URI);
+ if (! option || strcmp (option, thumbnail->image_uri))
+ goto finish;
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_MTIME);
+ if (!option || sscanf (option, "%" G_GINT64_FORMAT, &image_mtime) != 1)
+ goto finish;
+
+ option = gdk_pixbuf_get_option (pixbuf, TAG_THUMB_FILESIZE);
+ if (option && sscanf (option, "%" G_GINT64_FORMAT, &image_size) != 1)
+ goto finish;
+
+ /* TAG_THUMB_FILESIZE is optional but must match if present */
+ if (image_mtime == thumbnail->image_mtime &&
+ (option == NULL || image_size == thumbnail->image_filesize))
+ {
+ failed = TRUE;
+ }
+
+ finish:
+ g_object_unref (pixbuf);
+
+ return failed;
+}
diff --git a/libgimpthumb/gimpthumbnail.h b/libgimpthumb/gimpthumbnail.h
new file mode 100644
index 0000000..2099ff0
--- /dev/null
+++ b/libgimpthumb/gimpthumbnail.h
@@ -0,0 +1,135 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * Thumbnail handling according to the Thumbnail Managing Standard.
+ * https://specifications.freedesktop.org/thumbnail-spec/
+ *
+ * Copyright (C) 2001-2004 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_THUMB_H_INSIDE__) && !defined (GIMP_THUMB_COMPILATION)
+#error "Only <libgimpthumb/gimpthumb.h> can be included directly."
+#endif
+
+#ifndef __GIMP_THUMBNAIL_H__
+#define __GIMP_THUMBNAIL_H__
+
+G_BEGIN_DECLS
+
+
+#define GIMP_TYPE_THUMBNAIL (gimp_thumbnail_get_type ())
+#define GIMP_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THUMBNAIL, GimpThumbnail))
+#define GIMP_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_THUMBNAIL, GimpThumbnailClass))
+#define GIMP_IS_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_THUMBNAIL))
+#define GIMP_IS_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_THUMBNAIL))
+#define GIMP_THUMBNAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_THUMBNAIL, GimpThumbnailClass))
+
+
+typedef struct _GimpThumbnailClass GimpThumbnailClass;
+
+/**
+ * GimpThumbnail:
+ *
+ * All members of #GimpThumbnail are private and should only be accessed
+ * using object properties.
+ **/
+struct _GimpThumbnail
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GimpThumbState image_state;
+ gchar *image_uri;
+ gchar *image_filename;
+ gint64 image_filesize;
+ gint64 image_mtime;
+ gint image_not_found_errno;
+ gint image_width;
+ gint image_height;
+ gchar *image_type;
+ gint image_num_layers;
+
+ GimpThumbState thumb_state;
+ GimpThumbSize thumb_size;
+ gchar *thumb_filename;
+ gint64 thumb_filesize;
+ gint64 thumb_mtime;
+
+ gchar *image_mimetype;
+
+ gpointer _reserved_2;
+};
+
+struct _GimpThumbnailClass
+{
+ GObjectClass parent_class;
+
+ /* Padding for future expansion */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+};
+
+
+GType gimp_thumbnail_get_type (void) G_GNUC_CONST;
+
+GimpThumbnail * gimp_thumbnail_new (void);
+
+void gimp_thumbnail_set_uri (GimpThumbnail *thumbnail,
+ const gchar *uri);
+gboolean gimp_thumbnail_set_filename (GimpThumbnail *thumbnail,
+ const gchar *filename,
+ GError **error);
+gboolean gimp_thumbnail_set_from_thumb (GimpThumbnail *thumbnail,
+ const gchar *filename,
+ GError **error);
+
+GimpThumbState gimp_thumbnail_peek_image (GimpThumbnail *thumbnail);
+GimpThumbState gimp_thumbnail_peek_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size);
+
+GimpThumbState gimp_thumbnail_check_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size);
+
+GdkPixbuf * gimp_thumbnail_load_thumb (GimpThumbnail *thumbnail,
+ GimpThumbSize size,
+ GError **error);
+
+gboolean gimp_thumbnail_save_thumb (GimpThumbnail *thumbnail,
+ GdkPixbuf *pixbuf,
+ const gchar *software,
+ GError **error);
+gboolean gimp_thumbnail_save_thumb_local (GimpThumbnail *thumbnail,
+ GdkPixbuf *pixbuf,
+ const gchar *software,
+ GError **error);
+
+gboolean gimp_thumbnail_save_failure (GimpThumbnail *thumbnail,
+ const gchar *software,
+ GError **error);
+void gimp_thumbnail_delete_failure (GimpThumbnail *thumbnail);
+void gimp_thumbnail_delete_others (GimpThumbnail *thumbnail,
+ GimpThumbSize size);
+
+gboolean gimp_thumbnail_has_failed (GimpThumbnail *thumbnail);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_THUMBNAIL_H__ */