summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-05-26 03:44:09 +0200
committerBenjamin Otte <otte@redhat.com>2011-06-02 02:03:51 +0200
commit812b32e9e5400b6e2de9963a72034aca0b31e8e3 (patch)
treec9b9baf0d15c410f0ff84d2029d895fc999ea58d /gtk
parent97a07a79f31e571482ffadbd2afe227662effd56 (diff)
downloadgtk+-812b32e9e5400b6e2de9963a72034aca0b31e8e3.tar.gz
styleproperty: Add a helper function for printing doubles
We will want to print doubles more often, so add a little helper function for it. We cannot use printf() here, because we want English locale output.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkstyleproperty.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index 26372081b8..5fa9d777f9 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -313,15 +313,22 @@ double_value_parse (GtkCssParser *parser,
}
static void
-double_value_print (const GValue *value,
- GString *string)
+string_append_double (GString *string,
+ double d)
{
char buf[G_ASCII_DTOSTR_BUF_SIZE];
- g_ascii_dtostr (buf, sizeof (buf), g_value_get_double (value));
+ g_ascii_dtostr (buf, sizeof (buf), d);
g_string_append (string, buf);
}
+static void
+double_value_print (const GValue *value,
+ GString *string)
+{
+ string_append_double (string, g_value_get_double (value));
+}
+
static gboolean
float_value_parse (GtkCssParser *parser,
GFile *base,
@@ -343,10 +350,7 @@ static void
float_value_print (const GValue *value,
GString *string)
{
- char buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- g_ascii_dtostr (buf, sizeof (buf), g_value_get_float (value));
- g_string_append (string, buf);
+ string_append_double (string, g_value_get_float (value));
}
static gboolean