[gtk/ebassi/new-a11y: 54/71] Remove GTK_ACCESSIBLE_STATE_NONE
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/new-a11y: 54/71] Remove GTK_ACCESSIBLE_STATE_NONE
- Date: Wed, 22 Jul 2020 12:26:18 +0000 (UTC)
commit 74705440f59c0f93248fddd231f45151f81de294
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jul 15 13:20:38 2020 +0100
Remove GTK_ACCESSIBLE_STATE_NONE
It's pointless, we can use an explicit value of `-1` everywhere.
Additionally, it complicates all code that uses the state enumeration as
an array index, since now we need to guard against a negative offset.
gtk/gtkaccessible.c | 4 ++--
gtk/gtkaccessiblevalue.c | 6 ------
gtk/gtkenums.h | 19 ++++++++++---------
3 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index c06612ba83..8cace46611 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -108,7 +108,7 @@ gtk_accessible_get_accessible_role (GtkAccessible *self)
* gtk_accessible_update_state:
* @self: a #GtkAccessible
* @first_state: the first #GtkAccessibleState
- * @...: a list of state and value pairs, terminated by %GTK_ACCESSIBLE_STATE_NONE
+ * @...: a list of state and value pairs, terminated by -1
*
* Updates a list of accessible states.
*
@@ -134,7 +134,7 @@ gtk_accessible_update_state (GtkAccessible *self,
state = first_state;
- while (state != GTK_ACCESSIBLE_STATE_NONE)
+ while (state != -1)
{
GtkAccessibleValue *value = gtk_accessible_value_collect_for_state (state, &args);
diff --git a/gtk/gtkaccessiblevalue.c b/gtk/gtkaccessiblevalue.c
index 6509272205..db2509ebd6 100644
--- a/gtk/gtkaccessiblevalue.c
+++ b/gtk/gtkaccessiblevalue.c
@@ -538,8 +538,6 @@ typedef GtkAccessibleValue * (* GtkAccessibleValueRefCtor) (gpointer value)
GtkAccessibleValue *
gtk_accessible_value_get_default_for_state (GtkAccessibleState state)
{
- g_assert (state != GTK_ACCESSIBLE_STATE_NONE);
-
const GtkAccessibleCollect *cstate = &collect_states[state];
switch (cstate->value)
@@ -589,8 +587,6 @@ GtkAccessibleValue *
gtk_accessible_value_collect_for_state (GtkAccessibleState state,
va_list *args)
{
- g_assert (state != GTK_ACCESSIBLE_STATE_NONE);
-
const GtkAccessibleCollect *cstate = &collect_states[state];
GtkAccessibleValue *res = NULL;
@@ -697,8 +693,6 @@ GtkAccessibleValue *
gtk_accessible_value_collect_for_state_value (GtkAccessibleState state,
const GValue *value)
{
- g_assert (state != GTK_ACCESSIBLE_STATE_NONE);
-
const GtkAccessibleCollect *cstate = &collect_states[state];
GtkAccessibleValue *res = NULL;
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index d7080d47c7..30bfc568c5 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -1302,30 +1302,31 @@ typedef enum {
/**
* GtkAccessibleState:
- * @GTK_ACCESSIBLE_STATE_NONE: An invalid state, used as a sentinel value
* @GTK_ACCESSIBLE_STATE_BUSY: A “busy” state
- * @GTK_ACCESSIBLE_STATE_CHECKED: A “checked” state; corresponds to the
- * #GtkToggleButton:active property on #GtkToggleButton
+ * @GTK_ACCESSIBLE_STATE_CHECKED: A “checked” state; indicates the current
+ * state of a #GtkCheckButton
* @GTK_ACCESSIBLE_STATE_DISABLED: A “disabled” state; corresponds to the
- * #GtkWidget:sensitive property on #GtkWidget
+ * #GtkWidget:sensitive property on #GtkWidget. It indicates a UI element
+ * that is perceivable, but not editable or operable
* @GTK_ACCESSIBLE_STATE_EXPANDED: An “expanded” state; corresponds to the
* #GtkExpander:expanded property on #GtkExpander
* @GTK_ACCESSIBLE_STATE_GRABBED: A “grabbed” state; set when a widget is
* being grabbed in a drag and drop operation
* @GTK_ACCESSIBLE_STATE_HIDDEN: A “hidden” state; corresponds to the
- * #GtkWidget:visible property on #GtkWidget
+ * #GtkWidget:visible property on #GtkWidget. You can use this state
+ * explicitly on UI elements that should not be exposed to an assistive
+ * technology. See also: %GTK_ACCESSIBLE_STATE_DISABLED
* @GTK_ACCESSIBLE_STATE_INVALID: An “invalid” state; set when a widget
* is showing an error
- * @GTK_ACCESSIBLE_STATE_PRESSED: A “pressed” state; set when a widget
- * is being activated by a pointer
+ * @GTK_ACCESSIBLE_STATE_PRESSED: A “pressed” state; indicates the current
+ * state of a #GtkToggleButton
* @GTK_ACCESSIBLE_STATE_SELECTED: A “selected” state; set when a widget
* is selected
*
* The possible accessible state of a #GtkAccessible.
*/
typedef enum {
- GTK_ACCESSIBLE_STATE_NONE = -1,
- GTK_ACCESSIBLE_STATE_BUSY = 0,
+ GTK_ACCESSIBLE_STATE_BUSY,
GTK_ACCESSIBLE_STATE_CHECKED,
GTK_ACCESSIBLE_STATE_DISABLED,
GTK_ACCESSIBLE_STATE_EXPANDED,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]