[gspell/wip/cmake] cmake: DATADIR -> GSPELL_LOCALE_DIR



commit 567c1cb9015fa78849333991f8e30a55cd6b4f92
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date:   Tue Aug 16 16:00:00 2022 +0200

    cmake: DATADIR -> GSPELL_LOCALE_DIR
    
    DATADIR was used only for the localedir.
    And with CMake it's anyway better to define it in the config.h.

 config.h.in             |  2 ++
 gspell-app/gspell-app.c | 14 +-------------
 gspell/gspell-init.c    |  4 ++--
 3 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/config.h.in b/config.h.in
index 1560254..04495f2 100644
--- a/config.h.in
+++ b/config.h.in
@@ -8,3 +8,5 @@
 
 /* Define to the address where bug reports for this package should be sent. */
 #define PACKAGE_BUGREPORT "https://gitlab.gnome.org/GNOME/gspell/issues";
+
+#define GSPELL_LOCALE_DIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
diff --git a/gspell-app/gspell-app.c b/gspell-app/gspell-app.c
index 22e9957..0fa5883 100644
--- a/gspell-app/gspell-app.c
+++ b/gspell-app/gspell-app.c
@@ -235,23 +235,11 @@ app_command_line_cb (GApplication            *app,
        return 0;
 }
 
-static gchar *
-get_locale_directory (void)
-{
-       return g_build_filename (GSPELL_DATADIR, "locale", NULL);
-}
-
 static void
 setup_i18n (void)
 {
-       gchar *locale_dir;
-
        setlocale (LC_ALL, "");
-
-       locale_dir = get_locale_directory ();
-       bindtextdomain (GETTEXT_PACKAGE, locale_dir);
-       g_free (locale_dir);
-
+       bindtextdomain (GETTEXT_PACKAGE, GSPELL_LOCALE_DIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
 }
diff --git a/gspell/gspell-init.c b/gspell/gspell-init.c
index 1101cbf..146963b 100644
--- a/gspell/gspell-init.c
+++ b/gspell/gspell-init.c
@@ -74,7 +74,7 @@ dirs_os_x_get_locale_dir (void)
 
        if (res_dir == NULL)
        {
-               ret = g_build_filename (DATADIR, "locale", NULL);
+               ret = g_strdup (GSPELL_LOCALE_DIR);
        }
        else
        {
@@ -102,7 +102,7 @@ get_locale_dir (void)
 #elif OS_OSX
        locale_dir = dirs_os_x_get_locale_dir ();
 #else
-       locale_dir = g_build_filename (DATADIR, "locale", NULL);
+       locale_dir = g_strdup (GSPELL_LOCALE_DIR);
 #endif
 
        return locale_dir;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]