[glib-networking/wip/openssl: 19/19] proxy/gnome: Don't hardcode paths on Windows



commit ad0f1a7117aea577d23b3201ee816ad8d87fd95a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue May 10 17:04:03 2016 +0800

    proxy/gnome: Don't hardcode paths on Windows
    
    Use GLib'w Windows APIs to construct the path for the translations
    dynamically on Windows.

 proxy/gnome/gnome-proxy-module.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 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


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