From: Bruno Haible Date: Mon, 16 Dec 2024 13:58:07 +0000 (+0100) Subject: hello-c-gnome3: Fix an error "Settings schema 'org.gnu.gettext.examples.hello' is... X-Git-Tag: v0.23.1~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0e697a112d5b93a9bd9401ede24e9ad48e78649;p=thirdparty%2Fgettext.git hello-c-gnome3: Fix an error "Settings schema 'org.gnu.gettext.examples.hello' is not installed". * gettext-tools/examples/hello-c-gnome3/configure.ac: Invoke gl_BUILD_TO_HOST_LOCALEDIR, gl_BUILD_TO_HOST_PKGDATADIR. * gettext-tools/examples/hello-c-gnome3/Makefile.am (DEFS): Define also PKGDATADIR. (pkgdata_DATA): New variable. * gettext-tools/examples/hello-c-gnome3/hello.c (main): Add PKGDATADIR to the GSETTINGS_SCHEMA_DIR value. --- diff --git a/gettext-tools/examples/hello-c-gnome3/Makefile.am b/gettext-tools/examples/hello-c-gnome3/Makefile.am index d7168bce8..39f3b0317 100644 --- a/gettext-tools/examples/hello-c-gnome3/Makefile.am +++ b/gettext-tools/examples/hello-c-gnome3/Makefile.am @@ -16,8 +16,12 @@ bin_PROGRAMS = hello # The source files of the 'hello' program. hello_SOURCES = hello.c resources.c -# Define a C macro LOCALEDIR indicating where catalogs will be installed. -DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +# Define a C macro LOCALEDIR indicating where catalogs will be installed +# and a C macro PKGDATADIR indicating a package-specific location. +DEFS = \ + -DLOCALEDIR=$(localedir_c_make) \ + -DPKGDATADIR=$(pkgdatadir_c_make) \ + @DEFS@ # Make sure the gnome.h include file is found. AM_CPPFLAGS = $(GTK_CFLAGS) @@ -36,6 +40,10 @@ resources.c: hello.gresource.xml hello.ui $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ \ --sourcedir=$(srcdir) --generate-source +# Install the compiled GSettings schema in a package-specific location +# (so that "make install" works with a --prefix other than /usr). +pkgdata_DATA = gschemas.compiled + desktopdir = $(datadir)/applications desktop_DATA = hello.desktop diff --git a/gettext-tools/examples/hello-c-gnome3/configure.ac b/gettext-tools/examples/hello-c-gnome3/configure.ac index def954606..209a6046b 100644 --- a/gettext-tools/examples/hello-c-gnome3/configure.ac +++ b/gettext-tools/examples/hello-c-gnome3/configure.ac @@ -11,6 +11,11 @@ AC_PROG_CC AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.23]) +dnl Define localedir_c and localedir_c_make. +gl_BUILD_TO_HOST_LOCALEDIR +dnl Define pkgdatadir_c and pkgdatadir_c_make. +gl_BUILD_TO_HOST_PKGDATADIR + dnl Check GNOME specific stuff. dnl dnl If you have full GNOME development environment installed on your diff --git a/gettext-tools/examples/hello-c-gnome3/hello.c b/gettext-tools/examples/hello-c-gnome3/hello.c index 2683012bf..f7a7a801c 100644 --- a/gettext-tools/examples/hello-c-gnome3/hello.c +++ b/gettext-tools/examples/hello-c-gnome3/hello.c @@ -170,8 +170,12 @@ main (int argc, char *argv[]) GApplication *application; int status; - /* Load the GSettings schema from the current directory. */ - g_setenv ("GSETTINGS_SCHEMA_DIR", ".", FALSE); + /* Load the compiled GSettings schema + - from PKGDATADIR (so that it works after "make install"), + - from the current directory (so that it works in the build directory, + before "make install"). */ + g_setenv ("GSETTINGS_SCHEMA_DIR", PKGDATADIR G_SEARCHPATH_SEPARATOR_S ".", + FALSE); /* Initializations. */ textdomain ("hello-c-gnome3");