summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-09-07 12:43:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-09-07 12:43:19 -0400
commit3d01f29bd9ce1322a0dc6043ba01d9ba9b4ef7ab (patch)
treeefa6852eb6cd8d46124b95eb169f6b3edb9d261c
parent20079a9960778e320a0028316a565fd2cffc3c38 (diff)
downloadgtk+-3d01f29bd9ce1322a0dc6043ba01d9ba9b4ef7ab.tar.gz
builder: Move a function
Move _gtk_builder_boolean_from_string in the same source file as the other _from_functions.
-rw-r--r--gtk/gtkbuilder.c46
-rw-r--r--gtk/gtkbuilderparser.c46
2 files changed, 46 insertions, 46 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index caf7610ec4..0f04ed72e8 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -2265,6 +2265,52 @@ _gtk_builder_flags_from_string (GType type,
return ret;
}
+gboolean
+_gtk_builder_boolean_from_string (const gchar *string,
+ gboolean *value,
+ GError **error)
+{
+ gboolean retval = TRUE;
+ int length;
+
+ g_assert (string != NULL);
+ length = strlen (string);
+
+ if (length == 0)
+ retval = FALSE;
+ else if (length == 1)
+ {
+ gchar c = g_ascii_tolower (string[0]);
+ if (c == 'y' || c == 't' || c == '1')
+ *value = TRUE;
+ else if (c == 'n' || c == 'f' || c == '0')
+ *value = FALSE;
+ else
+ retval = FALSE;
+ }
+ else
+ {
+ gchar *lower = g_ascii_strdown (string, length);
+
+ if (strcmp (lower, "yes") == 0 || strcmp (lower, "true") == 0)
+ *value = TRUE;
+ else if (strcmp (lower, "no") == 0 || strcmp (lower, "false") == 0)
+ *value = FALSE;
+ else
+ retval = FALSE;
+ g_free (lower);
+ }
+
+ if (!retval)
+ g_set_error (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_INVALID_VALUE,
+ "Could not parse boolean '%s'",
+ string);
+
+ return retval;
+}
+
/**
* gtk_builder_get_type_from_name:
* @builder: a #GtkBuilder
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index 0f34d3a4c3..49c04d25f3 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -120,52 +120,6 @@ error_unhandled_tag (ParserData *data,
data->filename, line, col, tag);
}
-gboolean
-_gtk_builder_boolean_from_string (const gchar *string,
- gboolean *value,
- GError **error)
-{
- gboolean retval = TRUE;
- int length;
-
- g_assert (string != NULL);
- length = strlen (string);
-
- if (length == 0)
- retval = FALSE;
- else if (length == 1)
- {
- gchar c = g_ascii_tolower (string[0]);
- if (c == 'y' || c == 't' || c == '1')
- *value = TRUE;
- else if (c == 'n' || c == 'f' || c == '0')
- *value = FALSE;
- else
- retval = FALSE;
- }
- else
- {
- gchar *lower = g_ascii_strdown (string, length);
-
- if (strcmp (lower, "yes") == 0 || strcmp (lower, "true") == 0)
- *value = TRUE;
- else if (strcmp (lower, "no") == 0 || strcmp (lower, "false") == 0)
- *value = FALSE;
- else
- retval = FALSE;
- g_free (lower);
- }
-
- if (!retval)
- g_set_error (error,
- GTK_BUILDER_ERROR,
- GTK_BUILDER_ERROR_INVALID_VALUE,
- "Could not parse boolean '%s'",
- string);
-
- return retval;
-}
-
static GObject *
builder_construct (ParserData *data,
ObjectInfo *object_info,