summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2011-10-18 00:15:37 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2011-10-18 01:01:02 +0800
commitf3ac581713f7297b0bf33c77c47e9bf32961775f (patch)
tree613c0cb5fa7ded20a9abefb2a9e6668ee1e308b4
parent9973383bd05236272f28909db8f422f7a56b11ea (diff)
Move _glib_get_locale_dir to ggettext.c
-Move _glib_get_locale_dir to ggettext.c, as Matthias suggested -Made up for the headers that needed to be included in ggettext.c to avoid C4013 (implicit declaration of ...) errors/warnings
-rw-r--r--glib/ggettext.c56
-rw-r--r--glib/gutils.c50
2 files changed, 56 insertions, 50 deletions
diff --git a/glib/ggettext.c b/glib/ggettext.c
index 58f74d21f..d7054fcbe 100644
--- a/glib/ggettext.c
+++ b/glib/ggettext.c
@@ -30,11 +30,67 @@
#include "galloca.h"
#include "gthread.h"
+#include "gmem.h"
+#ifdef G_OS_WIN32
+#include "gwin32.h"
+#include "gfileutils.h"
+#include "gstrfuncs.h"
+#include "glib-init.h"
+#endif
#include <string.h>
#include <locale.h>
#include <libintl.h>
+#ifdef G_OS_WIN32
+
+/**
+ * _glib_get_locale_dir:
+ *
+ * Return the path to the share\locale or lib\locale subfolder of the
+ * GLib installation folder. The path is in the system codepage. We
+ * have to use system codepage as bindtextdomain() doesn't have a
+ * UTF-8 interface.
+ */
+gchar *
+_glib_get_locale_dir (void)
+{
+ gchar *install_dir = NULL, *locale_dir;
+ gchar *retval = NULL;
+
+ if (glib_dll != NULL)
+ install_dir = g_win32_get_package_installation_directory_of_module (glib_dll);
+
+ if (install_dir)
+ {
+ /*
+ * Append "/share/locale" or "/lib/locale" depending on whether
+ * autoconfigury detected GNU gettext or not.
+ */
+ const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
+ while (*--p != '/')
+ ;
+ while (*--p != '/')
+ ;
+
+ locale_dir = g_build_filename (install_dir, p, NULL);
+
+ retval = g_win32_locale_filename_from_utf8 (locale_dir);
+
+ g_free (install_dir);
+ g_free (locale_dir);
+ }
+
+ if (retval)
+ return retval;
+ else
+ return g_strdup ("");
+}
+
+#undef GLIB_LOCALE_DIR
+
+#endif /* G_OS_WIN32 */
+
static void
ensure_gettext_initialized (void)
diff --git a/glib/gutils.c b/glib/gutils.c
index 63fb5ce83..934452d2b 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2330,56 +2330,6 @@ g_format_size_for_display (goffset size)
}
}
-#ifdef G_OS_WIN32
-
-/**
- * _glib_get_locale_dir:
- *
- * Return the path to the share\locale or lib\locale subfolder of the
- * GLib installation folder. The path is in the system codepage. We
- * have to use system codepage as bindtextdomain() doesn't have a
- * UTF-8 interface.
- */
-gchar *
-_glib_get_locale_dir (void)
-{
- gchar *install_dir = NULL, *locale_dir;
- gchar *retval = NULL;
-
- if (glib_dll != NULL)
- install_dir = g_win32_get_package_installation_directory_of_module (glib_dll);
-
- if (install_dir)
- {
- /*
- * Append "/share/locale" or "/lib/locale" depending on whether
- * autoconfigury detected GNU gettext or not.
- */
- const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
- while (*--p != '/')
- ;
- while (*--p != '/')
- ;
-
- locale_dir = g_build_filename (install_dir, p, NULL);
-
- retval = g_win32_locale_filename_from_utf8 (locale_dir);
-
- g_free (install_dir);
- g_free (locale_dir);
- }
-
- if (retval)
- return retval;
- else
- return g_strdup ("");
-}
-
-#undef GLIB_LOCALE_DIR
-
-#endif /* G_OS_WIN32 */
-
-
#if defined (G_OS_WIN32) && !defined (_WIN64)
/* Binary compatibility versions. Not for newly compiled code. */