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.
This commit is contained in:
Emmanuele Bassi 2020-07-15 13:20:38 +01:00
parent c56e9b2031
commit ae446e8f4a
3 changed files with 12 additions and 17 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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,