Commit f8dff379 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

check for langinfo.h and _NL_MEASUREMENT_MEASUREMENT.

2005-08-17  Sven Neumann  <sven@gimp.org>

	* configure.in: check for langinfo.h and _NL_MEASUREMENT_MEASUREMENT.

	* app/core/gimptemplate.c: try to determine the default unit from
	the locale settings. Supposed to fix bug #107497.
parent 465aa7a7
2005-08-17 Sven Neumann <sven@gimp.org>
* configure.in: check for langinfo.h and _NL_MEASUREMENT_MEASUREMENT.
* app/core/gimptemplate.c: try to determine the default unit from
the locale settings. Supposed to fix bug #107497.
2005-08-17 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.c (smooth_region): fixed
......
......@@ -22,6 +22,7 @@
#include "config.h"
#include <string.h>
#include <langinfo.h>
#include <glib-object.h>
......@@ -38,6 +39,7 @@
#include "gimp-intl.h"
/* The default image aspect ratio is the golden mean. We use
* two adjacent fibonacci numbers for the unstable series and
* some less odd values for the stable version.
......@@ -68,19 +70,20 @@ enum
};
static void gimp_template_class_init (GimpTemplateClass *klass);
static void gimp_template_class_init (GimpTemplateClass *klass);
static void gimp_template_finalize (GObject *object);
static void gimp_template_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_template_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_template_notify (GObject *object,
GParamSpec *pspec);
static void gimp_template_finalize (GObject *object);
static void gimp_template_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_template_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_template_notify (GObject *object,
GParamSpec *pspec);
static GimpUnit gimp_template_unit_from_locale (void);
static GimpViewableClass *parent_class = NULL;
......@@ -171,7 +174,8 @@ gimp_template_class_init (GimpTemplateClass *klass)
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_RESOLUTION_UNIT,
"resolution-unit",
NULL,
FALSE, FALSE, GIMP_UNIT_INCH,
FALSE, FALSE,
gimp_template_unit_from_locale (),
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_IMAGE_TYPE,
......@@ -339,6 +343,25 @@ gimp_template_notify (GObject *object,
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (object));
}
static GimpUnit
gimp_template_unit_from_locale (void)
{
#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
const gchar *measurement = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
switch (*((guchar *) measurement))
{
case 1: /* metric */
return GIMP_UNIT_MM;
case 2: /* imperial */
return GIMP_UNIT_INCH;
}
#endif
return GIMP_UNIT_INCH;
}
/* public functions */
......
......@@ -108,7 +108,7 @@ dnl The symbol GIMP_UNSTABLE is defined above for substitution in
dnl Makefiles and conditionally defined here as a preprocessor symbol
dnl and automake conditional.
if test "x$GIMP_UNSTABLE" = "xyes"; then
AC_DEFINE(GIMP_UNSTABLE,1,
AC_DEFINE(GIMP_UNSTABLE, 1,
[Define to 1 if this is an unstable version of the GIMP])
fi
AM_CONDITIONAL(GIMP_UNSTABLE, test "x$GIMP_UNSTABLE" = "xyes")
......@@ -367,6 +367,18 @@ dnl check some more funcs
AC_CHECK_FUNCS(difftime putenv mmap)
# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], nl_ok=yes, nl_ok=no)
AC_MSG_RESULT($nl_ok)
if test "$nl_ok" = "yes"; then
AC_DEFINE(HAVE__NL_MEASUREMENT_MEASUREMENT, 1,
[Define to 1 if _NL_MEASUREMENT_MEASUREMENT is available])
fi
######################
# Internationalisation
######################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment