[gimp] Bug 593167 - Support Windows in gimp_get_default_unit()
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 593167 - Support Windows in gimp_get_default_unit()
- Date: Sat, 30 Mar 2013 14:21:46 +0000 (UTC)
commit 194ef70d7446a627c274135c54498d3092c9b356
Author: Petr Kubiznak <kubiznak petr gmail com>
Date: Sun Mar 17 21:33:17 2013 +0100
Bug 593167 - Support Windows in gimp_get_default_unit()
Function gimp_get_default_unit ported for Windows using standard GetLocaleInfo() function (from
windows.h).
app/core/gimp-utils.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index abfda93..28d783c 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -477,7 +477,7 @@ gimp_get_default_language (const gchar *category)
GimpUnit
gimp_get_default_unit (void)
{
-#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
+#if defined (HAVE__NL_MEASUREMENT_MEASUREMENT)
const gchar *measurement = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
switch (*((guchar *) measurement))
@@ -488,6 +488,27 @@ gimp_get_default_unit (void)
case 2: /* imperial */
return GIMP_UNIT_INCH;
}
+
+#elif defined (G_OS_WIN32)
+ DWORD measurement;
+ int ret;
+
+ ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
+ LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
+ (LPTSTR)&measurement,
+ sizeof(measurement) / sizeof(TCHAR) );
+
+ if (ret != 0) /* GetLocaleInfo succeeded */
+ {
+ switch ((guint) measurement)
+ {
+ case 0: /* metric */
+ return GIMP_UNIT_MM;
+
+ case 1: /* imperial */
+ return GIMP_UNIT_INCH;
+ }
+ }
#endif
return GIMP_UNIT_MM;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]