[gtk/ebassi/new-a11y: 85/87] a11y: Simplify GtkAccessibleValue



commit d4a503ca44daabfd6e5c9588893e784d1f8e4d5f
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Jul 16 18:08:22 2020 +0100

    a11y: Simplify GtkAccessibleValue
    
    Reduce the amount of subclassing, by handling collection of fundamental
    types directly from the generic code paths. We now handle boolean,
    tristate, integer, number, string, and relation values in the generic
    code path; if an attribute supports the "undefined" value, we return the
    undefined value singleton.

 gtk/gtkaccessiblevalue.c        | 673 ++++++++++++++++++++++------------------
 gtk/gtkaccessiblevalueprivate.h |  37 ++-
 gtk/gtkaccessiblevaluestatic.c  | 411 ++++++++----------------
 gtk/gtkenums.h                  |  18 +-
 4 files changed, 517 insertions(+), 622 deletions(-)
---
diff --git a/gtk/gtkaccessiblevalue.c b/gtk/gtkaccessiblevalue.c
index 56f9b88642..58e3dd15d1 100644
--- a/gtk/gtkaccessiblevalue.c
+++ b/gtk/gtkaccessiblevalue.c
@@ -182,10 +182,13 @@ gtk_accessible_value_equal (const GtkAccessibleValue *value_a,
   if (value_a == NULL || value_b == NULL)
     return FALSE;
 
+  if (value_a->value_class->equal == NULL)
+    return FALSE;
+
   return value_a->value_class->equal (value_a, value_b);
 }
 
-/* {{{ Basic types */
+/* {{{ Basic allocated types */
 
 typedef struct {
   GtkAccessibleValue parent;
@@ -213,6 +216,7 @@ gtk_int_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_INT_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_INTEGER,
   .type_name = "GtkIntAccessibleValue",
   .instance_size = sizeof (GtkIntAccessibleValue),
   .equal = gtk_int_accessible_value_equal,
@@ -272,6 +276,7 @@ gtk_number_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_NUMBER_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_NUMBER,
   .type_name = "GtkNumberAccessibleValue",
   .instance_size = sizeof (GtkNumberAccessibleValue),
   .equal = gtk_number_accessible_value_equal,
@@ -338,6 +343,7 @@ gtk_string_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_STRING_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_STRING,
   .type_name = "GtkStringAccessibleValue",
   .instance_size = sizeof (GtkStringAccessibleValue),
   .finalize = gtk_string_accessible_value_finalize,
@@ -422,6 +428,7 @@ gtk_reference_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_REFERENCE_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_REFERENCE,
   .type_name = "GtkReferenceAccessibleValue",
   .instance_size = sizeof (GtkReferenceAccessibleValue),
   .finalize = gtk_reference_accessible_value_finalize,
@@ -460,58 +467,202 @@ gtk_reference_accessible_value_get (const GtkAccessibleValue *value)
 /* {{{ Collection API */
 
 typedef enum {
-  GTK_ACCESSIBLE_COLLECT_INVALID,
-  GTK_ACCESSIBLE_COLLECT_BOOLEAN,
-  GTK_ACCESSIBLE_COLLECT_INT,
+  GTK_ACCESSIBLE_COLLECT_INVALID = -1,
+  
+  /* true/false */
+  GTK_ACCESSIBLE_COLLECT_BOOLEAN = 0,
+
+  /* true/false/mixed/undefined */
   GTK_ACCESSIBLE_COLLECT_TRISTATE,
-  GTK_ACCESSIBLE_COLLECT_ENUM,
+
+  /* one token */
+  GTK_ACCESSIBLE_COLLECT_TOKEN,
+
+  /* integer number */
+  GTK_ACCESSIBLE_COLLECT_INTEGER,
+
+  /* real number */
   GTK_ACCESSIBLE_COLLECT_NUMBER,
+
+  /* string */
   GTK_ACCESSIBLE_COLLECT_STRING,
-  GTK_ACCESSIBLE_COLLECT_REF
+
+  /* reference */
+  GTK_ACCESSIBLE_COLLECT_REFERENCE,
+
+  /* allows collecting GTK_ACCESSIBLE_VALUE_UNDEFINED; implied
+   * by GTK_ACCESSIBLE_COLLECT_TRISTATE
+   */
+  GTK_ACCESSIBLE_COLLECT_UNDEFINED = 1 << 16
 } GtkAccessibleCollectType;
 
 typedef struct {
   int value;
   GtkAccessibleCollectType ctype;
   const char *name;
+
+  /* The constructor and getter will be derived by the
+   * @ctype field and by the collected value, except for the
+   * GTK_ACCESSIBLE_COLLECT_TOKEN collection type. You can
+   * override the default ones by filling out these two
+   * pointers
+   */
   GCallback ctor;
+  GCallback getter;
 } GtkAccessibleCollect;
 
 static const GtkAccessibleCollect collect_states[] = {
-/* | State                         | Collected type                 | Name      | Constructor                
      |
- * 
|-------------------------------|--------------------------------|-----------|----------------------------------|
- */
-  { GTK_ACCESSIBLE_STATE_BUSY,     GTK_ACCESSIBLE_COLLECT_BOOLEAN,  "busy",     (GCallback) 
gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_CHECKED,  GTK_ACCESSIBLE_COLLECT_ENUM,     "checked",  (GCallback) 
gtk_checked_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_DISABLED, GTK_ACCESSIBLE_COLLECT_BOOLEAN,  "disabled", (GCallback) 
gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_EXPANDED, GTK_ACCESSIBLE_COLLECT_TRISTATE, "expanded", (GCallback) 
gtk_expanded_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_HIDDEN,   GTK_ACCESSIBLE_COLLECT_BOOLEAN,  "hidden",   (GCallback) 
gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_INVALID,  GTK_ACCESSIBLE_COLLECT_ENUM,     "invalid",  (GCallback) 
gtk_invalid_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_PRESSED,  GTK_ACCESSIBLE_COLLECT_ENUM,     "pressed",  (GCallback) 
gtk_pressed_accessible_value_new },
-  { GTK_ACCESSIBLE_STATE_SELECTED, GTK_ACCESSIBLE_COLLECT_TRISTATE, "selected", (GCallback) 
gtk_selected_accessible_value_new },
+  [GTK_ACCESSIBLE_STATE_BUSY] = {
+    .value = GTK_ACCESSIBLE_STATE_BUSY,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "busy"
+  },
+  [GTK_ACCESSIBLE_STATE_CHECKED] = {
+    .value = GTK_ACCESSIBLE_STATE_CHECKED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TRISTATE,
+    .name = "checked"
+  },
+  [GTK_ACCESSIBLE_STATE_DISABLED] = {
+    .value = GTK_ACCESSIBLE_STATE_DISABLED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "disabled"
+  },
+  [GTK_ACCESSIBLE_STATE_EXPANDED] = {
+    .value = GTK_ACCESSIBLE_STATE_EXPANDED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN | GTK_ACCESSIBLE_COLLECT_UNDEFINED,
+    .name = "expanded"
+  },
+  [GTK_ACCESSIBLE_STATE_HIDDEN] = {
+    .value = GTK_ACCESSIBLE_STATE_HIDDEN,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "hidden"
+  },
+  [GTK_ACCESSIBLE_STATE_INVALID] = {
+    .value = GTK_ACCESSIBLE_STATE_INVALID,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TOKEN,
+    .name = "invalid",
+    .ctor = (GCallback) gtk_invalid_accessible_value_new,
+    .getter = (GCallback) gtk_invalid_accessible_value_get
+  },
+  [GTK_ACCESSIBLE_STATE_PRESSED] = {
+    .value = GTK_ACCESSIBLE_STATE_PRESSED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TRISTATE,
+    .name = "pressed"
+  },
+  [GTK_ACCESSIBLE_STATE_SELECTED] = {
+    .value = GTK_ACCESSIBLE_STATE_SELECTED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN | GTK_ACCESSIBLE_COLLECT_UNDEFINED,
+    .name = "selected"
+  },
 };
 
 /* § 6.6.1 Widget attributes */
 static const GtkAccessibleCollect collect_props[] = {
-  { GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE,      GTK_ACCESSIBLE_COLLECT_ENUM,    "autocomplete",     
(GCallback) gtk_autocomplete_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_DESCRIPTION,       GTK_ACCESSIBLE_COLLECT_STRING,  "description",      
(GCallback) gtk_string_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_HAS_POPUP,         GTK_ACCESSIBLE_COLLECT_BOOLEAN, "haspopup",         
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS,     GTK_ACCESSIBLE_COLLECT_STRING,  "keyshortcuts",     
(GCallback) gtk_string_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_LABEL,             GTK_ACCESSIBLE_COLLECT_STRING,  "label",            
(GCallback) gtk_string_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_LEVEL,             GTK_ACCESSIBLE_COLLECT_INT,     "level",            
(GCallback) gtk_int_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_MODAL,             GTK_ACCESSIBLE_COLLECT_BOOLEAN, "modal",            
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_MULTI_LINE,        GTK_ACCESSIBLE_COLLECT_BOOLEAN, "multiline",        
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE,  GTK_ACCESSIBLE_COLLECT_BOOLEAN, "multiselectable",  
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_ORIENTATION,       GTK_ACCESSIBLE_COLLECT_ENUM,    "orientation",      
(GCallback) gtk_orientation_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER,       GTK_ACCESSIBLE_COLLECT_STRING,  "placeholder",      
(GCallback) gtk_string_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_READ_ONLY,         GTK_ACCESSIBLE_COLLECT_BOOLEAN, "readonly",         
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_REQUIRED,          GTK_ACCESSIBLE_COLLECT_BOOLEAN, "required",         
(GCallback) gtk_boolean_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION,  GTK_ACCESSIBLE_COLLECT_STRING,  "roledescription",  
(GCallback) gtk_string_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_SORT,              GTK_ACCESSIBLE_COLLECT_ENUM,    "sort",             
(GCallback) gtk_sort_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_VALUE_MAX,         GTK_ACCESSIBLE_COLLECT_NUMBER,  "valuemax",         
(GCallback) gtk_number_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,         GTK_ACCESSIBLE_COLLECT_NUMBER,  "valuemin",         
(GCallback) gtk_number_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_VALUE_NOW,         GTK_ACCESSIBLE_COLLECT_NUMBER,  "valuenow",         
(GCallback) gtk_number_accessible_value_new },
-  { GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT,        GTK_ACCESSIBLE_COLLECT_STRING,  "valuetext",        
(GCallback) gtk_string_accessible_value_new },
+  [GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TOKEN,
+    .name = "autocomplete",
+    .ctor = (GCallback) gtk_autocomplete_accessible_value_new,
+    .getter = (GCallback) gtk_autocomplete_accessible_value_get
+  },
+  [GTK_ACCESSIBLE_PROPERTY_DESCRIPTION] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_DESCRIPTION,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "description"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_HAS_POPUP] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_HAS_POPUP,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "haspopup"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "keyshortcuts"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_LABEL] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_LABEL,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "label"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_LEVEL] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_LEVEL,
+    .ctype = GTK_ACCESSIBLE_COLLECT_INTEGER,
+    .name = "level"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_MODAL] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_MODAL,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "modal"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_MULTI_LINE] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_MULTI_LINE,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "multiline"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "multiselectable"
+  },
+  /* "orientation" is a bit special; it maps to GtkOrientation, but it
+   * can also be "undefined". This means we need to override constructor
+   * and getter, in order to properly handle GTK_ACCESSIBLE_VALUE_UNDEFINED
+   */
+  [GTK_ACCESSIBLE_PROPERTY_ORIENTATION] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_ORIENTATION,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TOKEN | GTK_ACCESSIBLE_COLLECT_UNDEFINED,
+    .name = "orientation",
+    .ctor = (GCallback) gtk_orientation_accessible_value_new,
+    .getter = (GCallback) gtk_orientation_accessible_value_get
+  },
+  [GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "placeholder"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_READ_ONLY] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_READ_ONLY,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "readonly"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_REQUIRED] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_REQUIRED,
+    .ctype = GTK_ACCESSIBLE_COLLECT_BOOLEAN,
+    .name = "required"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "roledescription"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_SORT] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_SORT,
+    .ctype = GTK_ACCESSIBLE_COLLECT_TOKEN,
+    .name = "sort",
+    .ctor = (GCallback) gtk_sort_accessible_value_new,
+    .getter = (GCallback) gtk_sort_accessible_value_get
+  },
+  [GTK_ACCESSIBLE_PROPERTY_VALUE_MAX] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_VALUE_MAX,
+    .ctype = GTK_ACCESSIBLE_COLLECT_NUMBER,
+    .name = "valuemax"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_VALUE_MIN] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,
+    .ctype = GTK_ACCESSIBLE_COLLECT_NUMBER,
+    .name = "valuemin"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_VALUE_NOW] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_VALUE_NOW,
+    .ctype = GTK_ACCESSIBLE_COLLECT_NUMBER,
+    .name = "valuenow"
+  },
+  [GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT] = {
+    .value = GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT,
+    .ctype = GTK_ACCESSIBLE_COLLECT_STRING,
+    .name = "valuetext"
+  },
 };
 
 typedef GtkAccessibleValue * (* GtkAccessibleValueBooleanCtor)  (gboolean value);
