mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
a11y: Parse reference lists using varargs
Using GList is a bit lame, and makes the API more complicated to use than necessary in the common case. The only real use case for a GList is gtk_widget_add_mnemonic_label(), and for that we can use the GValue-based API instead. Fixes: #3343
This commit is contained in:
parent
6af89e9034
commit
c264254d4b
@ -1120,18 +1120,35 @@ gtk_accessible_value_collect_valist (const GtkAccessibleCollect *cstate,
|
|||||||
GtkAccessibleValueRefListCtor ctor =
|
GtkAccessibleValueRefListCtor ctor =
|
||||||
(GtkAccessibleValueRefListCtor) cstate->ctor;
|
(GtkAccessibleValueRefListCtor) cstate->ctor;
|
||||||
|
|
||||||
GList *value = va_arg (*args, gpointer);
|
GtkAccessible *ref = va_arg (*args, gpointer);
|
||||||
|
GList *value = NULL;
|
||||||
|
|
||||||
if (ctor == NULL)
|
while (ref != NULL)
|
||||||
{
|
{
|
||||||
if (value == NULL)
|
if (!GTK_IS_ACCESSIBLE (ref))
|
||||||
res = NULL;
|
{
|
||||||
else
|
g_set_error (error, GTK_ACCESSIBLE_VALUE_ERROR,
|
||||||
res = gtk_reference_list_accessible_value_new (value);
|
GTK_ACCESSIBLE_VALUE_ERROR_INVALID_VALUE,
|
||||||
|
"Reference of type “%s” [%p] does not implement GtkAccessible",
|
||||||
|
G_OBJECT_TYPE_NAME (ref), ref);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = g_list_prepend (value, ref);
|
||||||
|
|
||||||
|
ref = va_arg (*args, gpointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
res = gtk_undefined_accessible_value_new ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = (* ctor) (value);
|
value = g_list_reverse (value);
|
||||||
|
|
||||||
|
if (ctor == NULL)
|
||||||
|
res = gtk_reference_list_accessible_value_new (value);
|
||||||
|
else
|
||||||
|
res = (* ctor) (value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -939,8 +939,7 @@ gtk_button_set_icon_name (GtkButton *button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY,
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, priv->child, NULL,
|
||||||
g_list_append (NULL, priv->child),
|
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
gtk_button_set_child_type (button, ICON_CHILD);
|
gtk_button_set_child_type (button, ICON_CHILD);
|
||||||
|
@ -1177,8 +1177,6 @@ void
|
|||||||
gtk_expander_set_child (GtkExpander *expander,
|
gtk_expander_set_child (GtkExpander *expander,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
GList *list = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
||||||
|
|
||||||
@ -1201,14 +1199,16 @@ gtk_expander_set_child (GtkExpander *expander,
|
|||||||
g_object_ref_sink (expander->child);
|
g_object_ref_sink (expander->child);
|
||||||
g_object_ref (expander->child);
|
g_object_ref (expander->child);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (expander->child)
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (expander),
|
||||||
list = g_list_append (list, expander->child);
|
GTK_ACCESSIBLE_RELATION_CONTROLS, expander->child, NULL,
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (expander),
|
-1);
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, list,
|
}
|
||||||
-1);
|
else
|
||||||
g_list_free (list);
|
{
|
||||||
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (expander),
|
||||||
|
GTK_ACCESSIBLE_RELATION_CONTROLS);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (expander), "child");
|
g_object_notify (G_OBJECT (expander), "child");
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ update_accessible_relation (GtkFrame *frame)
|
|||||||
|
|
||||||
if (priv->label_widget)
|
if (priv->label_widget)
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->child),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->child),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, priv->label_widget),
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, priv->label_widget, NULL,
|
||||||
-1);
|
-1);
|
||||||
else
|
else
|
||||||
gtk_accessible_reset_relation (GTK_ACCESSIBLE (priv->child),
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (priv->child),
|
||||||
|
@ -1696,7 +1696,7 @@ gtk_label_set_text_internal (GtkLabel *self,
|
|||||||
self->text = str;
|
self->text = str;
|
||||||
|
|
||||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||||
GTK_ACCESSIBLE_PROPERTY_LABEL, str,
|
GTK_ACCESSIBLE_PROPERTY_LABEL, self->text,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
gtk_label_select_region_index (self, 0, 0);
|
gtk_label_select_region_index (self, 0, 0);
|
||||||
|
@ -520,8 +520,7 @@ update_sensitivity (GtkMenuButton *self)
|
|||||||
-1);
|
-1);
|
||||||
if (self->popover != NULL)
|
if (self->popover != NULL)
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS,
|
GTK_ACCESSIBLE_RELATION_CONTROLS, self->popover, NULL,
|
||||||
g_list_append (NULL, self->popover),
|
|
||||||
-1);
|
-1);
|
||||||
else
|
else
|
||||||
gtk_accessible_reset_relation (GTK_ACCESSIBLE (self),
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (self),
|
||||||
|
@ -582,7 +582,7 @@ update_accessible_properties (GtkModelButton *button)
|
|||||||
|
|
||||||
if (button->popover)
|
if (button->popover)
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, g_list_append (NULL, button->popover),
|
GTK_ACCESSIBLE_RELATION_CONTROLS, button->popover, NULL,
|
||||||
-1);
|
-1);
|
||||||
else
|
else
|
||||||
gtk_accessible_reset_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (button),
|
||||||
@ -683,7 +683,7 @@ gtk_model_button_set_text (GtkModelButton *button,
|
|||||||
update_visibility (button);
|
update_visibility (button);
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, button->label),
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
||||||
|
@ -3968,7 +3968,7 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
|
|||||||
|
|
||||||
stack_page = gtk_stack_get_page (GTK_STACK (notebook->stack_widget), page->child);
|
stack_page = gtk_stack_get_page (GTK_STACK (notebook->stack_widget), page->child);
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (page->tab_widget),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (page->tab_widget),
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, g_list_append (NULL, stack_page),
|
GTK_ACCESSIBLE_RELATION_CONTROLS, stack_page, NULL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
gtk_accessible_update_state (GTK_ACCESSIBLE (page->tab_widget),
|
gtk_accessible_update_state (GTK_ACCESSIBLE (page->tab_widget),
|
||||||
|
@ -341,8 +341,8 @@ gtk_popover_menu_bar_item_root (GtkWidget *widget)
|
|||||||
GTK_WIDGET_CLASS (gtk_popover_menu_bar_item_parent_class)->root (widget);
|
GTK_WIDGET_CLASS (gtk_popover_menu_bar_item_parent_class)->root (widget);
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (widget),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (widget),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, item->label),
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, item->label, NULL,
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, g_list_append (NULL, item->popover),
|
GTK_ACCESSIBLE_RELATION_CONTROLS, item->popover, NULL,
|
||||||
-1);
|
-1);
|
||||||
gtk_accessible_update_property (GTK_ACCESSIBLE (widget),
|
gtk_accessible_update_property (GTK_ACCESSIBLE (widget),
|
||||||
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
|
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
|
||||||
|
@ -4106,7 +4106,6 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
|
|||||||
{
|
{
|
||||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||||
GtkWidget *scrollable_child;
|
GtkWidget *scrollable_child;
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||||
|
|
||||||
@ -4163,16 +4162,21 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (priv->child)
|
if (priv->child)
|
||||||
list = g_list_append (NULL, priv->child);
|
{
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->hscrollbar),
|
||||||
|
GTK_ACCESSIBLE_RELATION_CONTROLS, priv->child, NULL,
|
||||||
|
-1);
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->vscrollbar),
|
||||||
|
GTK_ACCESSIBLE_RELATION_CONTROLS, priv->child, NULL,
|
||||||
|
-1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
list = NULL;
|
{
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->hscrollbar),
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (priv->hscrollbar),
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, list,
|
GTK_ACCESSIBLE_RELATION_CONTROLS);
|
||||||
-1);
|
gtk_accessible_reset_relation (GTK_ACCESSIBLE (priv->vscrollbar),
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (priv->vscrollbar),
|
GTK_ACCESSIBLE_RELATION_CONTROLS);
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, list,
|
}
|
||||||
-1);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_CHILD]);
|
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_CHILD]);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ add_child (guint position,
|
|||||||
-1);
|
-1);
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_CONTROLS, g_list_append (NULL, page),
|
GTK_ACCESSIBLE_RELATION_CONTROLS, page, NULL,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
g_signal_connect (button, "notify::active", G_CALLBACK (on_button_toggled), self);
|
g_signal_connect (button, "notify::active", G_CALLBACK (on_button_toggled), self);
|
||||||
|
@ -171,7 +171,12 @@ gtk_test_accessible_check_property (GtkAccessible *accessible,
|
|||||||
|
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_assert_no_error (error);
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
res = g_strdup (error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (check_value == NULL)
|
if (check_value == NULL)
|
||||||
check_value = gtk_accessible_value_get_default_for_property (property);
|
check_value = gtk_accessible_value_get_default_for_property (property);
|
||||||
@ -233,7 +238,12 @@ gtk_test_accessible_check_state (GtkAccessible *accessible,
|
|||||||
|
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_assert_no_error (error);
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
res = g_strdup (error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (check_value == NULL)
|
if (check_value == NULL)
|
||||||
check_value = gtk_accessible_value_get_default_for_state (state);
|
check_value = gtk_accessible_value_get_default_for_state (state);
|
||||||
@ -295,7 +305,12 @@ gtk_test_accessible_check_relation (GtkAccessible *accessible,
|
|||||||
|
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_assert_no_error (error);
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
res = g_strdup (error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (check_value == NULL)
|
if (check_value == NULL)
|
||||||
check_value = gtk_accessible_value_get_default_for_relation (relation);
|
check_value = gtk_accessible_value_get_default_for_relation (relation);
|
||||||
|
@ -52,19 +52,19 @@ G_STMT_START { \
|
|||||||
* gtk_test_accessible_assert_property:
|
* gtk_test_accessible_assert_property:
|
||||||
* @accessible: a #GtkAccessible
|
* @accessible: a #GtkAccessible
|
||||||
* @property: a #GtkAccessibleProperty
|
* @property: a #GtkAccessibleProperty
|
||||||
* @value: the value of @property
|
* @...: the value of @property
|
||||||
*
|
*
|
||||||
* Checks whether a #GtkAccessible implementation has its accessible
|
* Checks whether a #GtkAccessible implementation has its accessible
|
||||||
* property set to the expected @value, and raises an assertion if the
|
* property set to the expected value, and raises an assertion if the
|
||||||
* condition is not satisfied.
|
* condition is not satisfied.
|
||||||
*/
|
*/
|
||||||
#define gtk_test_accessible_assert_property(accessible,property,value) \
|
#define gtk_test_accessible_assert_property(accessible,property,...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||||
GtkAccessibleProperty __p = (property); \
|
GtkAccessibleProperty __p = (property); \
|
||||||
char *__value = gtk_test_accessible_check_property (__a, __p, (value)); \
|
char *__value = gtk_test_accessible_check_property (__a, __p, __VA_ARGS__); \
|
||||||
if (__value == NULL) ; else { \
|
if (__value == NULL) ; else { \
|
||||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-property(" #property ") == " #value "): value = '%s'", __value); \
|
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-property(" #property ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||||
g_free (__msg); \
|
g_free (__msg); \
|
||||||
} \
|
} \
|
||||||
@ -74,19 +74,19 @@ G_STMT_START { \
|
|||||||
* gtk_test_accessible_assert_relation:
|
* gtk_test_accessible_assert_relation:
|
||||||
* @accessible: a #GtkAccessible
|
* @accessible: a #GtkAccessible
|
||||||
* @relation: a #GtkAccessibleRelation
|
* @relation: a #GtkAccessibleRelation
|
||||||
* @value: the expected value of @relation
|
* @...: the expected value of @relation
|
||||||
*
|
*
|
||||||
* Checks whether a #GtkAccessible implementation has its accessible
|
* Checks whether a #GtkAccessible implementation has its accessible
|
||||||
* relation set to the expected @value, and raises an assertion if the
|
* relation set to the expected value, and raises an assertion if the
|
||||||
* condition is not satisfied.
|
* condition is not satisfied.
|
||||||
*/
|
*/
|
||||||
#define gtk_test_accessible_assert_relation(accessible,relation,value) \
|
#define gtk_test_accessible_assert_relation(accessible,relation,...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||||
GtkAccessibleRelation __r = (relation); \
|
GtkAccessibleRelation __r = (relation); \
|
||||||
char *__value = gtk_test_accessible_check_relation (__a, __r, (value)); \
|
char *__value = gtk_test_accessible_check_relation (__a, __r, __VA_ARGS__); \
|
||||||
if (__value == NULL); else { \
|
if (__value == NULL); else { \
|
||||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-relation(" #relation ") == " #value "): value = '%s'", __value); \
|
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-relation(" #relation ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||||
g_free (__msg); \
|
g_free (__msg); \
|
||||||
} \
|
} \
|
||||||
@ -96,19 +96,19 @@ G_STMT_START { \
|
|||||||
* gtk_test_accessible_assert_state:
|
* gtk_test_accessible_assert_state:
|
||||||
* @accessible: a #GtkAccessible
|
* @accessible: a #GtkAccessible
|
||||||
* @state: a #GtkAccessibleRelation
|
* @state: a #GtkAccessibleRelation
|
||||||
* @value: the expected value of @state
|
* @...: the expected value of @state
|
||||||
*
|
*
|
||||||
* Checks whether a #GtkAccessible implementation has its accessible
|
* Checks whether a #GtkAccessible implementation has its accessible
|
||||||
* state set to the expected @value, and raises an assertion if the
|
* state set to the expected value, and raises an assertion if the
|
||||||
* condition is not satisfied.
|
* condition is not satisfied.
|
||||||
*/
|
*/
|
||||||
#define gtk_test_accessible_assert_state(accessible,state,value) \
|
#define gtk_test_accessible_assert_state(accessible,state,...) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||||
GtkAccessibleState __s = (state); \
|
GtkAccessibleState __s = (state); \
|
||||||
char *__value = gtk_test_accessible_check_state (__a, __s, (value)); \
|
char *__value = gtk_test_accessible_check_state (__a, __s, __VA_ARGS__); \
|
||||||
if (__value == NULL); else { \
|
if (__value == NULL); else { \
|
||||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-state(" #state ") == " #value "): value = '%s'", __value); \
|
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-state(" #state ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||||
g_free (__msg); \
|
g_free (__msg); \
|
||||||
} \
|
} \
|
||||||
|
@ -9329,7 +9329,8 @@ gtk_widget_add_mnemonic_label (GtkWidget *widget,
|
|||||||
GtkWidget *label)
|
GtkWidget *label)
|
||||||
{
|
{
|
||||||
GSList *old_list, *new_list;
|
GSList *old_list, *new_list;
|
||||||
GList *list;
|
GtkAccessibleRelation relation = GTK_ACCESSIBLE_RELATION_LABELLED_BY;
|
||||||
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (GTK_IS_WIDGET (label));
|
g_return_if_fail (GTK_IS_WIDGET (label));
|
||||||
@ -9340,10 +9341,13 @@ gtk_widget_add_mnemonic_label (GtkWidget *widget,
|
|||||||
g_object_set_qdata_full (G_OBJECT (widget), quark_mnemonic_labels,
|
g_object_set_qdata_full (G_OBJECT (widget), quark_mnemonic_labels,
|
||||||
new_list, (GDestroyNotify) g_slist_free);
|
new_list, (GDestroyNotify) g_slist_free);
|
||||||
|
|
||||||
list = gtk_widget_list_mnemonic_labels (widget);
|
/* The ATContext takes ownership of the GList returned by list_mnemonic_labels(),
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (widget),
|
* so we don't need to free it
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, list,
|
*/
|
||||||
-1);
|
gtk_accessible_relation_init_value (relation, &value);
|
||||||
|
g_value_set_pointer (&value, gtk_widget_list_mnemonic_labels (widget));
|
||||||
|
gtk_accessible_update_relation_value (GTK_ACCESSIBLE (widget), 1, &relation, &value);
|
||||||
|
g_value_unset (&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +590,6 @@ test_reflist_relation (gconstpointer data)
|
|||||||
TestObject *object;
|
TestObject *object;
|
||||||
TestObject *other;
|
TestObject *other;
|
||||||
TestObject *third;
|
TestObject *third;
|
||||||
GList *refs;
|
|
||||||
|
|
||||||
object = test_object_new (GTK_ACCESSIBLE_ROLE_CHECKBOX);
|
object = test_object_new (GTK_ACCESSIBLE_ROLE_CHECKBOX);
|
||||||
other = test_object_new (GTK_ACCESSIBLE_ROLE_CHECKBOX);
|
other = test_object_new (GTK_ACCESSIBLE_ROLE_CHECKBOX);
|
||||||
@ -600,21 +599,15 @@ test_reflist_relation (gconstpointer data)
|
|||||||
|
|
||||||
gtk_test_accessible_assert_relation (object, relation, NULL);
|
gtk_test_accessible_assert_relation (object, relation, NULL);
|
||||||
|
|
||||||
refs = g_list_append (NULL, other);
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (object),
|
||||||
|
relation, other, NULL,
|
||||||
|
-1);
|
||||||
|
gtk_test_accessible_assert_relation (object, relation, other, NULL);
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (object),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (object),
|
||||||
relation, refs,
|
relation, other, third, NULL,
|
||||||
-1);
|
-1);
|
||||||
gtk_test_accessible_assert_relation (object, relation, refs);
|
gtk_test_accessible_assert_relation (object, relation, other, third, NULL);
|
||||||
|
|
||||||
refs = g_list_append (refs, third);
|
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (object),
|
|
||||||
relation, refs,
|
|
||||||
-1);
|
|
||||||
gtk_test_accessible_assert_relation (object, relation, refs);
|
|
||||||
|
|
||||||
g_list_free (refs);
|
|
||||||
|
|
||||||
g_object_unref (object);
|
g_object_unref (object);
|
||||||
g_object_unref (other);
|
g_object_unref (other);
|
||||||
|
@ -32,13 +32,11 @@ static void
|
|||||||
button_relation (void)
|
button_relation (void)
|
||||||
{
|
{
|
||||||
GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
|
GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_object_ref_sink (button);
|
g_object_ref_sink (button);
|
||||||
|
|
||||||
list = g_list_append (NULL, gtk_widget_get_first_child (button));
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button),
|
||||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, gtk_widget_get_first_child (button), NULL);
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (button);
|
g_object_unref (button);
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,12 @@ expander_relations (void)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget = gtk_expander_new ("Hello");
|
GtkWidget *widget = gtk_expander_new ("Hello");
|
||||||
GtkWidget *child = gtk_label_new ("Child");
|
GtkWidget *child = gtk_label_new ("Child");
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_object_ref_sink (widget);
|
g_object_ref_sink (widget);
|
||||||
|
|
||||||
gtk_expander_set_child (GTK_EXPANDER (widget), child);
|
gtk_expander_set_child (GTK_EXPANDER (widget), child);
|
||||||
|
|
||||||
list = g_list_append (NULL, child);
|
gtk_test_accessible_assert_relation (widget, GTK_ACCESSIBLE_RELATION_CONTROLS, child, NULL);
|
||||||
gtk_test_accessible_assert_relation (widget, GTK_ACCESSIBLE_RELATION_CONTROLS, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (widget);
|
g_object_unref (widget);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,6 @@ test_labelled_by (void)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GList *list;
|
|
||||||
|
|
||||||
widget = gtk_switch_new ();
|
widget = gtk_switch_new ();
|
||||||
g_object_ref_sink (widget);
|
g_object_ref_sink (widget);
|
||||||
@ -72,9 +71,7 @@ test_labelled_by (void)
|
|||||||
g_object_ref_sink (label);
|
g_object_ref_sink (label);
|
||||||
gtk_widget_add_mnemonic_label (widget, label);
|
gtk_widget_add_mnemonic_label (widget, label);
|
||||||
|
|
||||||
list = g_list_append (NULL, label);
|
gtk_test_accessible_assert_relation (widget, GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL);
|
||||||
gtk_test_accessible_assert_relation (widget, GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (widget);
|
g_object_unref (widget);
|
||||||
g_object_unref (label);
|
g_object_unref (label);
|
||||||
|
@ -18,7 +18,6 @@ label_relations (void)
|
|||||||
GtkWidget *label = gtk_label_new ("a");
|
GtkWidget *label = gtk_label_new ("a");
|
||||||
GtkWidget *label2 = gtk_label_new ("b");
|
GtkWidget *label2 = gtk_label_new ("b");
|
||||||
GtkWidget *entry = gtk_entry_new ();
|
GtkWidget *entry = gtk_entry_new ();
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_object_ref_sink (label);
|
g_object_ref_sink (label);
|
||||||
g_object_ref_sink (label2);
|
g_object_ref_sink (label2);
|
||||||
@ -28,16 +27,11 @@ label_relations (void)
|
|||||||
|
|
||||||
gtk_widget_add_mnemonic_label (entry, label);
|
gtk_widget_add_mnemonic_label (entry, label);
|
||||||
|
|
||||||
list = g_list_append (NULL, label);
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL);
|
||||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
gtk_widget_add_mnemonic_label (entry, label2);
|
gtk_widget_add_mnemonic_label (entry, label2);
|
||||||
|
|
||||||
list = g_list_append (NULL, label);
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, label2, NULL);
|
||||||
list = g_list_append (list, label2);
|
|
||||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_RELATION_LABELLED_BY, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (entry);
|
g_object_unref (entry);
|
||||||
g_object_unref (label);
|
g_object_unref (label);
|
||||||
|
@ -57,7 +57,6 @@ scrollbar_relations (void)
|
|||||||
GtkWidget *hscrollbar;
|
GtkWidget *hscrollbar;
|
||||||
GtkWidget *vscrollbar;
|
GtkWidget *vscrollbar;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_object_ref_sink (sw);
|
g_object_ref_sink (sw);
|
||||||
|
|
||||||
@ -70,10 +69,8 @@ scrollbar_relations (void)
|
|||||||
child = gtk_text_view_new ();
|
child = gtk_text_view_new ();
|
||||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
|
||||||
|
|
||||||
list = g_list_append (NULL, child);
|
gtk_test_accessible_assert_relation (hscrollbar, GTK_ACCESSIBLE_RELATION_CONTROLS, child, NULL);
|
||||||
gtk_test_accessible_assert_relation (hscrollbar, GTK_ACCESSIBLE_RELATION_CONTROLS, list);
|
gtk_test_accessible_assert_relation (vscrollbar, GTK_ACCESSIBLE_RELATION_CONTROLS, child, NULL);
|
||||||
gtk_test_accessible_assert_relation (vscrollbar, GTK_ACCESSIBLE_RELATION_CONTROLS, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (sw);
|
g_object_unref (sw);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ stack_relations (void)
|
|||||||
GtkWidget *switcher = gtk_stack_switcher_new ();
|
GtkWidget *switcher = gtk_stack_switcher_new ();
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkStackPage *page;
|
GtkStackPage *page;
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_object_ref_sink (stack);
|
g_object_ref_sink (stack);
|
||||||
g_object_ref_sink (switcher);
|
g_object_ref_sink (switcher);
|
||||||
@ -83,15 +82,11 @@ stack_relations (void)
|
|||||||
|
|
||||||
child = gtk_widget_get_first_child (switcher);
|
child = gtk_widget_get_first_child (switcher);
|
||||||
page = gtk_stack_get_page (GTK_STACK (stack), child1);
|
page = gtk_stack_get_page (GTK_STACK (stack), child1);
|
||||||
list = g_list_append (NULL, page);
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (child), GTK_ACCESSIBLE_RELATION_CONTROLS, page, NULL);
|
||||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (child), GTK_ACCESSIBLE_RELATION_CONTROLS, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
child = gtk_widget_get_last_child (switcher);
|
child = gtk_widget_get_last_child (switcher);
|
||||||
page = gtk_stack_get_page (GTK_STACK (stack), child2);
|
page = gtk_stack_get_page (GTK_STACK (stack), child2);
|
||||||
list = g_list_append (NULL, page);
|
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (child), GTK_ACCESSIBLE_RELATION_CONTROLS, page, NULL);
|
||||||
gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (child), GTK_ACCESSIBLE_RELATION_CONTROLS, list);
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
g_object_unref (stack);
|
g_object_unref (stack);
|
||||||
g_object_unref (switcher);
|
g_object_unref (switcher);
|
||||||
|
Loading…
Reference in New Issue
Block a user