summaryrefslogtreecommitdiffstats
path: root/plug-ins/help
diff options
context:
space:
mode:
Diffstat (limited to 'plug-ins/help')
-rw-r--r--plug-ins/help/Makefile.am74
-rw-r--r--plug-ins/help/Makefile.in1083
-rw-r--r--plug-ins/help/gimp-help-lookup.c195
-rw-r--r--plug-ins/help/gimphelp.c151
-rw-r--r--plug-ins/help/gimphelp.h58
-rw-r--r--plug-ins/help/gimphelpdomain.c253
-rw-r--r--plug-ins/help/gimphelpdomain.h51
-rw-r--r--plug-ins/help/gimphelpitem.c73
-rw-r--r--plug-ins/help/gimphelpitem.h47
-rw-r--r--plug-ins/help/gimphelplocale.c536
-rw-r--r--plug-ins/help/gimphelplocale.h51
-rw-r--r--plug-ins/help/gimphelpprogress-private.h39
-rw-r--r--plug-ins/help/gimphelpprogress.c150
-rw-r--r--plug-ins/help/gimphelpprogress.h51
-rw-r--r--plug-ins/help/gimphelptypes.h33
-rw-r--r--plug-ins/help/help.c352
16 files changed, 3197 insertions, 0 deletions
diff --git a/plug-ins/help/Makefile.am b/plug-ins/help/Makefile.am
new file mode 100644
index 0000000..dbc3610
--- /dev/null
+++ b/plug-ins/help/Makefile.am
@@ -0,0 +1,74 @@
+## Process this file with automake to produce Makefile.in
+
+libgimphelp = libgimphelp.a
+libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
+
+if OS_WIN32
+mwindows = -mwindows
+endif
+
+if HAVE_WINDRES
+include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
+help_RC = help.rc.o
+endif
+
+AM_CPPFLAGS = \
+ -DDATADIR=\""$(gimpdatadir)"\" \
+ -I$(top_srcdir) \
+ $(CAIRO_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GDK_PIXBUF_CFLAGS) \
+ -I$(includedir)
+
+AM_LDFLAGS = $(mwindows)
+
+noinst_LIBRARIES = libgimphelp.a
+
+libgimphelp_a_SOURCES = \
+ gimphelptypes.h \
+ gimphelp.c \
+ gimphelp.h \
+ gimphelpdomain.c \
+ gimphelpdomain.h \
+ gimphelpitem.c \
+ gimphelpitem.h \
+ gimphelplocale.c \
+ gimphelplocale.h \
+ gimphelpprogress.c \
+ gimphelpprogress.h \
+ gimphelpprogress-private.h
+
+libexecdir = $(gimpplugindir)/plug-ins/help
+
+libexec_PROGRAMS = help
+
+help_SOURCES = help.c
+
+LDADD = \
+ $(libgimphelp) \
+ $(libgimp) \
+ $(libgimpconfig) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(libgimpmath) \
+ $(CAIRO_LIBS) \
+ $(GIO_LIBS) \
+ $(GDK_PIXBUF_LIBS) \
+ $(RT_LIBS) \
+ $(INTLLIBS) \
+ $(help_RC)
+
+
+noinst_PROGRAMS = gimp-help-lookup
+
+gimp_help_lookup_SOURCES = gimp-help-lookup.c
+
+gimp_help_lookup_LDADD = \
+ $(libgimphelp) \
+ $(libgimpbase) \
+ $(GIO_LIBS)
diff --git a/plug-ins/help/Makefile.in b/plug-ins/help/Makefile.in
new file mode 100644
index 0000000..69b8ef2
--- /dev/null
+++ b/plug-ins/help/Makefile.in
@@ -0,0 +1,1083 @@
+# Makefile.in generated by automake 1.16.2 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@
+
+# Version resources for Microsoft Windows
+
+
+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@
+libexec_PROGRAMS = help$(EXEEXT)
+noinst_PROGRAMS = gimp-help-lookup$(EXEEXT)
+subdir = plug-ins/help
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4macros/gtk-doc.m4 \
+ $(top_srcdir)/m4macros/intltool.m4 \
+ $(top_srcdir)/m4macros/libtool.m4 \
+ $(top_srcdir)/m4macros/ltoptions.m4 \
+ $(top_srcdir)/m4macros/ltsugar.m4 \
+ $(top_srcdir)/m4macros/ltversion.m4 \
+ $(top_srcdir)/m4macros/lt~obsolete.m4 \
+ $(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 $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(libexecdir)"
+PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS)
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+libgimphelp_a_AR = $(AR) $(ARFLAGS)
+libgimphelp_a_LIBADD =
+am_libgimphelp_a_OBJECTS = gimphelp.$(OBJEXT) gimphelpdomain.$(OBJEXT) \
+ gimphelpitem.$(OBJEXT) gimphelplocale.$(OBJEXT) \
+ gimphelpprogress.$(OBJEXT)
+libgimphelp_a_OBJECTS = $(am_libgimphelp_a_OBJECTS)
+am_gimp_help_lookup_OBJECTS = gimp-help-lookup.$(OBJEXT)
+gimp_help_lookup_OBJECTS = $(am_gimp_help_lookup_OBJECTS)
+am__DEPENDENCIES_1 =
+gimp_help_lookup_DEPENDENCIES = $(libgimphelp) $(libgimpbase) \
+ $(am__DEPENDENCIES_1)
+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 =
+am_help_OBJECTS = help.$(OBJEXT)
+help_OBJECTS = $(am_help_OBJECTS)
+help_LDADD = $(LDADD)
+help_DEPENDENCIES = $(libgimphelp) $(libgimp) $(libgimpconfig) \
+ $(libgimpcolor) $(libgimpbase) $(libgimpmath) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(help_RC)
+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-help-lookup.Po \
+ ./$(DEPDIR)/gimphelp.Po ./$(DEPDIR)/gimphelpdomain.Po \
+ ./$(DEPDIR)/gimphelpitem.Po ./$(DEPDIR)/gimphelplocale.Po \
+ ./$(DEPDIR)/gimphelpprogress.Po ./$(DEPDIR)/help.Po
+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 = $(libgimphelp_a_SOURCES) $(gimp_help_lookup_SOURCES) \
+ $(help_SOURCES)
+DIST_SOURCES = $(libgimphelp_a_SOURCES) $(gimp_help_lookup_SOURCES) \
+ $(help_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+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)/build/windows/gimprc-plug-ins.rule \
+ $(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_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_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@
+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@
+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 = $(gimpplugindir)/plug-ins/help
+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@
+libgimphelp = libgimphelp.a
+libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la
+libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
+libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
+libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
+libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
+@OS_WIN32_TRUE@mwindows = -mwindows
+@HAVE_WINDRES_TRUE@GIMPPLUGINRC = $(top_builddir)/build/windows/gimp-plug-ins.rc
+@HAVE_WINDRES_TRUE@help_RC = help.rc.o
+AM_CPPFLAGS = \
+ -DDATADIR=\""$(gimpdatadir)"\" \
+ -I$(top_srcdir) \
+ $(CAIRO_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(GEGL_CFLAGS) \
+ $(GDK_PIXBUF_CFLAGS) \
+ -I$(includedir)
+
+AM_LDFLAGS = $(mwindows)
+noinst_LIBRARIES = libgimphelp.a
+libgimphelp_a_SOURCES = \
+ gimphelptypes.h \
+ gimphelp.c \
+ gimphelp.h \
+ gimphelpdomain.c \
+ gimphelpdomain.h \
+ gimphelpitem.c \
+ gimphelpitem.h \
+ gimphelplocale.c \
+ gimphelplocale.h \
+ gimphelpprogress.c \
+ gimphelpprogress.h \
+ gimphelpprogress-private.h
+
+help_SOURCES = help.c
+LDADD = \
+ $(libgimphelp) \
+ $(libgimp) \
+ $(libgimpconfig) \
+ $(libgimpcolor) \
+ $(libgimpbase) \
+ $(libgimpmath) \
+ $(CAIRO_LIBS) \
+ $(GIO_LIBS) \
+ $(GDK_PIXBUF_LIBS) \
+ $(RT_LIBS) \
+ $(INTLLIBS) \
+ $(help_RC)
+
+gimp_help_lookup_SOURCES = gimp-help-lookup.c
+gimp_help_lookup_LDADD = \
+ $(libgimphelp) \
+ $(libgimpbase) \
+ $(GIO_LIBS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/windows/gimprc-plug-ins.rule $(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 plug-ins/help/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plug-ins/help/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_srcdir)/build/windows/gimprc-plug-ins.rule $(am__empty):
+
+$(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):
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-libexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
+
+clean-libexecPROGRAMS:
+ @list='$(libexec_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
+
+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
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+libgimphelp.a: $(libgimphelp_a_OBJECTS) $(libgimphelp_a_DEPENDENCIES) $(EXTRA_libgimphelp_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libgimphelp.a
+ $(AM_V_AR)$(libgimphelp_a_AR) libgimphelp.a $(libgimphelp_a_OBJECTS) $(libgimphelp_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libgimphelp.a
+
+gimp-help-lookup$(EXEEXT): $(gimp_help_lookup_OBJECTS) $(gimp_help_lookup_DEPENDENCIES) $(EXTRA_gimp_help_lookup_DEPENDENCIES)
+ @rm -f gimp-help-lookup$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(gimp_help_lookup_OBJECTS) $(gimp_help_lookup_LDADD) $(LIBS)
+
+help$(EXEEXT): $(help_OBJECTS) $(help_DEPENDENCIES) $(EXTRA_help_DEPENDENCIES)
+ @rm -f help$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(help_OBJECTS) $(help_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimp-help-lookup.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelpdomain.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelpitem.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelplocale.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gimphelpprogress.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@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
+
+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) $(LIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libexecdir)"; 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:
+
+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-libexecPROGRAMS clean-libtool \
+ clean-noinstLIBRARIES clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/gimp-help-lookup.Po
+ -rm -f ./$(DEPDIR)/gimphelp.Po
+ -rm -f ./$(DEPDIR)/gimphelpdomain.Po
+ -rm -f ./$(DEPDIR)/gimphelpitem.Po
+ -rm -f ./$(DEPDIR)/gimphelplocale.Po
+ -rm -f ./$(DEPDIR)/gimphelpprogress.Po
+ -rm -f ./$(DEPDIR)/help.Po
+ -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-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libexecPROGRAMS
+
+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-help-lookup.Po
+ -rm -f ./$(DEPDIR)/gimphelp.Po
+ -rm -f ./$(DEPDIR)/gimphelpdomain.Po
+ -rm -f ./$(DEPDIR)/gimphelpitem.Po
+ -rm -f ./$(DEPDIR)/gimphelplocale.Po
+ -rm -f ./$(DEPDIR)/gimphelpprogress.Po
+ -rm -f ./$(DEPDIR)/help.Po
+ -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-libexecPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libexecPROGRAMS clean-libtool \
+ clean-noinstLIBRARIES 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-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libexecPROGRAMS 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-libexecPROGRAMS
+
+.PRECIOUS: Makefile
+
+
+# `windres` seems a very stupid tool and it breaks with double shlashes
+# in parameter paths. Strengthen the rule a little.
+@HAVE_WINDRES_TRUE@%.rc.o:
+@HAVE_WINDRES_TRUE@ $(WINDRES) --define ORIGINALFILENAME_STR="$*$(EXEEXT)" \
+@HAVE_WINDRES_TRUE@ --define INTERNALNAME_STR="$*" \
+@HAVE_WINDRES_TRUE@ --define TOP_SRCDIR="`echo $(top_srcdir) | sed 's*//*/*'`" \
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_srcdir)/app | sed 's%/\+%/%'`" \
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir)/app | sed 's%/\+%/%'`"\
+@HAVE_WINDRES_TRUE@ -I"`echo $(top_builddir) | sed 's%/\+%/%'`"\
+@HAVE_WINDRES_TRUE@ $(GIMPPLUGINRC) $@
+
+# 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/plug-ins/help/gimp-help-lookup.c b/plug-ins/help/gimp-help-lookup.c
new file mode 100644
index 0000000..6b9f20e
--- /dev/null
+++ b/plug-ins/help/gimp-help-lookup.c
@@ -0,0 +1,195 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimp-help-lookup - a standalone gimp-help ID to filename mapper
+ * Copyright (C) 2004-2008 Sven Neumann <sven@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "libgimp/gimp.h"
+
+#include "gimphelp.h"
+
+
+static void show_version (void) G_GNUC_NORETURN;
+
+static gchar * lookup (const gchar *help_domain,
+ const gchar *help_locales,
+ const gchar *help_id);
+
+static GimpHelpProgress * progress_new (void);
+
+
+static const gchar *help_base = NULL;
+static gchar *help_root = NULL;
+static const gchar *help_locales = NULL;
+static const gchar **help_ids = NULL;
+
+static gboolean be_verbose = FALSE;
+
+
+static const GOptionEntry entries[] =
+{
+ { "version", 'v', 0,
+ G_OPTION_ARG_CALLBACK, (GOptionArgFunc) show_version,
+ "Show version information and exit", NULL
+ },
+ { "base", 'b', 0,
+ G_OPTION_ARG_STRING, &help_base,
+ "Specifies base URI", "URI"
+ },
+ { "root", 'r', 0,
+ G_OPTION_ARG_FILENAME, &help_root,
+ "Specifies root directory for index files", "DIR"
+ },
+ { "lang", 'l', 0,
+ G_OPTION_ARG_STRING, &help_locales,
+ "Specifies help language", "LANG"
+ },
+ {
+ "verbose", 0, 0,
+ G_OPTION_ARG_NONE, &be_verbose,
+ "Be more verbose", NULL
+ },
+ {
+ G_OPTION_REMAINING, 0, 0,
+ G_OPTION_ARG_STRING_ARRAY, &help_ids,
+ NULL, NULL
+ },
+ { NULL }
+};
+
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ GOptionContext *context;
+ gchar *uri;
+ GError *error = NULL;
+
+ help_base = g_getenv (GIMP_HELP_ENV_URI);
+ help_root = g_build_filename (gimp_data_directory (), GIMP_HELP_PREFIX, NULL);
+
+ context = g_option_context_new ("HELP-ID");
+ g_option_context_add_main_entries (context, entries, NULL);
+
+ if (! g_option_context_parse (context, &argc, &argv, &error))
+ {
+ g_print ("%s\n", error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
+ if (help_base)
+ uri = g_strdup (help_base);
+ else
+ uri = g_filename_to_uri (help_root, NULL, NULL);
+
+ gimp_help_register_domain (GIMP_HELP_DEFAULT_DOMAIN, uri);
+ g_free (uri);
+
+ uri = lookup (GIMP_HELP_DEFAULT_DOMAIN,
+ help_locales ? help_locales : GIMP_HELP_DEFAULT_LOCALE,
+ help_ids ? help_ids[0] : GIMP_HELP_DEFAULT_ID);
+
+ if (uri)
+ {
+ g_print ("%s\n", uri);
+ g_free (uri);
+ }
+
+ g_option_context_free (context);
+ g_free (help_root);
+
+ return uri ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+static gchar *
+lookup (const gchar *help_domain,
+ const gchar *help_locales,
+ const gchar *help_id)
+{
+ GimpHelpDomain *domain = gimp_help_lookup_domain (help_domain);
+
+ if (domain)
+ {
+ GimpHelpProgress *progress = progress_new ();
+ GList *locales;
+ gchar *full_uri;
+
+ locales = gimp_help_parse_locales (help_locales);
+ full_uri = gimp_help_domain_map (domain, locales, help_id, progress,
+ NULL, NULL);
+
+ gimp_help_progress_free (progress);
+
+ g_list_free_full (locales, (GDestroyNotify) g_free);
+
+ return full_uri;
+ }
+
+ return NULL;
+}
+
+static void
+show_version (void)
+{
+ g_print ("gimp-help-lookup version %s\n", GIMP_VERSION);
+ exit (EXIT_SUCCESS);
+}
+
+
+static void
+progress_start (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data)
+{
+ if (be_verbose)
+ g_printerr ("\n%s\n", message);
+}
+
+static void
+progress_end (gpointer user_data)
+{
+ if (be_verbose)
+ g_printerr ("done\n");
+}
+
+static void
+progress_set_value (gdouble percentage,
+ gpointer user_data)
+{
+ if (be_verbose)
+ g_printerr (".");
+}
+
+static GimpHelpProgress *
+progress_new (void)
+{
+ const GimpHelpProgressVTable vtable =
+ {
+ progress_start,
+ progress_end,
+ progress_set_value
+ };
+
+ return gimp_help_progress_new (&vtable, NULL);
+}
diff --git a/plug-ins/help/gimphelp.c b/plug-ins/help/gimphelp.c
new file mode 100644
index 0000000..111c10b
--- /dev/null
+++ b/plug-ins/help/gimphelp.c
@@ -0,0 +1,151 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* This code is written so that it can also be compiled standalone.
+ * It shouldn't depend on libgimp.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "libgimp/gimp.h"
+
+#include "gimphelp.h"
+
+#ifdef DISABLE_NLS
+#define _(String) (String)
+#else
+#include "libgimp/stdplugins-intl.h"
+#endif
+
+
+/* private variables */
+
+static GHashTable *domain_hash = NULL;
+
+
+/* public functions */
+
+gboolean
+gimp_help_init (gint num_domain_names,
+ gchar **domain_names,
+ gint num_domain_uris,
+ gchar **domain_uris)
+{
+ gint i;
+
+ if (num_domain_names != num_domain_uris)
+ {
+ g_printerr ("help: number of names doesn't match number of URIs.\n");
+
+ return FALSE;
+ }
+
+ for (i = 0; i < num_domain_names; i++)
+ gimp_help_register_domain (domain_names[i], domain_uris[i]);
+
+ return TRUE;
+}
+
+void
+gimp_help_exit (void)
+{
+ if (domain_hash)
+ {
+ g_hash_table_destroy (domain_hash);
+ domain_hash = NULL;
+ }
+}
+
+void
+gimp_help_register_domain (const gchar *domain_name,
+ const gchar *domain_uri)
+{
+ g_return_if_fail (domain_name != NULL);
+ g_return_if_fail (domain_uri != NULL);
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help: registering help domain \"%s\" with base uri \"%s\"\n",
+ domain_name, domain_uri);
+#endif
+
+ if (! domain_hash)
+ domain_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_help_domain_free);
+
+ g_hash_table_insert (domain_hash,
+ g_strdup (domain_name),
+ gimp_help_domain_new (domain_name, domain_uri));
+}
+
+GimpHelpDomain *
+gimp_help_lookup_domain (const gchar *domain_name)
+{
+ g_return_val_if_fail (domain_name, NULL);
+
+ if (domain_hash)
+ return g_hash_table_lookup (domain_hash, domain_name);
+
+ return NULL;
+}
+
+GList *
+gimp_help_parse_locales (const gchar *help_locales)
+{
+ GList *locales = NULL;
+ GList *list;
+ const gchar *s;
+ const gchar *p;
+
+ g_return_val_if_fail (help_locales != NULL, NULL);
+
+ /* split the string at colons, building a list */
+ s = help_locales;
+ for (p = strchr (s, ':'); p; p = strchr (s, ':'))
+ {
+ gchar *new = g_strndup (s, p - s);
+ locales = g_list_append (locales, new);
+ s = p + 1;
+ }
+
+ if (*s)
+ locales = g_list_append (locales, g_strdup (s));
+
+ /* if the list doesn't contain the default locale yet, append it */
+ for (list = locales; list; list = list->next)
+ if (strcmp ((const gchar *) list->data, GIMP_HELP_DEFAULT_LOCALE) == 0)
+ break;
+
+ if (! list)
+ locales = g_list_append (locales, g_strdup (GIMP_HELP_DEFAULT_LOCALE));
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help: locales: ");
+ for (list = locales; list; list = list->next)
+ g_printerr ("%s ", (const gchar *) list->data);
+ g_printerr ("\n");
+#endif
+
+ return locales;
+}
diff --git a/plug-ins/help/gimphelp.h b/plug-ins/help/gimphelp.h
new file mode 100644
index 0000000..0ba9db2
--- /dev/null
+++ b/plug-ins/help/gimphelp.h
@@ -0,0 +1,58 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_H__
+#define __GIMP_HELP_H__
+
+
+#include "gimphelptypes.h"
+
+#include "gimphelpdomain.h"
+#include "gimphelpitem.h"
+#include "gimphelplocale.h"
+#include "gimphelpprogress.h"
+
+
+#define GIMP_HELP_DEFAULT_DOMAIN "https://www.gimp.org/help"
+#define GIMP_HELP_DEFAULT_ID "gimp-main"
+#define GIMP_HELP_DEFAULT_LOCALE "en"
+
+#define GIMP_HELP_PREFIX "help"
+#define GIMP_HELP_ENV_URI "GIMP2_HELP_URI"
+
+/* #define GIMP_HELP_DEBUG */
+
+
+gboolean gimp_help_init (gint n_domain_names,
+ gchar **domain_names,
+ gint n_domain_uris,
+ gchar **domain_uris);
+void gimp_help_exit (void);
+
+void gimp_help_register_domain (const gchar *domain_name,
+ const gchar *domain_uri);
+GimpHelpDomain * gimp_help_lookup_domain (const gchar *domain_name);
+
+GList * gimp_help_parse_locales (const gchar *help_locales);
+
+
+#endif /* ! __GIMP_HELP_H__ */
diff --git a/plug-ins/help/gimphelpdomain.c b/plug-ins/help/gimphelpdomain.c
new file mode 100644
index 0000000..34997e3
--- /dev/null
+++ b/plug-ins/help/gimphelpdomain.c
@@ -0,0 +1,253 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* This code is written so that it can also be compiled standalone.
+ * It shouldn't depend on libgimp.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "gimphelp.h"
+
+#ifdef DISABLE_NLS
+#define _(String) (String)
+#else
+#include "libgimp/stdplugins-intl.h"
+#endif
+
+
+/* local function prototypes */
+
+static gboolean domain_locale_parse (GimpHelpDomain *domain,
+ GimpHelpLocale *locale,
+ GimpHelpProgress *progress,
+ GError **error);
+
+
+/* public functions */
+
+GimpHelpDomain *
+gimp_help_domain_new (const gchar *domain_name,
+ const gchar *domain_uri)
+{
+ GimpHelpDomain *domain = g_slice_new0 (GimpHelpDomain);
+
+ domain->help_domain = g_strdup (domain_name);
+ domain->help_uri = g_strdup (domain_uri);
+
+ if (domain_uri)
+ {
+ /* strip trailing slash */
+ if (g_str_has_suffix (domain->help_uri, "/"))
+ domain->help_uri[strlen (domain->help_uri) - 1] = '\0';
+ }
+
+ return domain;
+}
+
+void
+gimp_help_domain_free (GimpHelpDomain *domain)
+{
+ g_return_if_fail (domain != NULL);
+
+ if (domain->help_locales)
+ g_hash_table_destroy (domain->help_locales);
+
+ g_free (domain->help_domain);
+ g_free (domain->help_uri);
+
+ g_slice_free (GimpHelpDomain, domain);
+}
+
+GimpHelpLocale *
+gimp_help_domain_lookup_locale (GimpHelpDomain *domain,
+ const gchar *locale_id,
+ GimpHelpProgress *progress)
+{
+ GimpHelpLocale *locale = NULL;
+
+ if (domain->help_locales)
+ locale = g_hash_table_lookup (domain->help_locales, locale_id);
+ else
+ domain->help_locales =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_help_locale_free);
+
+ if (locale)
+ return locale;
+
+ locale = gimp_help_locale_new (locale_id);
+ g_hash_table_insert (domain->help_locales, g_strdup (locale_id), locale);
+
+ domain_locale_parse (domain, locale, progress, NULL);
+
+ return locale;
+}
+
+gchar *
+gimp_help_domain_map (GimpHelpDomain *domain,
+ GList *help_locales,
+ const gchar *help_id,
+ GimpHelpProgress *progress,
+ GimpHelpLocale **ret_locale,
+ gboolean *fatal_error)
+{
+ GimpHelpLocale *locale = NULL;
+ const gchar *ref = NULL;
+ GList *list;
+
+ g_return_val_if_fail (domain != NULL, NULL);
+ g_return_val_if_fail (help_locales != NULL, NULL);
+ g_return_val_if_fail (help_id != NULL, NULL);
+
+ if (fatal_error)
+ *fatal_error = FALSE;
+
+ /* first pass: look for a reference matching the help_id */
+ for (list = help_locales; list && !ref; list = list->next)
+ {
+ locale = gimp_help_domain_lookup_locale (domain,
+ (const gchar *) list->data,
+ progress);
+ ref = gimp_help_locale_map (locale, help_id);
+ }
+
+ /* second pass: look for a fallback */
+ for (list = help_locales; list && !ref; list = list->next)
+ {
+ locale = gimp_help_domain_lookup_locale (domain,
+ (const gchar *) list->data,
+ progress);
+ ref = locale->help_missing;
+ }
+
+ if (ret_locale)
+ *ret_locale = locale;
+
+ if (ref)
+ {
+ return g_strconcat (domain->help_uri, "/",
+ locale->locale_id, "/",
+ ref,
+ NULL);
+ }
+ else /* try to assemble a useful error message */
+ {
+ GError *error = NULL;
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help: help_id lookup and all fallbacks failed for '%s'\n",
+ help_id);
+#endif
+
+ locale = gimp_help_domain_lookup_locale (domain,
+ GIMP_HELP_DEFAULT_LOCALE, NULL);
+
+ if (! domain_locale_parse (domain, locale, NULL, &error))
+ {
+ switch (error->code)
+ {
+ case G_IO_ERROR_NOT_FOUND:
+ if (domain->help_domain)
+ {
+ g_message (_("The help pages for '%s' are not available."),
+ domain->help_domain);
+ }
+ else
+ {
+ g_message ("%s\n\n%s",
+ _("The GIMP user manual is not available."),
+ /* TRANSLATORS: do not end the URL with a dot,
+ * it would be in the link. Because of
+ * technical limitations, make sure the URL
+ * ends with a space, a newline or is end of text.
+ * Cf. bug 762282.
+ */
+ _("Please install the additional help package "
+ "or use the online user manual at: "
+ "https://docs.gimp.org/"));
+ }
+ break;
+
+ case G_IO_ERROR_NOT_SUPPORTED:
+ g_message ("%s\n\n%s",
+ error->message,
+ _("Perhaps you are missing GIO backends and need "
+ "to install GVFS?"));
+ break;
+
+ case G_IO_ERROR_CANCELLED:
+ break;
+
+ default:
+ g_message ("%s", error->message);
+ break;
+ }
+
+ g_error_free (error);
+
+ if (fatal_error)
+ *fatal_error = TRUE;
+ }
+ else
+ {
+ g_message (_("Help ID '%s' unknown"), help_id);
+ }
+
+ return NULL;
+ }
+}
+
+
+/* private functions */
+
+static gboolean
+domain_locale_parse (GimpHelpDomain *domain,
+ GimpHelpLocale *locale,
+ GimpHelpProgress *progress,
+ GError **error)
+{
+ gchar *uri;
+ gboolean success;
+
+ g_return_val_if_fail (domain != NULL, FALSE);
+ g_return_val_if_fail (locale != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ uri = g_strdup_printf ("%s/%s/gimp-help.xml",
+ domain->help_uri, locale->locale_id);
+
+ success = gimp_help_locale_parse (locale, uri, domain->help_domain,
+ progress, error);
+
+ g_free (uri);
+
+ return success;
+}
diff --git a/plug-ins/help/gimphelpdomain.h b/plug-ins/help/gimphelpdomain.h
new file mode 100644
index 0000000..b7e6920
--- /dev/null
+++ b/plug-ins/help/gimphelpdomain.h
@@ -0,0 +1,51 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_DOMAIN_H__
+#define __GIMP_HELP_DOMAIN_H__
+
+
+struct _GimpHelpDomain
+{
+ gchar *help_domain;
+ gchar *help_uri;
+ GHashTable *help_locales;
+};
+
+
+GimpHelpDomain * gimp_help_domain_new (const gchar *domain_name,
+ const gchar *domain_uri);
+void gimp_help_domain_free (GimpHelpDomain *domain);
+
+GimpHelpLocale * gimp_help_domain_lookup_locale (GimpHelpDomain *domain,
+ const gchar *locale_id,
+ GimpHelpProgress *progress);
+gchar * gimp_help_domain_map (GimpHelpDomain *domain,
+ GList *help_locales,
+ const gchar *help_id,
+ GimpHelpProgress *progress,
+ GimpHelpLocale **locale,
+ gboolean *fatal_error);
+void gimp_help_domain_exit (void);
+
+
+#endif /* ! __GIMP_HELP_DOMAIN_H__ */
diff --git a/plug-ins/help/gimphelpitem.c b/plug-ins/help/gimphelpitem.c
new file mode 100644
index 0000000..b38c453
--- /dev/null
+++ b/plug-ins/help/gimphelpitem.c
@@ -0,0 +1,73 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* This code is written so that it can also be compiled standalone.
+ * It shouldn't depend on libgimp.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glib.h>
+
+#include "gimphelptypes.h"
+
+#include "gimphelpitem.h"
+
+#ifdef DISABLE_NLS
+#define _(String) (String)
+#else
+#include "libgimp/stdplugins-intl.h"
+#endif
+
+
+/* public functions */
+
+GimpHelpItem *
+gimp_help_item_new (const gchar *ref,
+ const gchar *title,
+ const gchar *sort,
+ const gchar *parent)
+{
+ GimpHelpItem *item = g_slice_new0 (GimpHelpItem);
+
+ item->ref = g_strdup (ref);
+ item->title = g_strdup (title);
+ item->sort = g_strdup (sort);
+ item->parent = g_strdup (parent);
+
+ return item;
+}
+
+void
+gimp_help_item_free (GimpHelpItem *item)
+{
+ g_free (item->ref);
+ g_free (item->title);
+ g_free (item->sort);
+ g_free (item->parent);
+
+ g_list_free (item->children);
+
+ g_slice_free (GimpHelpItem, item);
+}
diff --git a/plug-ins/help/gimphelpitem.h b/plug-ins/help/gimphelpitem.h
new file mode 100644
index 0000000..15c3c7b
--- /dev/null
+++ b/plug-ins/help/gimphelpitem.h
@@ -0,0 +1,47 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_ITEM_H__
+#define __GIMP_HELP_ITEM_H__
+
+
+struct _GimpHelpItem
+{
+ gchar *ref;
+ gchar *title;
+ gchar *sort; /* optional sort key provided by doc team */
+ gchar *parent;
+
+ /* extra fields used by the help-browser */
+ GList *children;
+ gulong index;
+};
+
+
+GimpHelpItem * gimp_help_item_new (const gchar *ref,
+ const gchar *title,
+ const gchar *sort,
+ const gchar *parent);
+void gimp_help_item_free (GimpHelpItem *item);
+
+
+#endif /* __GIMP_HELP_ITEM_H__ */
diff --git a/plug-ins/help/gimphelplocale.c b/plug-ins/help/gimphelplocale.c
new file mode 100644
index 0000000..e2106a2
--- /dev/null
+++ b/plug-ins/help/gimphelplocale.c
@@ -0,0 +1,536 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* This code is written so that it can also be compiled standalone.
+ * It shouldn't depend on libgimp.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#include "gimphelp.h"
+#include "gimphelpprogress-private.h"
+
+#ifdef DISABLE_NLS
+#define _(String) (String)
+#else
+#include "libgimp/stdplugins-intl.h"
+#endif
+
+
+/* local function prototypes */
+
+static void locale_set_error (GError **error,
+ const gchar *format,
+ GFile *file);
+
+
+/* public functions */
+
+GimpHelpLocale *
+gimp_help_locale_new (const gchar *locale_id)
+{
+ GimpHelpLocale *locale = g_slice_new0 (GimpHelpLocale);
+
+ locale->locale_id = g_strdup (locale_id);
+
+ return locale;
+}
+
+void
+gimp_help_locale_free (GimpHelpLocale *locale)
+{
+ g_return_if_fail (locale != NULL);
+
+ if (locale->help_id_mapping)
+ g_hash_table_destroy (locale->help_id_mapping);
+
+ g_free (locale->locale_id);
+ g_free (locale->help_missing);
+
+ g_list_free (locale->toplevel_items);
+
+ g_slice_free (GimpHelpLocale, locale);
+}
+
+const gchar *
+gimp_help_locale_map (GimpHelpLocale *locale,
+ const gchar *help_id)
+{
+ g_return_val_if_fail (locale != NULL, NULL);
+ g_return_val_if_fail (help_id != NULL, NULL);
+
+ if (locale->help_id_mapping)
+ {
+ GimpHelpItem *item = g_hash_table_lookup (locale->help_id_mapping,
+ help_id);
+
+ if (item)
+ return item->ref;
+ }
+
+ return NULL;
+}
+
+
+/* the locale mapping parser */
+
+typedef enum
+{
+ LOCALE_START,
+ LOCALE_IN_HELP,
+ LOCALE_IN_ITEM,
+ LOCALE_IN_MISSING,
+ LOCALE_IN_UNKNOWN
+} LocaleParserState;
+
+typedef struct
+{
+ GFile *file;
+ LocaleParserState state;
+ LocaleParserState last_known_state;
+ gint markup_depth;
+ gint unknown_depth;
+ GString *value;
+
+ GimpHelpLocale *locale;
+ const gchar *help_domain;
+ gchar *id_attr_name;
+} LocaleParser;
+
+static gboolean locale_parser_parse (GMarkupParseContext *context,
+ GimpHelpProgress *progress,
+ GInputStream *stream,
+ goffset size,
+ GCancellable *cancellable,
+ GError **error);
+static void locale_parser_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error);
+static void locale_parser_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error);
+static void locale_parser_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data);
+static void locale_parser_start_unknown (LocaleParser *parser);
+static void locale_parser_end_unknown (LocaleParser *parser);
+static void locale_parser_parse_namespace (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values);
+static void locale_parser_parse_item (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values);
+static void locale_parser_parse_missing (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values);
+
+static const GMarkupParser markup_parser =
+{
+ locale_parser_start_element,
+ locale_parser_end_element,
+ NULL, /* characters */
+ NULL, /* passthrough */
+ locale_parser_error
+};
+
+gboolean
+gimp_help_locale_parse (GimpHelpLocale *locale,
+ const gchar *uri,
+ const gchar *help_domain,
+ GimpHelpProgress *progress,
+ GError **error)
+{
+ GMarkupParseContext *context;
+ GFile *file;
+ GFileInputStream *stream;
+ GCancellable *cancellable = NULL;
+ LocaleParser parser = { NULL, };
+ goffset size = 0;
+ gboolean success;
+
+ g_return_val_if_fail (locale != NULL, FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (locale->help_id_mapping)
+ {
+ g_hash_table_destroy (locale->help_id_mapping);
+ locale->help_id_mapping = NULL;
+ }
+
+ if (locale->help_missing)
+ {
+ g_free (locale->help_missing);
+ locale->help_missing = NULL;
+ }
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help (%s): parsing '%s' for \"%s\"\n",
+ locale->locale_id, uri, help_domain);
+#endif
+
+ file = g_file_new_for_uri (uri);
+
+ if (progress)
+ {
+ gchar *name = g_file_get_parse_name (file);
+
+ cancellable = g_cancellable_new ();
+ _gimp_help_progress_start (progress, cancellable,
+ _("Loading index from '%s'"), name);
+
+ g_object_unref (cancellable);
+ g_free (name);
+ }
+
+ if (progress)
+ {
+ GFileInfo *info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE, 0,
+ cancellable, error);
+ if (! info)
+ {
+ locale_set_error (error,
+ _("Could not open '%s' for reading: %s"), file);
+ g_object_unref (file);
+
+ return FALSE;
+ }
+
+ size = g_file_info_get_size (info);
+
+ g_object_unref (info);
+ }
+
+ stream = g_file_read (file, cancellable, error);
+
+ if (! stream)
+ {
+ locale_set_error (error,
+ _("Could not open '%s' for reading: %s"), file);
+ g_object_unref (file);
+
+ return FALSE;
+ }
+
+ parser.file = file;
+ parser.value = g_string_new (NULL);
+ parser.locale = locale;
+ parser.help_domain = help_domain;
+ parser.id_attr_name = g_strdup ("id");
+
+ context = g_markup_parse_context_new (&markup_parser, 0, &parser, NULL);
+
+ success = locale_parser_parse (context, progress,
+ G_INPUT_STREAM (stream), size,
+ cancellable, error);
+
+ if (progress)
+ _gimp_help_progress_finish (progress);
+
+ g_markup_parse_context_free (context);
+ g_object_unref (stream);
+
+ g_string_free (parser.value, TRUE);
+ g_free (parser.id_attr_name);
+
+ if (! success)
+ locale_set_error (error, _("Parse error in '%s':\n%s"), file);
+
+ g_object_unref (file);
+
+ return success;
+}
+
+static gboolean
+locale_parser_parse (GMarkupParseContext *context,
+ GimpHelpProgress *progress,
+ GInputStream *stream,
+ goffset size,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gssize len;
+ goffset done = 0;
+ gchar buffer[4096];
+
+ while ((len = g_input_stream_read (stream, buffer, sizeof (buffer),
+ cancellable, error)) != -1)
+ {
+ switch (len)
+ {
+ case 0:
+ return g_markup_parse_context_end_parse (context, error);
+
+ default:
+ done += len;
+
+ if (progress)
+ {
+ if (size > 0)
+ _gimp_help_progress_update (progress, (gdouble) done / size);
+ else
+ _gimp_help_progress_pulse (progress);
+ }
+
+ if (! g_markup_parse_context_parse (context, buffer, len, error))
+ return FALSE;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+locale_parser_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
+{
+ LocaleParser *parser = (LocaleParser *) user_data;
+
+ switch (parser->state)
+ {
+ case LOCALE_START:
+ if (strcmp (element_name, "gimp-help") == 0)
+ {
+ parser->state = LOCALE_IN_HELP;
+ locale_parser_parse_namespace (parser,
+ attribute_names, attribute_values);
+ }
+ else
+ locale_parser_start_unknown (parser);
+ break;
+
+ case LOCALE_IN_HELP:
+ if (strcmp (element_name, "help-item") == 0)
+ {
+ parser->state = LOCALE_IN_ITEM;
+ locale_parser_parse_item (parser,
+ attribute_names, attribute_values);
+ }
+ else if (strcmp (element_name, "help-missing") == 0)
+ {
+ parser->state = LOCALE_IN_MISSING;
+ locale_parser_parse_missing (parser,
+ attribute_names, attribute_values);
+ }
+ else
+ locale_parser_start_unknown (parser);
+ break;
+
+ case LOCALE_IN_ITEM:
+ case LOCALE_IN_MISSING:
+ case LOCALE_IN_UNKNOWN:
+ locale_parser_start_unknown (parser);
+ break;
+ }
+}
+
+static void
+locale_parser_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
+{
+ LocaleParser *parser = (LocaleParser *) user_data;
+
+ switch (parser->state)
+ {
+ case LOCALE_START:
+ g_warning ("locale_parser: This shouldn't happen.");
+ break;
+
+ case LOCALE_IN_HELP:
+ parser->state = LOCALE_START;
+ break;
+
+ case LOCALE_IN_ITEM:
+ case LOCALE_IN_MISSING:
+ parser->state = LOCALE_IN_HELP;
+ break;
+
+ case LOCALE_IN_UNKNOWN:
+ locale_parser_end_unknown (parser);
+ break;
+ }
+}
+
+static void
+locale_parser_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data)
+{
+ LocaleParser *parser = (LocaleParser *) user_data;
+ gchar *name = g_file_get_parse_name (parser->file);
+
+ g_printerr ("help (parsing %s): %s", name, error->message);
+
+ g_free (name);
+}
+
+static void
+locale_parser_start_unknown (LocaleParser *parser)
+{
+ if (parser->unknown_depth == 0)
+ parser->last_known_state = parser->state;
+
+ parser->state = LOCALE_IN_UNKNOWN;
+ parser->unknown_depth++;
+}
+
+static void
+locale_parser_end_unknown (LocaleParser *parser)
+{
+ g_assert (parser->unknown_depth > 0 && parser->state == LOCALE_IN_UNKNOWN);
+
+ parser->unknown_depth--;
+
+ if (parser->unknown_depth == 0)
+ parser->state = parser->last_known_state;
+}
+
+static void
+locale_parser_parse_namespace (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values)
+{
+ for (; *names && *values; names++, values++)
+ {
+ if (! strncmp (*names, "xmlns:", 6) &&
+ ! strcmp (*values, parser->help_domain))
+ {
+ g_free (parser->id_attr_name);
+ parser->id_attr_name = g_strdup_printf ("%s:id", *names + 6);
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help (%s): id attribute name for \"%s\" is \"%s\"\n",
+ parser->locale->locale_id,
+ parser->help_domain,
+ parser->id_attr_name);
+#endif
+ }
+ }
+}
+
+static void
+locale_parser_parse_item (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values)
+{
+ const gchar *id = NULL;
+ const gchar *ref = NULL;
+ const gchar *title = NULL;
+ const gchar *sort = NULL; /* optional sort key provided by doc team */
+ const gchar *parent = NULL;
+
+ for (; *names && *values; names++, values++)
+ {
+ if (! strcmp (*names, parser->id_attr_name))
+ id = *values;
+
+ if (! strcmp (*names, "ref"))
+ ref = *values;
+
+ if (! strcmp (*names, "title"))
+ title = *values;
+
+ if (! strcmp (*names, "sort"))
+ sort = *values;
+
+ if (! strcmp (*names, "parent"))
+ parent = *values;
+ }
+
+ if (id && ref)
+ {
+ if (! parser->locale->help_id_mapping)
+ parser->locale->help_id_mapping =
+ g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ (GDestroyNotify) gimp_help_item_free);
+
+ g_hash_table_insert (parser->locale->help_id_mapping,
+ g_strdup (id),
+ gimp_help_item_new (ref, title, sort, parent));
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help (%s): added mapping \"%s\" -> \"%s\"\n",
+ parser->locale->locale_id, id, ref);
+#endif
+ }
+}
+
+static void
+locale_parser_parse_missing (LocaleParser *parser,
+ const gchar **names,
+ const gchar **values)
+{
+ const gchar *ref = NULL;
+
+ for (; *names && *values; names++, values++)
+ {
+ if (! strcmp (*names, "ref"))
+ ref = *values;
+ }
+
+ if (ref &&
+ parser->locale->help_missing == NULL)
+ {
+ parser->locale->help_missing = g_strdup (ref);
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help (%s): added fallback for missing help -> \"%s\"\n",
+ parser->locale->locale_id, ref);
+#endif
+ }
+}
+
+static void
+locale_set_error (GError **error,
+ const gchar *format,
+ GFile *file)
+{
+ if (error && *error)
+ {
+ gchar *name = g_file_get_parse_name (file);
+ gchar *msg;
+
+ msg = g_strdup_printf (format, name, (*error)->message);
+ g_free (name);
+
+ g_free ((*error)->message);
+ (*error)->message = msg;
+ }
+}
diff --git a/plug-ins/help/gimphelplocale.h b/plug-ins/help/gimphelplocale.h
new file mode 100644
index 0000000..8dd57a6
--- /dev/null
+++ b/plug-ins/help/gimphelplocale.h
@@ -0,0 +1,51 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_LOCALE_H__
+#define __GIMP_HELP_LOCALE_H__
+
+
+struct _GimpHelpLocale
+{
+ gchar *locale_id;
+ GHashTable *help_id_mapping;
+ gchar *help_missing;
+
+ /* eek */
+ GList *toplevel_items;
+};
+
+
+GimpHelpLocale * gimp_help_locale_new (const gchar *locale_id);
+void gimp_help_locale_free (GimpHelpLocale *locale);
+
+const gchar * gimp_help_locale_map (GimpHelpLocale *locale,
+ const gchar *help_id);
+
+gboolean gimp_help_locale_parse (GimpHelpLocale *locale,
+ const gchar *uri,
+ const gchar *help_domain,
+ GimpHelpProgress *progress,
+ GError **error);
+
+
+#endif /* __GIMP_HELP_LOCALE_H__ */
diff --git a/plug-ins/help/gimphelpprogress-private.h b/plug-ins/help/gimphelpprogress-private.h
new file mode 100644
index 0000000..d83e45f
--- /dev/null
+++ b/plug-ins/help/gimphelpprogress-private.h
@@ -0,0 +1,39 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_PROGRESS_PRIVATE_H__
+#define __GIMP_HELP_PROGRESS_PRIVATE_H__
+
+
+/* internal API */
+
+void _gimp_help_progress_start (GimpHelpProgress *progress,
+ GCancellable *cancellable,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4) G_GNUC_INTERNAL;
+void _gimp_help_progress_update (GimpHelpProgress *progress,
+ gdouble percentage) G_GNUC_INTERNAL;
+void _gimp_help_progress_pulse (GimpHelpProgress *progress) G_GNUC_INTERNAL;
+void _gimp_help_progress_finish (GimpHelpProgress *progress) G_GNUC_INTERNAL;
+
+
+#endif /* ! __GIMP_HELP_PROGRESS_PRIVATE_H__ */
diff --git a/plug-ins/help/gimphelpprogress.c b/plug-ins/help/gimphelpprogress.c
new file mode 100644
index 0000000..dd4b224
--- /dev/null
+++ b/plug-ins/help/gimphelpprogress.c
@@ -0,0 +1,150 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* This code is written so that it can also be compiled standalone.
+ * It shouldn't depend on libgimp.
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <gio/gio.h>
+
+#include "gimphelptypes.h"
+#include "gimphelpprogress.h"
+#include "gimphelpprogress-private.h"
+
+
+struct _GimpHelpProgress
+{
+ GimpHelpProgressVTable vtable;
+ gpointer user_data;
+
+ GCancellable *cancellable;
+};
+
+
+GimpHelpProgress *
+gimp_help_progress_new (const GimpHelpProgressVTable *vtable,
+ gpointer user_data)
+{
+ GimpHelpProgress *progress;
+
+ g_return_val_if_fail (vtable != NULL, NULL);
+
+ progress = g_slice_new0 (GimpHelpProgress);
+
+ progress->vtable.start = vtable->start;
+ progress->vtable.end = vtable->end;
+ progress->vtable.set_value = vtable->set_value;
+
+ progress->user_data = user_data;
+
+ return progress;
+}
+
+void
+gimp_help_progress_free (GimpHelpProgress *progress)
+{
+ g_return_if_fail (progress != NULL);
+
+ if (progress->cancellable)
+ {
+ g_object_unref (progress->cancellable);
+ progress->cancellable = NULL;
+ }
+
+ g_slice_free (GimpHelpProgress, progress);
+}
+
+void
+gimp_help_progress_cancel (GimpHelpProgress *progress)
+{
+ g_return_if_fail (progress != NULL);
+
+ if (progress->cancellable)
+ g_cancellable_cancel (progress->cancellable);
+}
+
+
+void
+_gimp_help_progress_start (GimpHelpProgress *progress,
+ GCancellable *cancellable,
+ const gchar *format,
+ ...)
+{
+ gchar *message;
+ va_list args;
+
+ g_return_if_fail (progress != NULL);
+
+ if (cancellable)
+ g_object_ref (cancellable);
+
+ if (progress->cancellable)
+ g_object_unref (progress->cancellable);
+
+ progress->cancellable = cancellable;
+
+ va_start (args, format);
+ message = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ if (progress->vtable.start)
+ progress->vtable.start (message, cancellable != NULL, progress->user_data);
+
+ g_free (message);
+}
+
+void
+_gimp_help_progress_update (GimpHelpProgress *progress,
+ gdouble percentage)
+{
+ g_return_if_fail (progress != NULL);
+
+ if (progress->vtable.set_value)
+ progress->vtable.set_value (percentage, progress->user_data);
+}
+
+void
+_gimp_help_progress_pulse (GimpHelpProgress *progress)
+{
+ g_return_if_fail (progress != NULL);
+
+ _gimp_help_progress_update (progress, -1.0);
+}
+
+void
+_gimp_help_progress_finish (GimpHelpProgress *progress)
+{
+ g_return_if_fail (progress != NULL);
+
+ if (progress->vtable.end)
+ progress->vtable.end (progress->user_data);
+
+ if (progress->cancellable)
+ {
+ g_object_unref (progress->cancellable);
+ progress->cancellable = NULL;
+ }
+}
diff --git a/plug-ins/help/gimphelpprogress.h b/plug-ins/help/gimphelpprogress.h
new file mode 100644
index 0000000..d7fdb32
--- /dev/null
+++ b/plug-ins/help/gimphelpprogress.h
@@ -0,0 +1,51 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_PROGRESS_H__
+#define __GIMP_HELP_PROGRESS_H__
+
+
+typedef struct
+{
+ void (* start) (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data);
+ void (* end) (gpointer user_data);
+ void (* set_value) (gdouble percentage,
+ gpointer user_data);
+
+ /* Padding for future expansion. Must be initialized with NULL! */
+ void (* _gimp_reserved1) (void);
+ void (* _gimp_reserved2) (void);
+ void (* _gimp_reserved3) (void);
+ void (* _gimp_reserved4) (void);
+} GimpHelpProgressVTable;
+
+
+GimpHelpProgress * gimp_help_progress_new (const GimpHelpProgressVTable *vtable,
+ gpointer user_data);
+void gimp_help_progress_free (GimpHelpProgress *progress);
+
+void gimp_help_progress_cancel (GimpHelpProgress *progress);
+
+
+#endif /* ! __GIMP_HELP_PROGRESS_H__ */
diff --git a/plug-ins/help/gimphelptypes.h b/plug-ins/help/gimphelptypes.h
new file mode 100644
index 0000000..4937d6f
--- /dev/null
+++ b/plug-ins/help/gimphelptypes.h
@@ -0,0 +1,33 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_HELP_TYPES_H__
+#define __GIMP_HELP_TYPES_H__
+
+
+typedef struct _GimpHelpDomain GimpHelpDomain;
+typedef struct _GimpHelpItem GimpHelpItem;
+typedef struct _GimpHelpLocale GimpHelpLocale;
+typedef struct _GimpHelpProgress GimpHelpProgress;
+
+
+#endif /* ! __GIMP_HELP_TYPES_H__ */
diff --git a/plug-ins/help/help.c b/plug-ins/help/help.c
new file mode 100644
index 0000000..8d913b7
--- /dev/null
+++ b/plug-ins/help/help.c
@@ -0,0 +1,352 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * The GIMP Help plug-in
+ * Copyright (C) 1999-2008 Sven Neumann <sven@gimp.org>
+ * Michael Natterer <mitch@gimp.org>
+ * Henrik Brix Andersen <brix@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <string.h> /* strlen */
+
+#include <glib.h>
+
+#include "libgimp/gimp.h"
+
+#include "gimphelp.h"
+
+#include "libgimp/stdplugins-intl.h"
+
+
+/* defines */
+
+#define GIMP_HELP_EXT_PROC "extension-gimp-help"
+#define GIMP_HELP_TEMP_EXT_PROC "extension-gimp-help-temp"
+
+
+typedef struct
+{
+ gchar *procedure;
+ gchar *help_domain;
+ gchar *help_locales;
+ gchar *help_id;
+} IdleHelp;
+
+
+/* forward declarations */
+
+static void query (void);
+static void run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+
+static void temp_proc_install (void);
+static void temp_proc_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals);
+
+static void load_help (const gchar *procedure,
+ const gchar *help_domain,
+ const gchar *help_locales,
+ const gchar *help_id);
+static gboolean load_help_idle (gpointer data);
+
+static GimpHelpProgress * load_help_progress_new (void);
+
+
+/* local variables */
+
+static GMainLoop *main_loop = NULL;
+
+const GimpPlugInInfo PLUG_IN_INFO =
+{
+ NULL, /* init_proc */
+ NULL, /* quit_proc */
+ query, /* query_proc */
+ run, /* run_proc */
+};
+
+
+MAIN ()
+
+static void
+query (void)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_INT32, "num-domain-names", "" },
+ { GIMP_PDB_STRINGARRAY, "domain-names", "" },
+ { GIMP_PDB_INT32, "num-domain-uris", "" },
+ { GIMP_PDB_STRINGARRAY, "domain-uris", "" }
+ };
+
+ gimp_install_procedure (GIMP_HELP_EXT_PROC,
+ "", /* FIXME */
+ "", /* FIXME */
+ "Sven Neumann <sven@gimp.org>, "
+ "Michael Natterer <mitch@gimp.org>, "
+ "Henrik Brix Andersen <brix@gimp.org>",
+ "Sven Neumann, Michael Natterer & Henrik Brix Andersen",
+ "1999-2008",
+ NULL,
+ "",
+ GIMP_EXTENSION,
+ G_N_ELEMENTS (args), 0,
+ args, NULL);
+}
+
+static void
+run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+
+ INIT_I18N ();
+
+ /* make sure all the arguments are there */
+ if (nparams == 4)
+ {
+ if (! gimp_help_init (param[0].data.d_int32,
+ param[1].data.d_stringarray,
+ param[2].data.d_int32,
+ param[3].data.d_stringarray))
+ {
+ status = GIMP_PDB_CALLING_ERROR;
+ }
+ }
+ else
+ {
+ g_printerr ("help: wrong number of arguments in procedure call.\n");
+
+ status = GIMP_PDB_CALLING_ERROR;
+ }
+
+ if (status == GIMP_PDB_SUCCESS)
+ {
+ main_loop = g_main_loop_new (NULL, FALSE);
+
+ temp_proc_install ();
+
+ gimp_extension_ack ();
+ gimp_extension_enable ();
+
+ g_main_loop_run (main_loop);
+
+ g_main_loop_unref (main_loop);
+ main_loop = NULL;
+
+ gimp_uninstall_temp_proc (GIMP_HELP_TEMP_EXT_PROC);
+ }
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = status;
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+}
+
+static void
+temp_proc_install (void)
+{
+ static const GimpParamDef args[] =
+ {
+ { GIMP_PDB_STRING, "procedure", "The procedure of the browser to use" },
+ { GIMP_PDB_STRING, "help-domain", "Help domain to use" },
+ { GIMP_PDB_STRING, "help-locales", "Language to use" },
+ { GIMP_PDB_STRING, "help-id", "Help ID to open" }
+ };
+
+ gimp_install_temp_proc (GIMP_HELP_TEMP_EXT_PROC,
+ "DON'T USE THIS ONE",
+ "(Temporary procedure)",
+ "Sven Neumann <sven@gimp.org>, "
+ "Michael Natterer <mitch@gimp.org>"
+ "Henrik Brix Andersen <brix@gimp.org",
+ "Sven Neumann, Michael Natterer & Henrik Brix Andersen",
+ "1999-2008",
+ NULL,
+ "",
+ GIMP_TEMPORARY,
+ G_N_ELEMENTS (args), 0,
+ args, NULL,
+ temp_proc_run);
+}
+
+static void
+temp_proc_run (const gchar *name,
+ gint nparams,
+ const GimpParam *param,
+ gint *nreturn_vals,
+ GimpParam **return_vals)
+{
+ static GimpParam values[1];
+ GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+ const gchar *procedure = NULL;
+ const gchar *help_domain = GIMP_HELP_DEFAULT_DOMAIN;
+ const gchar *help_locales = NULL;
+ const gchar *help_id = GIMP_HELP_DEFAULT_ID;
+
+ *nreturn_vals = 1;
+ *return_vals = values;
+
+ /* make sure all the arguments are there */
+ if (nparams == 4)
+ {
+ if (param[0].data.d_string && strlen (param[0].data.d_string))
+ procedure = param[0].data.d_string;
+
+ if (param[1].data.d_string && strlen (param[1].data.d_string))
+ help_domain = param[1].data.d_string;
+
+ if (param[2].data.d_string && strlen (param[2].data.d_string))
+ help_locales = param[2].data.d_string;
+
+ if (param[3].data.d_string && strlen (param[3].data.d_string))
+ help_id = param[3].data.d_string;
+ }
+
+ if (! procedure)
+ status = GIMP_PDB_CALLING_ERROR;
+
+ values[0].type = GIMP_PDB_STATUS;
+ values[0].data.d_status = status;
+
+ if (status == GIMP_PDB_SUCCESS)
+ load_help (procedure, help_domain, help_locales, help_id);
+}
+
+static void
+load_help (const gchar *procedure,
+ const gchar *help_domain,
+ const gchar *help_locales,
+ const gchar *help_id)
+{
+ IdleHelp *idle_help = g_slice_new (IdleHelp);
+
+ idle_help->procedure = g_strdup (procedure);
+ idle_help->help_domain = g_strdup (help_domain);
+ idle_help->help_locales = g_strdup (help_locales);
+ idle_help->help_id = g_strdup (help_id);
+
+ g_idle_add (load_help_idle, idle_help);
+}
+
+static gboolean
+load_help_idle (gpointer data)
+{
+ IdleHelp *idle_help = data;
+ GimpHelpDomain *domain;
+
+ domain = gimp_help_lookup_domain (idle_help->help_domain);
+
+ if (domain)
+ {
+ GimpHelpProgress *progress = NULL;
+ GList *locales;
+ gchar *uri;
+ gboolean fatal_error;
+
+ locales = gimp_help_parse_locales (idle_help->help_locales);
+
+ if (! g_str_has_prefix (domain->help_uri, "file:"))
+ progress = load_help_progress_new ();
+
+ uri = gimp_help_domain_map (domain, locales, idle_help->help_id,
+ progress, NULL, &fatal_error);
+
+ if (progress)
+ gimp_help_progress_free (progress);
+
+ g_list_free_full (locales, (GDestroyNotify) g_free);
+
+ if (uri)
+ {
+ GimpParam *return_vals;
+ gint n_return_vals;
+
+#ifdef GIMP_HELP_DEBUG
+ g_printerr ("help: calling '%s' for '%s'\n",
+ idle_help->procedure, uri);
+#endif
+
+ return_vals = gimp_run_procedure (idle_help->procedure,
+ &n_return_vals,
+ GIMP_PDB_STRING, uri,
+ GIMP_PDB_END);
+
+ gimp_destroy_params (return_vals, n_return_vals);
+
+ g_free (uri);
+ }
+ else if (fatal_error)
+ {
+ g_main_loop_quit (main_loop);
+ }
+ }
+
+ g_free (idle_help->procedure);
+ g_free (idle_help->help_domain);
+ g_free (idle_help->help_locales);
+ g_free (idle_help->help_id);
+
+ g_slice_free (IdleHelp, idle_help);
+
+ return FALSE;
+}
+
+static void
+load_help_progress_start (const gchar *message,
+ gboolean cancelable,
+ gpointer user_data)
+{
+ gimp_progress_init (message);
+}
+
+static void
+load_help_progress_update (gdouble value,
+ gpointer user_data)
+{
+ gimp_progress_update (value);
+}
+
+static void
+load_help_progress_end (gpointer user_data)
+{
+ gimp_progress_end ();
+}
+
+static GimpHelpProgress *
+load_help_progress_new (void)
+{
+ static const GimpHelpProgressVTable vtable =
+ {
+ load_help_progress_start,
+ load_help_progress_end,
+ load_help_progress_update
+ };
+
+ return gimp_help_progress_new (&vtable, NULL);
+}