@@ -544,20 +695,14 @@ gtk_accessible_value_get_default_for_state (GtkAccessibleState state)
       return gtk_boolean_accessible_value_new (FALSE);
 
     case GTK_ACCESSIBLE_STATE_CHECKED:
-      return gtk_checked_accessible_value_new (GTK_ACCESSIBLE_CHECKED_UNDEFINED);
-
     case GTK_ACCESSIBLE_STATE_EXPANDED:
-      return gtk_expanded_accessible_value_new (GTK_ACCESSIBLE_VALUE_UNDEFINED);
+    case GTK_ACCESSIBLE_STATE_PRESSED:
+    case GTK_ACCESSIBLE_STATE_SELECTED:
+      return gtk_undefined_accessible_value_new ();
 
     case GTK_ACCESSIBLE_STATE_INVALID:
       return gtk_invalid_accessible_value_new (GTK_ACCESSIBLE_INVALID_FALSE);
 
-    case GTK_ACCESSIBLE_STATE_PRESSED:
-      return gtk_pressed_accessible_value_new (GTK_ACCESSIBLE_PRESSED_UNDEFINED);
-
-    case GTK_ACCESSIBLE_STATE_SELECTED:
-      return gtk_selected_accessible_value_new (GTK_ACCESSIBLE_VALUE_UNDEFINED);
-
     default:
       g_critical ("Unknown value for accessible state “%s”", cstate->name);
       break;
@@ -566,67 +711,85 @@ gtk_accessible_value_get_default_for_state (GtkAccessibleState state)
   return NULL;
 }
 
