[glib-networking/wip/openssl: 7/7] Don't hardcode paths on Windows
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/openssl: 7/7] Don't hardcode paths on Windows
- Date: Thu, 12 May 2016 08:36:01 +0000 (UTC)
commit c8ccc8878829dcfe9b58251f83c1e919c1a6c427
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue May 10 17:04:03 2016 +0800
Don't hardcode paths on Windows
Use GLib'w Windows APIs to construct the path for the translations
dynamically on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=765466
proxy/gnome/gnome-proxy-module.c | 17 ++++++++++++++++-
proxy/libproxy/libproxy-module.c | 17 ++++++++++++++++-
tls/gnutls/gnutls-module.c | 17 ++++++++++++++++-
3 files changed, 48 insertions(+), 3 deletions(-)
---
diff --git a/proxy/gnome/gnome-proxy-module.c b/proxy/gnome/gnome-proxy-module.c
index 9c5b319..f5f2469 100644
--- a/proxy/gnome/gnome-proxy-module.c
+++ b/proxy/gnome/gnome-proxy-module.c
@@ -27,9 +27,24 @@
void
g_io_module_load (GIOModule *module)
{
+ gchar *locale_dir;
+#ifdef G_OS_WIN32
+ gchar *base_dir;
+#endif
+
g_proxy_resolver_gnome_register (module);
- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+
+#ifdef G_OS_WIN32
+ 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);
+#else
+ locale_dir = g_strdup (LOCALE_DIR);
+#endif
+
+ bindtextdomain (GETTEXT_PACKAGE, locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ g_free (locale_dir);
}
void
diff --git a/proxy/libproxy/libproxy-module.c b/proxy/libproxy/libproxy-module.c
index ec80f0f..11f36f1 100644
--- a/proxy/libproxy/libproxy-module.c
+++ b/proxy/libproxy/libproxy-module.c
@@ -29,9 +29,24 @@
void
g_io_module_load (GIOModule *module)
{
+ gchar *locale_dir;
+#ifdef G_OS_WIN32
+ gchar *base_dir;
+#endif
+
g_libproxy_resolver_register (module);
- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+
+#ifdef G_OS_WIN32
+ 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);
+#else
+ locale_dir = g_strdup (LOCALE_DIR);
+#endif
+
+ bindtextdomain (GETTEXT_PACKAGE, locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ g_free (locale_dir);
}
void
diff --git a/tls/gnutls/gnutls-module.c b/tls/gnutls/gnutls-module.c
index e5bbc8b..6a56a9a 100644
--- a/tls/gnutls/gnutls-module.c
+++ b/tls/gnutls/gnutls-module.c
@@ -32,12 +32,27 @@
void
g_io_module_load (GIOModule *module)
{
+ gchar *locale_dir;
+#ifdef G_OS_WIN32
+ gchar *base_dir;
+#endif
+
g_tls_backend_gnutls_register (module);
#ifdef HAVE_PKCS11
g_tls_backend_gnutls_pkcs11_register (module);
#endif
- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+
+#ifdef G_OS_WIN32
+ 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);
+#else
+ locale_dir = g_strdup (LOCALE_DIR);
+#endif
+
+ bindtextdomain (GETTEXT_PACKAGE, locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ g_free (locale_dir);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]