diff options
author | Timm Bäder <mail@baedert.org> | 2020-10-08 05:56:26 +0200 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-10-14 15:06:12 -0400 |
commit | c5909d4dc423f60d443f786b408b18729a56ce89 (patch) | |
tree | c1daf98f020f3af10b50291c0aad8825d4e385f1 | |
parent | 9698cd67a1ff01c8f7bf7da76bf3347b9fa0d31b (diff) | |
download | gtk+-c5909d4dc423f60d443f786b408b18729a56ce89.tar.gz |
gtkbuilder: Remove pointless function prototype
-rw-r--r-- | gtk/gtkbuilder.c | 93 | ||||
-rw-r--r-- | gtk/gtkbuilderprivate.h | 3 |
2 files changed, 47 insertions, 49 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index cb2bcf0236..182ccad5f1 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -1997,6 +1997,53 @@ gtk_builder_value_from_string (GtkBuilder *builder, string, value, error); } +static gboolean +_gtk_builder_boolean_from_string (const char *string, + gboolean *value, + GError **error) +{ + if (string[0] == '\0') + goto error; + else if (string[1] == '\0') + { + char c; + + c = string[0]; + if (c == '1' || + c == 'y' || c == 't' || + c == 'Y' || c == 'T') + *value = TRUE; + else if (c == '0' || + c == 'n' || c == 'f' || + c == 'N' || c == 'F') + *value = FALSE; + else + goto error; + } + else + { + if (g_ascii_strcasecmp (string, "true") == 0 || + g_ascii_strcasecmp (string, "yes") == 0) + *value = TRUE; + else if (g_ascii_strcasecmp (string, "false") == 0 || + g_ascii_strcasecmp (string, "no") == 0) + *value = FALSE; + else + goto error; + } + + return TRUE; + +error: + g_set_error (error, + GTK_BUILDER_ERROR, + GTK_BUILDER_ERROR_INVALID_VALUE, + "Could not parse boolean '%s'", + string); + return FALSE; +} + + /** * gtk_builder_value_from_string_type: * @builder: a #GtkBuilder @@ -2568,52 +2615,6 @@ _gtk_builder_flags_from_string (GType type, return ret; } -gboolean -_gtk_builder_boolean_from_string (const char *string, - gboolean *value, - GError **error) -{ - if (string[0] == '\0') - goto error; - else if (string[1] == '\0') - { - char c; - - c = string[0]; - if (c == '1' || - c == 'y' || c == 't' || - c == 'Y' || c == 'T') - *value = TRUE; - else if (c == '0' || - c == 'n' || c == 'f' || - c == 'N' || c == 'F') - *value = FALSE; - else - goto error; - } - else - { - if (g_ascii_strcasecmp (string, "true") == 0 || - g_ascii_strcasecmp (string, "yes") == 0) - *value = TRUE; - else if (g_ascii_strcasecmp (string, "false") == 0 || - g_ascii_strcasecmp (string, "no") == 0) - *value = FALSE; - else - goto error; - } - - return TRUE; - -error: - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "Could not parse boolean '%s'", - string); - return FALSE; -} - /** * gtk_builder_get_type_from_name: * @builder: a #GtkBuilder diff --git a/gtk/gtkbuilderprivate.h b/gtk/gtkbuilderprivate.h index 87287d4e78..5fe910486b 100644 --- a/gtk/gtkbuilderprivate.h +++ b/gtk/gtkbuilderprivate.h @@ -233,9 +233,6 @@ GtkExpression * expression_info_construct (GtkBuilder *builder, GError **error); /* Internal API which might be made public at some point */ -gboolean _gtk_builder_boolean_from_string (const char *string, - gboolean *value, - GError **error); gboolean _gtk_builder_enum_from_string (GType type, const char *string, int *enum_value, |