Add some labels in the pickers demo.
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
+ gtk_accessible_update_property (GTK_ACCESSIBLE (progress_bar),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, "Applying changes",
+ -1);
+
/* This prevents the assistant window from being
* closed while we're "busy" applying changes.
*/
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">switch</property>
</object>
</child>
<child>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">check</property>
</object>
</child>
<child>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
+ <property name="accessible-role">status</property>
</object>
</child>
</object>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">scale</property>
</object>
</child>
<child>
- <object class="GtkScale">
+ <object class="GtkScale" id="scale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">spin</property>
</object>
</child>
<child>
- <object class="GtkSpinButton">
+ <object class="GtkSpinButton" id="spin">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">dropdown</property>
</object>
</child>
<child>
- <object class="GtkDropDown">
+ <object class="GtkDropDown" id="dropdown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
+ <property name="mnemonic-widget">entry</property>
</object>
</child>
<child>
- <object class="GtkEntry">
+ <object class="GtkEntry" id="entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type hereā¦</property>
#include <string.h>
#include "config.h"
-
#include <gtk/gtk.h>
#include <glib/gstdio.h>
}
static GtkWidget *
-display_image (const char *format,
- const char *resource,
- char **label)
+display_image (const char *format,
+ const char *resource,
+ GtkWidget *label)
{
GtkWidget *sw, *image;
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
+ -1);
+
return sw;
}
static GtkWidget *
-display_images (const char *format,
- const char *resource_dir,
- char **label)
+display_images (const char *format,
+ const char *resource_dir,
+ GtkWidget *label)
{
char **resources;
GtkWidget *grid;
g_strfreev (resources);
- *label = g_strdup ("Images");
+ gtk_label_set_label (GTK_LABEL (label), "Images");
+
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (grid),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
+ -1);
return sw;
}
static GtkWidget *
-display_text (const char *format,
- const char *resource,
- char **label)
+display_text (const char *format,
+ const char *resource,
+ GtkWidget *label)
{
GtkTextBuffer *buffer;
GtkWidget *textview, *sw;
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (textview),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
+ -1);
+
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
}
static GtkWidget *
-display_video (const char *format,
- const char *resource,
- char **label)
+display_video (const char *format,
+ const char *resource,
+ GtkWidget *label)
{
GtkWidget *video;
video = gtk_video_new_for_resource (resource);
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (video),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
+ -1);
+
return video;
}
static struct {
const char *extension;
const char *format;
- GtkWidget * (* display_func) (const char *format,
- const char *resource,
- char **label);
+ GtkWidget * (* display_func) (const char *format,
+ const char *resource,
+ GtkWidget *label);
} display_funcs[] = {
{ ".gif", NULL, display_image },
{ ".jpg", NULL, display_image },
char **resources;
GtkWidget *widget, *label;
guint i, j;
- char *label_string;
resource_dir = g_strconcat ("/", demoname, NULL);
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
break;
}
- label_string = NULL;
+ label = gtk_label_new (resources[i]);
if (j < G_N_ELEMENTS (display_funcs))
widget = display_funcs[j].display_func (display_funcs[j].format,
resource_name,
- &label_string);
+ label);
else
widget = display_nothing (resource_name);
- label = gtk_label_new (label_string ? label_string : resources[i]);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,
NULL);
g_free (resource_name);
- g_free (label_string);
}
g_strfreev (resources);
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
+ <accessibility>
+ <relation name="labelled-by">search-entry</relation>
+ </accessibility>
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
+ <property name="label" translatable="yes">Search</property>
<relation name="controls">listview</relation>
</accessibility>
</object>
"placeholder-text", "Password",
"activates-default", TRUE,
NULL);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, "Password",
+ -1);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry);
"placeholder-text", "Confirm",
"activates-default", TRUE,
NULL);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (entry2),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, "Confirm",
+ -1);
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry2);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
label = gtk_label_new ("Font:");
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
label = gtk_label_new ("File:");
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
+ gtk_accessible_update_property (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, "Select File",
+ -1);
label = gtk_label_new ("None");
gtk_box_append (GTK_BOX (picker), button);
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (app_picker),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, "Open File",
+ -1);
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_box_append (GTK_BOX (picker), app_picker);