* This will also clear any previously set labels.
*/
void
-gtk_button_set_label (GtkButton *button,
+gtk_button_set_label (GtkButton *button,
const char *label)
{
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
if (priv->child_type != LABEL_CHILD || priv->child == NULL)
{
child = gtk_label_new (NULL);
+ gtk_button_set_child (button, child);
if (priv->use_underline)
{
gtk_label_set_use_underline (GTK_LABEL (child), priv->use_underline);
gtk_label_set_mnemonic_widget (GTK_LABEL (child), GTK_WIDGET (button));
}
-
- gtk_button_set_child (button, child);
+ else
+ {
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, child, NULL,
+ -1);
+ }
}
gtk_label_set_label (GTK_LABEL (priv->child), label);
gtk_button_set_child_type (button, LABEL_CHILD);
- gtk_accessible_update_property (GTK_ACCESSIBLE (button),
- GTK_ACCESSIBLE_PROPERTY_LABEL, label,
- -1);
-
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_LABEL]);
}
#include "gtkheaderbar.h"
#include "gtkactionable.h"
#include "gtkeventcontrollerkey.h"
+#include "gtkaccessible.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_button_set_icon_name (GTK_BUTTON (button), "emblem-system-symbolic");
gtk_widget_set_tooltip_text (button, _("Change Font Features"));
+ gtk_accessible_update_property (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_PROPERTY_LABEL,
+ _("Change Font Features"),
+ -1);
header = gtk_dialog_get_header_bar (GTK_DIALOG (dialog));
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
<property name="activates-default">1</property>
<property name="placeholder-text" translatable="yes">Search font name</property>
<signal name="stop-search" handler="stop_search_cb" swapped="no"/>
+ <accessibility>
+ <property name="label" translatable="1">Search font name</property>
+ </accessibility>
</object>
</child>
<child>
<object class="GtkMenuButton">
+ <accessibility>
+ <property name="label" translatable="1">Filters</property>
+ </accessibility>
<property name="icon-name">pan-down-symbolic</property>
+ <property name="tooltip-text" translatable="yes">Filters</property>
<property name="popover">
<object class="GtkPopover">
<child>
<object class="GtkBox">
<property name="orientation">1</property>
<property name="spacing">6</property>
+ <accessibility>
+ <relation name="labelled-by">filter_by_label</relation>
+ </accessibility>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id="filter_by_label">
<property name="label" translatable="yes">Filter by</property>
<property name="width-chars">20</property>
<property name="margin-bottom">10</property>
GtkWidget *button = gtk_button_new_with_label ("Hello");
g_object_ref_sink (button);
- gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello");
+ gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, gtk_widget_get_first_child (button), NULL);
g_object_unref (button);
}
GtkWidget *button = gtk_link_button_new ("Hello");
g_object_ref_sink (button);
- gtk_test_accessible_assert_property (button, GTK_ACCESSIBLE_PROPERTY_LABEL, "Hello");
+ gtk_test_accessible_assert_relation (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, gtk_widget_get_first_child (button), NULL);
g_object_unref (button);
}