[gtk/matthiasc/a11y-buildable] Treat tristate as an enum when parsing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/a11y-buildable] Treat tristate as an enum when parsing
- Date: Mon, 26 Oct 2020 12:02:50 +0000 (UTC)
commit c783e9aa5fe0dbb09c25eb4151136649073e09a4
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 26 08:01:13 2020 -0400
Treat tristate as an enum when parsing
This makes it so that you have to explicitly specify
"true" and "false" for the checked state, but it
matches how this enumeration is meant to be used.
gtk/gtkaccessiblevalue.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkaccessiblevalue.c b/gtk/gtkaccessiblevalue.c
index c7ac423bd0..c459067812 100644
--- a/gtk/gtkaccessiblevalue.c
+++ b/gtk/gtkaccessiblevalue.c
@@ -47,6 +47,7 @@
#include "gtkaccessible.h"
#include "gtkbuilderprivate.h"
#include "gtkenums.h"
+#include "gtktypebuiltins.h"
#include <math.h>
#include <float.h>
@@ -1356,14 +1357,12 @@ gtk_accessible_value_parse (const GtkAccessibleCollect *cstate,
case GTK_ACCESSIBLE_COLLECT_TRISTATE:
{
- gboolean b;
+ int value;
if (collects_undef && strncmp (str, "undefined", 9) == 0)
res = gtk_undefined_accessible_value_new ();
- else if (strncmp (str, "mixed", 5) == 0)
- res = gtk_tristate_accessible_value_new (GTK_ACCESSIBLE_TRISTATE_MIXED);
- else if (_gtk_builder_boolean_from_string (str, &b, error))
- res = gtk_boolean_accessible_value_new (b);
+ else if (_gtk_builder_enum_from_string (GTK_TYPE_ACCESSIBLE_TRISTATE, str, &value, error))
+ res = gtk_boolean_accessible_value_new (value);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]