-/*< private >
- * gtk_accessible_value_collect_for_state:
- * @state: a #GtkAccessibleState
- * @args: a `va_list` reference
- *
- * Collects and consumes the next item in the @args variadic arguments list,
- * and returns a #GtkAccessibleValue for it.
- *
- * Returns: (transfer full): a #GtkAccessibleValue
- */
-GtkAccessibleValue *
-gtk_accessible_value_collect_for_state (GtkAccessibleState  state,
-                                        va_list            *args)
+static GtkAccessibleValue *
+gtk_accessible_value_collect_valist (const GtkAccessibleCollect *cstate,
+                                     va_list                    *args)
 {
-  const GtkAccessibleCollect *cstate = &collect_states[state];
-
   GtkAccessibleValue *res = NULL;
+  GtkAccessibleCollectType ctype = cstate->ctype;
+  gboolean collects_undef = (ctype & GTK_ACCESSIBLE_COLLECT_UNDEFINED) != 0;
+
+  ctype &= (GTK_ACCESSIBLE_COLLECT_UNDEFINED - 1);
 
-  switch (cstate->ctype)
+  /* Tristate values include "undefined" by definition */
+  if (ctype == GTK_ACCESSIBLE_COLLECT_TRISTATE)
+    collects_undef = TRUE;
+
+  switch (ctype)
     {
     case GTK_ACCESSIBLE_COLLECT_BOOLEAN:
       {
-        GtkAccessibleValueBooleanCtor ctor =
-          (GtkAccessibleValueBooleanCtor) cstate->ctor;
-
-        gboolean value = va_arg (*args, gboolean);
-
-        res = (* ctor) (value);
+        if (collects_undef)
+          {
+            int value = va_arg (*args, int);
+
+            if (value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+              res = gtk_undefined_accessible_value_new ();
+            else
+              res = gtk_boolean_accessible_value_new (value == 0 ? FALSE : TRUE);
+          }
+        else
+          {
+            gboolean value = va_arg (*args, gboolean);
+
+            res = gtk_boolean_accessible_value_new (value);
+          }
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_INT:
+    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
       {
-        GtkAccessibleValueIntCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
-
         int value = va_arg (*args, int);
 
-        res = (* ctor) (value);
+        if (value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+          res = gtk_undefined_accessible_value_new ();
+        else
+          res = gtk_tristate_accessible_value_new (value);
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
+    case GTK_ACCESSIBLE_COLLECT_TOKEN:
       {
-        GtkAccessibleValueTristateCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
+        GtkAccessibleValueEnumCtor ctor =
+          (GtkAccessibleValueEnumCtor) cstate->ctor;
 
         int value = va_arg (*args, int);
 
-        res = (* ctor) (value);
+        if (collects_undef && value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+          {
+            res = gtk_undefined_accessible_value_new ();
+          }
+        else
+          {
+            /* Token collection requires a constructor */
+            g_assert (ctor != NULL);
+
+            res = (* ctor) (value);
+          }
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_ENUM:
+    case GTK_ACCESSIBLE_COLLECT_INTEGER:
       {
         GtkAccessibleValueEnumCtor ctor =
           (GtkAccessibleValueEnumCtor) cstate->ctor;
 
         int value = va_arg (*args, int);
 
-        res = (* ctor) (value);
+        if (ctor == NULL)
+          res = gtk_int_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
@@ -637,7 +800,10 @@ gtk_accessible_value_collect_for_state (GtkAccessibleState  state,
 
         double value = va_arg (*args, double);
 
-        res = (* ctor) (value);
+        if (ctor == NULL)
+          res = gtk_number_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
@@ -648,21 +814,28 @@ gtk_accessible_value_collect_for_state (GtkAccessibleState  state,
 
         const char *value = va_arg (*args, char*);
 
-        res = (* ctor) (value);
+        if (ctor == NULL)
+          res = gtk_string_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_REF:
+    case GTK_ACCESSIBLE_COLLECT_REFERENCE:
       {
         GtkAccessibleValueStringCtor ctor =
           (GtkAccessibleValueStringCtor) cstate->ctor;
 
         gpointer value = va_arg (*args, gpointer);
 
-        res = (* ctor) (value);
+        if (ctor == NULL)
+          res = gtk_reference_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
+    case GTK_ACCESSIBLE_COLLECT_UNDEFINED:
     case GTK_ACCESSIBLE_COLLECT_INVALID:
     default:
       g_critical ("Unknown type for accessible state “%s”", cstate->name);
@@ -672,67 +845,85 @@ gtk_accessible_value_collect_for_state (GtkAccessibleState  state,
   return res;
 }
 
-/*< private >
- * gtk_accessible_value_collect_for_state_value:
- * @state: a #GtkAccessibleState
- * @value: a #GValue
- *
- * Retrieves the value stored inside @value and returns a #GtkAccessibleValue
- * for the given @state.
- *
- * Returns: (transfer full): a #GtkAccessibleValue
- */
-GtkAccessibleValue *
-gtk_accessible_value_collect_for_state_value (GtkAccessibleState  state,
-                                              const GValue       *value)
+static GtkAccessibleValue *
+gtk_accessible_value_collect_value (const GtkAccessibleCollect *cstate,
+                                    const GValue               *value_)
 {
-  const GtkAccessibleCollect *cstate = &collect_states[state];
-
   GtkAccessibleValue *res = NULL;
+  GtkAccessibleCollectType ctype = cstate->ctype;
+  gboolean collects_undef = (ctype & GTK_ACCESSIBLE_COLLECT_UNDEFINED) != 0;
+
+  ctype &= (GTK_ACCESSIBLE_COLLECT_UNDEFINED - 1);
 
-  switch (cstate->ctype)
+  /* Tristate values include "undefined" by definition */
+  if (ctype == GTK_ACCESSIBLE_COLLECT_TRISTATE)
+    collects_undef = TRUE;
+
+  switch (ctype)
     {
     case GTK_ACCESSIBLE_COLLECT_BOOLEAN:
       {
-        GtkAccessibleValueBooleanCtor ctor =
-          (GtkAccessibleValueBooleanCtor) cstate->ctor;
-
-        gboolean value_ = g_value_get_boolean (value);
-
-        res = (* ctor) (value_);
+        if (collects_undef)
+          {
+            int value = g_value_get_int (value_);
+
+            if (value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+              res = gtk_undefined_accessible_value_new ();
+            else
+              res = gtk_boolean_accessible_value_new (value == 0 ? FALSE : TRUE);
+          }
+        else
+          {
+            gboolean value = g_value_get_boolean (value_);
+
+            res = gtk_boolean_accessible_value_new (value);
+          }
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_INT:
+    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
       {
-        GtkAccessibleValueIntCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
+        int value = g_value_get_int (value_);
 
-        int value_ = g_value_get_int (value);
-
-        res = (* ctor) (value_);
+        if (value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+          res = gtk_undefined_accessible_value_new ();
+        else
+          res = gtk_tristate_accessible_value_new (value);
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
+    case GTK_ACCESSIBLE_COLLECT_TOKEN:
       {
-        GtkAccessibleValueTristateCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
+        GtkAccessibleValueEnumCtor ctor =
+          (GtkAccessibleValueEnumCtor) cstate->ctor;
 
-        int value_ = g_value_get_int (value);
+        int value = g_value_get_int (value_);
 
-        res = (* ctor) (value_);
+        if (collects_undef && value == GTK_ACCESSIBLE_VALUE_UNDEFINED)
+          {
+            res = gtk_undefined_accessible_value_new ();
+          }
+        else
+          {
+            /* Token collection requires a constructor */
+            g_assert (ctor != NULL);
+
+            res = (* ctor) (value);
+          }
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_ENUM:
+    case GTK_ACCESSIBLE_COLLECT_INTEGER:
       {
         GtkAccessibleValueEnumCtor ctor =
           (GtkAccessibleValueEnumCtor) cstate->ctor;
 
-        int value_ = g_value_get_enum (value);
+        int value = g_value_get_int (value_);
 
-        res = (* ctor) (value_);
+        if (ctor == NULL)
+          res = gtk_int_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
@@ -741,9 +932,12 @@ gtk_accessible_value_collect_for_state_value (GtkAccessibleState  state,
         GtkAccessibleValueNumberCtor ctor =
           (GtkAccessibleValueNumberCtor) cstate->ctor;
 
-        double value_ = g_value_get_double (value);
+        double value = g_value_get_double (value_);
 
-        res = (* ctor) (value_);
+        if (ctor == NULL)
+          res = gtk_number_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
@@ -752,32 +946,77 @@ gtk_accessible_value_collect_for_state_value (GtkAccessibleState  state,
         GtkAccessibleValueStringCtor ctor =
           (GtkAccessibleValueStringCtor) cstate->ctor;
 
-        const char *value_ = g_value_get_string (value);
+        const char *value = g_value_get_string (value_);
 
-        res = (* ctor) (value_);
+        if (ctor == NULL)
+          res = gtk_string_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
-    case GTK_ACCESSIBLE_COLLECT_REF:
+    case GTK_ACCESSIBLE_COLLECT_REFERENCE:
       {
         GtkAccessibleValueStringCtor ctor =
           (GtkAccessibleValueStringCtor) cstate->ctor;
 
-        gpointer value_ = g_value_get_object (value);
+        gpointer value = g_value_get_object (value_);
 
-        res = (* ctor) (value_);
+        if (ctor == NULL)
+          res = gtk_reference_accessible_value_new (value);
+        else
+          res = (* ctor) (value);
       }
       break;
 
+    case GTK_ACCESSIBLE_COLLECT_UNDEFINED:
     case GTK_ACCESSIBLE_COLLECT_INVALID:
     default:
-      g_critical ("Unknown value type for accessible state “%s”", cstate->name);
+      g_critical ("Unknown type for accessible state “%s”", cstate->name);
       break;
     }
 
   return res;
 }
 
+/*< private >
+ * gtk_accessible_value_collect_for_state:
+ * @state: a #GtkAccessibleState
+ * @args: a `va_list` reference
+ *
+ * Collects and consumes the next item in the @args variadic arguments list,
+ * and returns a #GtkAccessibleValue for it.
+ *
+ * Returns: (transfer full): a #GtkAccessibleValue
+ */
+GtkAccessibleValue *
+gtk_accessible_value_collect_for_state (GtkAccessibleState  state,
+                                        va_list            *args)
+{
+  const GtkAccessibleCollect *cstate = &collect_states[state];
+
+  return gtk_accessible_value_collect_valist (cstate, args);
+}
+
+/*< private >
+ * gtk_accessible_value_collect_for_state_value:
+ * @state: a #GtkAccessibleState
+ * @value: a #GValue
+ *
+ * Retrieves the value stored inside @value and returns a #GtkAccessibleValue
+ * for the given @state.
+ *
+ * Returns: (transfer full): a #GtkAccessibleValue
+ */
+GtkAccessibleValue *
+gtk_accessible_value_collect_for_state_value (GtkAccessibleState  state,
+                                              const GValue       *value)
+{
+  const GtkAccessibleCollect *cstate = &collect_states[state];
+
+  return gtk_accessible_value_collect_value (cstate, value);
+}
+
 /*< private >
  * gtk_accessible_value_get_default_for_property:
  * @property: a #GtkAccessibleProperty
@@ -827,13 +1066,13 @@ gtk_accessible_value_get_default_for_property (GtkAccessibleProperty property)
       return gtk_autocomplete_accessible_value_new (GTK_ACCESSIBLE_AUTOCOMPLETE_NONE);
 
     case GTK_ACCESSIBLE_PROPERTY_ORIENTATION:
-      return gtk_orientation_accessible_value_new (GTK_ORIENTATION_HORIZONTAL);
+      return gtk_undefined_accessible_value_new ();
 
     case GTK_ACCESSIBLE_PROPERTY_SORT:
       return gtk_sort_accessible_value_new (GTK_ACCESSIBLE_SORT_NONE);
 
     default:
-      g_critical ("Unknown value for accessible state “%s”", cstate->name);
+      g_critical ("Unknown value for accessible property “%s”", cstate->name);
       break;
     }
 
@@ -856,94 +1095,7 @@ gtk_accessible_value_collect_for_property (GtkAccessibleProperty  property,
 {
   const GtkAccessibleCollect *cstate = &collect_props[property];
 
-  GtkAccessibleValue *res = NULL;
-
-  switch (cstate->ctype)
-    {
-    case GTK_ACCESSIBLE_COLLECT_BOOLEAN:
-      {
-        GtkAccessibleValueBooleanCtor ctor =
-          (GtkAccessibleValueBooleanCtor) cstate->ctor;
-
-        gboolean value = va_arg (*args, gboolean);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_INT:
-      {
-        GtkAccessibleValueIntCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
-
-        int value = va_arg (*args, int);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
-      {
-        GtkAccessibleValueTristateCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
-
-        int value = va_arg (*args, int);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_ENUM:
-      {
-        GtkAccessibleValueEnumCtor ctor =
-          (GtkAccessibleValueEnumCtor) cstate->ctor;
-
-        int value = va_arg (*args, int);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_NUMBER:
-      {
-        GtkAccessibleValueNumberCtor ctor =
-          (GtkAccessibleValueNumberCtor) cstate->ctor;
-
-        double value = va_arg (*args, double);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_STRING:
-      {
-        GtkAccessibleValueStringCtor ctor =
-          (GtkAccessibleValueStringCtor) cstate->ctor;
-
-        const char *value = va_arg (*args, char*);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_REF:
-      {
-        GtkAccessibleValueStringCtor ctor =
-          (GtkAccessibleValueStringCtor) cstate->ctor;
-
-        gpointer value = va_arg (*args, gpointer);
-
-        res = (* ctor) (value);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_INVALID:
-    default:
-      g_critical ("Unknown type for accessible state “%s”", cstate->name);
-      break;
-    }
-
-  return res;
+  return gtk_accessible_value_collect_valist (cstate, args);
 }
 
 /*< private >
@@ -962,94 +1114,7 @@ gtk_accessible_value_collect_for_property_value (GtkAccessibleProperty  property
 {
   const GtkAccessibleCollect *cstate = &collect_props[property];
 
-  GtkAccessibleValue *res = NULL;
-
-  switch (cstate->ctype)
-    {
-    case GTK_ACCESSIBLE_COLLECT_BOOLEAN:
-      {
-        GtkAccessibleValueBooleanCtor ctor =
-          (GtkAccessibleValueBooleanCtor) cstate->ctor;
-
-        gboolean value_ = g_value_get_boolean (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_INT:
-      {
-        GtkAccessibleValueIntCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
-
-        int value_ = g_value_get_int (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_TRISTATE:
-      {
-        GtkAccessibleValueTristateCtor ctor =
-          (GtkAccessibleValueIntCtor) cstate->ctor;
-
-        int value_ = g_value_get_int (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_ENUM:
-      {
-        GtkAccessibleValueEnumCtor ctor =
-          (GtkAccessibleValueEnumCtor) cstate->ctor;
-
-        int value_ = g_value_get_enum (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_NUMBER:
-      {
-        GtkAccessibleValueNumberCtor ctor =
-          (GtkAccessibleValueNumberCtor) cstate->ctor;
-
-        double value_ = g_value_get_double (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_STRING:
-      {
-        GtkAccessibleValueStringCtor ctor =
-          (GtkAccessibleValueStringCtor) cstate->ctor;
-
-        const char *value_ = g_value_get_string (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_REF:
-      {
-        GtkAccessibleValueStringCtor ctor =
-          (GtkAccessibleValueStringCtor) cstate->ctor;
-
-        gpointer value_ = g_value_get_object (value);
-
-        res = (* ctor) (value_);
-      }
-      break;
-
-    case GTK_ACCESSIBLE_COLLECT_INVALID:
-    default:
-      g_critical ("Unknown value type for accessible state “%s”", cstate->name);
-      break;
-    }
-
-  return res;
+  return gtk_accessible_value_collect_value (cstate, value);
 }
 
 /* }}} */
diff --git a/gtk/gtkaccessiblevalueprivate.h b/gtk/gtkaccessiblevalueprivate.h
index 48744954fc..9f80edac92 100644
--- a/gtk/gtkaccessiblevalueprivate.h
+++ b/gtk/gtkaccessiblevalueprivate.h
@@ -34,6 +34,17 @@ G_BEGIN_DECLS
 typedef struct _GtkAccessibleValue      GtkAccessibleValue;
 typedef struct _GtkAccessibleValueClass GtkAccessibleValueClass;
 
+typedef enum {
+  GTK_ACCESSIBLE_VALUE_TYPE_UNDEFINED,
+  GTK_ACCESSIBLE_VALUE_TYPE_BOOLEAN,
+  GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE,
+  GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
+  GTK_ACCESSIBLE_VALUE_TYPE_INTEGER,
+  GTK_ACCESSIBLE_VALUE_TYPE_NUMBER,
+  GTK_ACCESSIBLE_VALUE_TYPE_STRING,
+  GTK_ACCESSIBLE_VALUE_TYPE_REFERENCE
+} GtkAccessibleValueType;
+
 struct _GtkAccessibleValue
 {
   const GtkAccessibleValueClass *value_class;
@@ -41,8 +52,11 @@ struct _GtkAccessibleValue
   int ref_count;
 };
 
+#define GTK_ACCESSIBLE_VALUE_INIT(klass)        { .value_class = (klass), .ref_count = 1 }
+
 struct _GtkAccessibleValueClass
 {
+  GtkAccessibleValueType type;
   const char *type_name;
   gsize instance_size;
 
@@ -54,6 +68,9 @@ struct _GtkAccessibleValueClass
                       const GtkAccessibleValue *value_b);
 };
 
+#define GTK_IS_ACCESSIBLE_VALUE_TYPE(v,type) \
+  ((v)->value_class->type == (type))
+
 typedef enum {
   GTK_ACCESSIBLE_VALUE_ERROR_READ_ONLY,
   GTK_ACCESSIBLE_VALUE_ERROR_INVALID_VALUE,
@@ -87,10 +104,14 @@ GtkAccessibleValue *    gtk_accessible_value_collect_for_property_value (GtkAcce
 
 /* Basic values */
 GtkAccessibleValue *            gtk_undefined_accessible_value_new      (void);
+int                             gtk_undefined_accessible_value_get      (const GtkAccessibleValue *value);
 
 GtkAccessibleValue *            gtk_boolean_accessible_value_new        (gboolean                  value);
 gboolean                        gtk_boolean_accessible_value_get        (const GtkAccessibleValue *value);
 
+GtkAccessibleValue *            gtk_tristate_accessible_value_new       (GtkAccessibleTristate     value);
+GtkAccessibleTristate           gtk_tristate_accessible_value_get       (const GtkAccessibleValue *value);
+
 GtkAccessibleValue *            gtk_int_accessible_value_new            (int                       value);
 int                             gtk_int_accessible_value_get            (const GtkAccessibleValue *value);
 
@@ -103,23 +124,7 @@ const char *                    gtk_string_accessible_value_get         (const G
 GtkAccessibleValue *            gtk_reference_accessible_value_new      (GtkAccessible            *value);
 GtkAccessible *                 gtk_reference_accessible_value_get      (const GtkAccessibleValue *value);
 
-/* Tri-state values */
-GtkAccessibleValue *            gtk_expanded_accessible_value_new       (int                       value);
-int                             gtk_expanded_accessible_value_get       (const GtkAccessibleValue *value);
-
-GtkAccessibleValue *            gtk_grabbed_accessible_value_new        (int                       value);
-int                             gtk_grabbed_accessible_value_get        (const GtkAccessibleValue *value);
-
-GtkAccessibleValue *            gtk_selected_accessible_value_new       (int                       value);
-int                             gtk_selected_accessible_value_get       (const GtkAccessibleValue *value);
-
 /* Token values */
-GtkAccessibleValue *            gtk_pressed_accessible_value_new        (GtkAccessiblePressedState value);
-GtkAccessiblePressedState       gtk_pressed_accessible_value_get        (const GtkAccessibleValue *value);
-
-GtkAccessibleValue *            gtk_checked_accessible_value_new        (GtkAccessibleCheckedState value);
-GtkAccessibleCheckedState       gtk_checked_accessible_value_get        (const GtkAccessibleValue *value);
-
 GtkAccessibleValue *            gtk_invalid_accessible_value_new        (GtkAccessibleInvalidState value);
 GtkAccessibleInvalidState       gtk_invalid_accessible_value_get        (const GtkAccessibleValue *value);
 
diff --git a/gtk/gtkaccessiblevaluestatic.c b/gtk/gtkaccessiblevaluestatic.c
index 5704212448..f984b836b0 100644
--- a/gtk/gtkaccessiblevaluestatic.c
+++ b/gtk/gtkaccessiblevaluestatic.c
@@ -32,14 +32,14 @@ gtk_undefined_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_UNDEFINED_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_UNDEFINED,
   .type_name = "GtkUndefinedAccessibleValue",
   .instance_size = sizeof (GtkAccessibleValue),
   .print = gtk_undefined_accessible_value_print,
 };
 
-static GtkAccessibleValue undefined_value = {
-  &GTK_UNDEFINED_ACCESSIBLE_VALUE, 1
-};
+static GtkAccessibleValue undefined_value =
+  GTK_ACCESSIBLE_VALUE_INIT (&GTK_UNDEFINED_ACCESSIBLE_VALUE);
 
 GtkAccessibleValue *
 gtk_undefined_accessible_value_new (void)
@@ -47,6 +47,16 @@ gtk_undefined_accessible_value_new (void)
   return gtk_accessible_value_ref (&undefined_value);
 }
 
+int
+gtk_undefined_accessible_value_get (const GtkAccessibleValue *value)
+{
+  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
+  g_return_val_if_fail (value->value_class == &GTK_UNDEFINED_ACCESSIBLE_VALUE,
+                        GTK_ACCESSIBLE_VALUE_UNDEFINED);
+
+  return GTK_ACCESSIBLE_VALUE_UNDEFINED;
+}
+
 /* }}} */
 
 /* {{{ Boolean values */ 
@@ -78,6 +88,7 @@ gtk_boolean_accessible_value_print (const GtkAccessibleValue *value,
 }
 
 static const GtkAccessibleValueClass GTK_BOOLEAN_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_BOOLEAN,
   .type_name = "GtkBooleanAccessibleValue",
   .instance_size = sizeof (GtkBooleanAccessibleValue),
   .equal = gtk_boolean_accessible_value_equal,
@@ -85,8 +96,8 @@ static const GtkAccessibleValueClass GTK_BOOLEAN_ACCESSIBLE_VALUE = {
 };
 
 static GtkBooleanAccessibleValue boolean_values[] = {
-  { { &GTK_BOOLEAN_ACCESSIBLE_VALUE, 1 }, FALSE },
-  { { &GTK_BOOLEAN_ACCESSIBLE_VALUE, 1 }, TRUE },
+  { GTK_ACCESSIBLE_VALUE_INIT (&GTK_BOOLEAN_ACCESSIBLE_VALUE), FALSE },
+  { GTK_ACCESSIBLE_VALUE_INIT (&GTK_BOOLEAN_ACCESSIBLE_VALUE), TRUE },
 };
 
 GtkAccessibleValue *
@@ -116,17 +127,17 @@ gtk_boolean_accessible_value_get (const GtkAccessibleValue *value)
 typedef struct {
   GtkAccessibleValue parent;
 
-  int value;
+  GtkAccessibleTristate value;
 } GtkTristateAccessibleValue;
 
 static gboolean
 gtk_tristate_accessible_value_equal (const GtkAccessibleValue *value_a,
                                      const GtkAccessibleValue *value_b)
 {
-  const GtkTristateAccessibleValue *tri_a = (GtkTristateAccessibleValue *) value_a;
-  const GtkTristateAccessibleValue *tri_b = (GtkTristateAccessibleValue *) value_b;
+  const GtkTristateAccessibleValue *self_a = (GtkTristateAccessibleValue *) value_a;
+  const GtkTristateAccessibleValue *self_b = (GtkTristateAccessibleValue *) value_b;
 
-  return tri_a->value == tri_b->value;
+  return self_a->value == self_b->value;
 }
 
 static void
@@ -137,16 +148,16 @@ gtk_tristate_accessible_value_print (const GtkAccessibleValue *value,
 
   switch (self->value)
     {
-    case 0:
+    case GTK_ACCESSIBLE_TRISTATE_FALSE:
       g_string_append (buffer, "false");
       break;
 
-    case 1:
+    case GTK_ACCESSIBLE_TRISTATE_TRUE:
       g_string_append (buffer, "true");
       break;
 
-    case -1:
-      g_string_append (buffer, "undefined");
+    case GTK_ACCESSIBLE_TRISTATE_MIXED:
+      g_string_append (buffer, "mixed");
       break;
 
     default:
@@ -155,123 +166,41 @@ gtk_tristate_accessible_value_print (const GtkAccessibleValue *value,
     }
 }
 
-static const GtkAccessibleValueClass GTK_EXPANDED_ACCESSIBLE_VALUE = {
-  .type_name = "GtkExpandedAccessibleValue",
+static const GtkAccessibleValueClass GTK_TRISTATE_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE,
+  .type_name = "GtkTristateAccessibleValue",
   .instance_size = sizeof (GtkTristateAccessibleValue),
   .equal = gtk_tristate_accessible_value_equal,
   .print = gtk_tristate_accessible_value_print,
 };
 
-static GtkTristateAccessibleValue expanded_values[] = {
-  { { &GTK_EXPANDED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_VALUE_UNDEFINED },
-  { { &GTK_EXPANDED_ACCESSIBLE_VALUE, 1 }, 0 },
-  { { &GTK_EXPANDED_ACCESSIBLE_VALUE, 1 }, 1 },
+static GtkTristateAccessibleValue tristate_values[] = {
+  [GTK_ACCESSIBLE_TRISTATE_FALSE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_FALSE
+  },
+  [GTK_ACCESSIBLE_TRISTATE_TRUE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_TRUE
+  },
+  [GTK_ACCESSIBLE_TRISTATE_MIXED] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_MIXED
+  },
 };
 
 GtkAccessibleValue *
-gtk_expanded_accessible_value_new (int state)
-{
-  int index_;
-
-  if (state < 0)
-    index_ = 0;
-  else if (state == 0)
-    index_ = 1;
-  else
-    index_ = 2;
-
-  return gtk_accessible_value_ref ((GtkAccessibleValue *) &expanded_values[index_]);
-}
-
-int
-gtk_expanded_accessible_value_get (const GtkAccessibleValue *value)
+gtk_tristate_accessible_value_new (GtkAccessibleTristate value)
 {
-  GtkTristateAccessibleValue *self = (GtkTristateAccessibleValue *) value;
-
-  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
-  g_return_val_if_fail (value->value_class == &GTK_EXPANDED_ACCESSIBLE_VALUE,
-                        GTK_ACCESSIBLE_VALUE_UNDEFINED);
-
-  return self->value;
+  return gtk_accessible_value_ref ((GtkAccessibleValue *) &tristate_values[value]);
 }
 
-static const GtkAccessibleValueClass GTK_GRABBED_ACCESSIBLE_VALUE = {
-  .type_name = "GtkGrabbedAccessibleValue",
-  .instance_size = sizeof (GtkTristateAccessibleValue),
-  .equal = gtk_tristate_accessible_value_equal,
-  .print = gtk_tristate_accessible_value_print,
-};
-
-static GtkTristateAccessibleValue grabbed_values[] = {
-  { { &GTK_GRABBED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_VALUE_UNDEFINED },
-  { { &GTK_GRABBED_ACCESSIBLE_VALUE, 1 }, 0 },
-  { { &GTK_GRABBED_ACCESSIBLE_VALUE, 1 }, 1 },
-};
-
-GtkAccessibleValue *
-gtk_grabbed_accessible_value_new (int state)
+GtkAccessibleTristate
+gtk_tristate_accessible_value_get (const GtkAccessibleValue *value)
 {
-  int index_;
-
-  if (state < 0)
-    index_ = 0;
-  else if (state == 0)
-    index_ = 1;
-  else
-    index_ = 2;
-
-  return gtk_accessible_value_ref ((GtkAccessibleValue *) &grabbed_values[index_]);
-}
+  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_TRISTATE_FALSE);
+  g_return_val_if_fail (value->value_class == &GTK_TRISTATE_ACCESSIBLE_VALUE,
+                        GTK_ACCESSIBLE_TRISTATE_FALSE);
 
-int
-gtk_grabbed_accessible_value_get (const GtkAccessibleValue *value)
-{
   GtkTristateAccessibleValue *self = (GtkTristateAccessibleValue *) value;
 
-  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
-  g_return_val_if_fail (value->value_class == &GTK_GRABBED_ACCESSIBLE_VALUE,
-                        GTK_ACCESSIBLE_VALUE_UNDEFINED);
-
-  return self->value;
-}
-
-static const GtkAccessibleValueClass GTK_SELECTED_ACCESSIBLE_VALUE = {
-  .type_name = "GtkSelectedAccessibleValue",
-  .instance_size = sizeof (GtkTristateAccessibleValue),
-  .equal = gtk_tristate_accessible_value_equal,
-  .print = gtk_tristate_accessible_value_print,
-};
-
-static GtkTristateAccessibleValue selected_values[] = {
-  { { &GTK_SELECTED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_VALUE_UNDEFINED },
-  { { &GTK_SELECTED_ACCESSIBLE_VALUE, 1 }, 0 },
-  { { &GTK_SELECTED_ACCESSIBLE_VALUE, 1 }, 1 },
-};
-
-GtkAccessibleValue *
-gtk_selected_accessible_value_new (int state)
-{
-  int index_;
-
-  if (state < 0)
-    index_ = 0;
-  else if (state == 0)
-    index_ = 1;
-  else
-    index_ = 2;
-
-  return gtk_accessible_value_ref ((GtkAccessibleValue *) &selected_values[index_]);
-}
-
-int
-gtk_selected_accessible_value_get (const GtkAccessibleValue *value)
-{
-  GtkTristateAccessibleValue *self = (GtkTristateAccessibleValue *) value;
-
-  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
-  g_return_val_if_fail (value->value_class == &GTK_SELECTED_ACCESSIBLE_VALUE,
-                        GTK_ACCESSIBLE_VALUE_UNDEFINED);
-
   return self->value;
 }
 
@@ -284,153 +213,48 @@ typedef struct {
 
   int value;
   const char *token;
-} GtkEnumAccessibleValue;
+} GtkTokenAccessibleValue;
 
 static gboolean
-gtk_enum_accessible_value_equal (const GtkAccessibleValue *value_a,
-                                 const GtkAccessibleValue *value_b)
+gtk_token_accessible_value_equal (const GtkAccessibleValue *value_a,
+                                  const GtkAccessibleValue *value_b)
 {
-  const GtkEnumAccessibleValue *enum_a = (GtkEnumAccessibleValue *) value_a;
-  const GtkEnumAccessibleValue *enum_b = (GtkEnumAccessibleValue *) value_b;
+  const GtkTokenAccessibleValue *self_a = (GtkTokenAccessibleValue *) value_a;
+  const GtkTokenAccessibleValue *self_b = (GtkTokenAccessibleValue *) value_b;
 
-  return enum_a->value == enum_b->value;
+  return self_a->value == self_b->value;
 }
 
 static void
-gtk_enum_accessible_value_print (const GtkAccessibleValue *value,
-                                 GString                  *buffer)
+gtk_token_accessible_value_print (const GtkAccessibleValue *value,
+                                  GString                  *buffer)
 {
-  const GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
+  const GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
 
   g_string_append (buffer, self->token);
 }
 
-static const GtkAccessibleValueClass GTK_CHECKED_ACCESSIBLE_VALUE = {
-  .type_name = "GtkCheckedAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
-};
-
-static GtkEnumAccessibleValue checked_values[] = {
-  { { &GTK_CHECKED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_CHECKED_FALSE,     "false" },
-  { { &GTK_CHECKED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_CHECKED_TRUE,      "true" },
-  { { &GTK_CHECKED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_PRESSED_UNDEFINED, "undefined" },
-  { { &GTK_CHECKED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_CHECKED_MIXED,     "mixed" },
-};
-
-GtkAccessibleValue *
-gtk_checked_accessible_value_new (GtkAccessibleCheckedState state)
-{
-  int index_;
-
-  switch (state)
-    {
-    case GTK_ACCESSIBLE_CHECKED_FALSE:
-      index_ = 0;
-      break;
-
-    case GTK_ACCESSIBLE_CHECKED_TRUE:
-      index_ = 1;
-      break;
-
-    case GTK_ACCESSIBLE_CHECKED_UNDEFINED:
-      index_ = 2;
-      break;
-
-    case GTK_ACCESSIBLE_CHECKED_MIXED:
-      index_ = 3;
-      break;
-
-    default:
-      g_assert_not_reached ();
-      return NULL;
-    }
-
-  return gtk_accessible_value_ref ((GtkAccessibleValue *) &checked_values[index_]);
-}
-
-GtkAccessibleCheckedState
-gtk_checked_accessible_value_get (const GtkAccessibleValue *value)
-{
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
-
-  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_CHECKED_UNDEFINED);
-  g_return_val_if_fail (value->value_class == &GTK_CHECKED_ACCESSIBLE_VALUE,
-                        GTK_ACCESSIBLE_CHECKED_UNDEFINED);
-
-  return self->value;
-}
-
-static const GtkAccessibleValueClass GTK_PRESSED_ACCESSIBLE_VALUE = {
-  .type_name = "GtkPressedAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
-};
-
-static GtkEnumAccessibleValue pressed_values[] = {
-  { { &GTK_PRESSED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_PRESSED_FALSE,     "false" },
-  { { &GTK_PRESSED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_PRESSED_TRUE,      "true" },
-  { { &GTK_PRESSED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_PRESSED_UNDEFINED, "undefined" },
-  { { &GTK_PRESSED_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_PRESSED_MIXED,     "mixed" },
-};
-
-GtkAccessibleValue *
-gtk_pressed_accessible_value_new (GtkAccessiblePressedState state)
-{
-  int index_;
-
-  switch (state)
-    {
-    case GTK_ACCESSIBLE_PRESSED_FALSE:
-      index_ = 0;
-      break;
-
-    case GTK_ACCESSIBLE_PRESSED_TRUE:
-      index_ = 1;
-      break;
-
-    case GTK_ACCESSIBLE_PRESSED_UNDEFINED:
-      index_ = 2;
-      break;
-
-    case GTK_ACCESSIBLE_PRESSED_MIXED:
-      index_ = 3;
-      break;
-
-    default:
-      g_assert_not_reached ();
-      return NULL;
-    }
-
-  return gtk_accessible_value_ref ((GtkAccessibleValue *) &pressed_values[index_]);
-}
-
-GtkAccessiblePressedState
-gtk_pressed_accessible_value_get (const GtkAccessibleValue *value)
-{
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
-
-  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_PRESSED_UNDEFINED);
-  g_return_val_if_fail (value->value_class == &GTK_PRESSED_ACCESSIBLE_VALUE,
-                        GTK_ACCESSIBLE_PRESSED_UNDEFINED);
-
-  return self->value;
-}
-
 static const GtkAccessibleValueClass GTK_INVALID_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
   .type_name = "GtkInvalidAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
+  .instance_size = sizeof (GtkTokenAccessibleValue),
+  .equal = gtk_token_accessible_value_equal,
+  .print = gtk_token_accessible_value_print,
 };
 
-static GtkEnumAccessibleValue invalid_values[] = {
-  { { &GTK_INVALID_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_INVALID_FALSE,    "false" },
-  { { &GTK_INVALID_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_INVALID_TRUE,     "true" },
-  { { &GTK_INVALID_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_INVALID_GRAMMAR,  "grammar" },
-  { { &GTK_INVALID_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_INVALID_SPELLING, "spelling" },
+static GtkTokenAccessibleValue invalid_values[] = {
+  [GTK_ACCESSIBLE_INVALID_FALSE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_FALSE, "false"
+  },
+  [GTK_ACCESSIBLE_INVALID_TRUE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_TRUE, "true"
+  },
+  [GTK_ACCESSIBLE_INVALID_GRAMMAR] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_GRAMMAR, "grammar"
+  },
+  [GTK_ACCESSIBLE_INVALID_SPELLING] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_SPELLING, "spelling"
+  },
 };
 
 GtkAccessibleValue *
@@ -446,7 +270,7 @@ gtk_invalid_accessible_value_new (GtkAccessibleInvalidState state)
 GtkAccessibleInvalidState
 gtk_invalid_accessible_value_get (const GtkAccessibleValue *value)
 {
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
+  GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
 
   g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_INVALID_FALSE);
   g_return_val_if_fail (value->value_class == &GTK_INVALID_ACCESSIBLE_VALUE,
@@ -456,17 +280,26 @@ gtk_invalid_accessible_value_get (const GtkAccessibleValue *value)
 }
 
 static const GtkAccessibleValueClass GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
   .type_name = "GtkAutocompleteAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
+  .instance_size = sizeof (GtkTokenAccessibleValue),
+  .equal = gtk_token_accessible_value_equal,
+  .print = gtk_token_accessible_value_print,
 };
 
-static GtkEnumAccessibleValue autocomplete_values[] = {
-  { { &GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_AUTOCOMPLETE_NONE,   "none" },
-  { { &GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE, "inline" },
-  { { &GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_AUTOCOMPLETE_LIST,   "list" },
-  { { &GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH,   "both" },
+static GtkTokenAccessibleValue autocomplete_values[] = {
+  [GTK_ACCESSIBLE_AUTOCOMPLETE_NONE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_NONE, "none"
+  },
+  [GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE, 
"inline"
+  },
+  [GTK_ACCESSIBLE_AUTOCOMPLETE_LIST] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_LIST, "list"
+  },
+  [GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH, "both"
+  },
 };
 
 GtkAccessibleValue *
@@ -482,7 +315,7 @@ gtk_autocomplete_accessible_value_new (GtkAccessibleAutocomplete value)
 GtkAccessibleAutocomplete
 gtk_autocomplete_accessible_value_get (const GtkAccessibleValue *value)
 {
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
+  GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
 
   g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_AUTOCOMPLETE_NONE);
   g_return_val_if_fail (value->value_class == &GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE,
@@ -492,61 +325,61 @@ gtk_autocomplete_accessible_value_get (const GtkAccessibleValue *value)
 }
 
 static const GtkAccessibleValueClass GTK_ORIENTATION_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
   .type_name = "GtkOrientationAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
+  .instance_size = sizeof (GtkTokenAccessibleValue),
+  .equal = gtk_token_accessible_value_equal,
+  .print = gtk_token_accessible_value_print,
 };
 
-static GtkEnumAccessibleValue orientation_values[] = {
-  { { &GTK_ORIENTATION_ACCESSIBLE_VALUE, 1 }, GTK_ORIENTATION_HORIZONTAL,     "horizontal" },
-  { { &GTK_ORIENTATION_ACCESSIBLE_VALUE, 1 }, GTK_ORIENTATION_VERTICAL,       "vertical"   },
-  { { &GTK_ORIENTATION_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_VALUE_UNDEFINED, "undefined"  },
+static GtkTokenAccessibleValue orientation_values[] = {
+  [GTK_ORIENTATION_HORIZONTAL] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_ORIENTATION_ACCESSIBLE_VALUE), GTK_ORIENTATION_HORIZONTAL, "horizontal"
+  },
+  [GTK_ORIENTATION_VERTICAL] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_ORIENTATION_ACCESSIBLE_VALUE), GTK_ORIENTATION_VERTICAL, "vertical"
+  },
 };
 
 GtkAccessibleValue *
 gtk_orientation_accessible_value_new (GtkOrientation value)
 {
-  switch (value)
-    {
-    case GTK_ORIENTATION_HORIZONTAL:
-      return gtk_accessible_value_ref ((GtkAccessibleValue *) &orientation_values[0]);
-
-    case GTK_ORIENTATION_VERTICAL:
-      return gtk_accessible_value_ref ((GtkAccessibleValue *) &orientation_values[1]);
-
-    default:
-      g_assert_not_reached ();
-      break;
-    }
-
-  return NULL;
+  return gtk_accessible_value_ref ((GtkAccessibleValue *) &orientation_values[value]);
 }
 
 GtkOrientation
 gtk_orientation_accessible_value_get (const GtkAccessibleValue *value)
 {
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
+  GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
 
-  g_return_val_if_fail (value != NULL, GTK_ORIENTATION_HORIZONTAL);
+  g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
   g_return_val_if_fail (value->value_class == &GTK_ORIENTATION_ACCESSIBLE_VALUE,
-                        GTK_ORIENTATION_HORIZONTAL);
+                        GTK_ACCESSIBLE_VALUE_UNDEFINED);
 
   return self->value;
 }
 
 static const GtkAccessibleValueClass GTK_SORT_ACCESSIBLE_VALUE = {
+  .type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
   .type_name = "GtkSortAccessibleValue",
-  .instance_size = sizeof (GtkEnumAccessibleValue),
-  .equal = gtk_enum_accessible_value_equal,
-  .print = gtk_enum_accessible_value_print,
+  .instance_size = sizeof (GtkTokenAccessibleValue),
+  .equal = gtk_token_accessible_value_equal,
+  .print = gtk_token_accessible_value_print,
 };
 
-static GtkEnumAccessibleValue sort_values[] = {
-  { { &GTK_SORT_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_SORT_NONE,       "none" },
-  { { &GTK_SORT_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_SORT_ASCENDING,  "ascending" },
-  { { &GTK_SORT_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_SORT_DESCENDING, "descending" },
-  { { &GTK_SORT_ACCESSIBLE_VALUE, 1 }, GTK_ACCESSIBLE_SORT_OTHER,      "other" },
+static GtkTokenAccessibleValue sort_values[] = {
+  [GTK_ACCESSIBLE_SORT_NONE] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_NONE, "none"
+  },
+  [GTK_ACCESSIBLE_SORT_ASCENDING] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_ASCENDING, "ascending"
+  },
+  [GTK_ACCESSIBLE_SORT_DESCENDING] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_DESCENDING, "descending"
+  },
+  [GTK_ACCESSIBLE_SORT_OTHER] = {
+    GTK_ACCESSIBLE_VALUE_INIT (&GTK_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_OTHER, "other"
+  },
 };
 
 GtkAccessibleValue *
@@ -562,7 +395,7 @@ gtk_sort_accessible_value_new (GtkAccessibleSort value)
 GtkAccessibleSort
 gtk_sort_accessible_value_get (const GtkAccessibleValue *value)
 {
-  GtkEnumAccessibleValue *self = (GtkEnumAccessibleValue *) value;
+  GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
 
   g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_SORT_NONE);
   g_return_val_if_fail (value->value_class == &GTK_SORT_ACCESSIBLE_VALUE,
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 498db54204..c78682b87d 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -1394,19 +1394,11 @@ typedef enum {
   GTK_ACCESSIBLE_RELATION_SET_SIZE
 } GtkAccessibleRelation;
 
-typedef enum { /*< prefix=GTK_ACCESSIBLE_CHECKED >*/
-  GTK_ACCESSIBLE_CHECKED_FALSE     = 0,
-  GTK_ACCESSIBLE_CHECKED_TRUE      = 1,
-  GTK_ACCESSIBLE_CHECKED_UNDEFINED = -1,
-  GTK_ACCESSIBLE_CHECKED_MIXED     = -2
-} GtkAccessibleCheckedState;
-
-typedef enum { /*< prefix=GTK_ACCESSIBLE_PRESSED >*/
-  GTK_ACCESSIBLE_PRESSED_FALSE     = 0,
-  GTK_ACCESSIBLE_PRESSED_TRUE      = 1,
-  GTK_ACCESSIBLE_PRESSED_UNDEFINED = -1,
-  GTK_ACCESSIBLE_PRESSED_MIXED     = -2
-} GtkAccessiblePressedState;
+typedef enum {
+  GTK_ACCESSIBLE_TRISTATE_FALSE,
+  GTK_ACCESSIBLE_TRISTATE_TRUE,
+  GTK_ACCESSIBLE_TRISTATE_MIXED
+} GtkAccessibleTristate;
 
 typedef enum { /*< prefix=GTK_ACCESSIBLE_INVALID >*/
   GTK_ACCESSIBLE_INVALID_FALSE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]