[amtk/meson-msvc: 13/22] init: get_locale_directory() function
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [amtk/meson-msvc: 13/22] init: get_locale_directory() function
- Date: Tue, 14 Jul 2020 06:28:04 +0000 (UTC)
commit bb5aba9d45377df900d8876c1f30d0e4c9b7d344
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri May 8 16:39:50 2020 +0200
init: get_locale_directory() function
amtk/amtk-init.c | 27 +++++++++++++++++++--------
amtk/amtk-init.h | 1 +
2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/amtk/amtk-init.c b/amtk/amtk-init.c
index e9f39dc..3730c8b 100644
--- a/amtk/amtk-init.c
+++ b/amtk/amtk-init.c
@@ -1,7 +1,7 @@
/*
* This file is part of Amtk - Actions, Menus and Toolbars Kit
*
- * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright 2017-2020 - Sébastien Wilmet <swilmet gnome org>
*
* Amtk is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
@@ -22,6 +22,23 @@
#include <glib/gi18n-lib.h>
#include "amtk-action-info-central-store.h"
+static gchar *
+get_locale_directory (void)
+{
+#ifdef G_OS_WIN32
+ gchar *base_dir;
+ gchar *locale_dir;
+
+ base_dir = g_win32_get_package_installation_directory_of_module (NULL);
+ locale_dir = g_build_filename (base_dir, "share", "locale", NULL);
+ g_free (base_dir);
+
+ return locale_dir;
+#else
+ return g_build_filename (DATADIR, "locale", NULL);
+#endif
+}
+
/**
* amtk_init:
*
@@ -41,13 +58,7 @@ amtk_init (void)
{
gchar *locale_dir;
-#ifdef G_OS_WIN32
- gchar *basedir = g_win32_get_package_installation_directory_of_module (NULL);
- locale_dir = g_build_filename (basedir, "share", "locale", NULL);
- g_free (basedir);
-#else
- locale_dir = g_build_filename (DATADIR, "locale", NULL);
-#endif
+ locale_dir = get_locale_directory ();
bindtextdomain (GETTEXT_PACKAGE, locale_dir);
g_free (locale_dir);
diff --git a/amtk/amtk-init.h b/amtk/amtk-init.h
index 59638a4..d67bd0e 100644
--- a/amtk/amtk-init.h
+++ b/amtk/amtk-init.h
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
_AMTK_EXTERN
void amtk_init (void);
+
_AMTK_EXTERN
void amtk_finalize (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]