mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Merge branch 'inspector_a11y' into 'main'
GtkInspector: make the inspector at least a little bit more accessible See merge request GNOME/gtk!5109
This commit is contained in:
commit
11ee930b9d
@ -12,7 +12,7 @@
|
|||||||
<property name="margin-bottom">10</property>
|
<property name="margin-bottom">10</property>
|
||||||
<property name="spacing">40</property>
|
<property name="spacing">40</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="role_label">
|
||||||
<property name="label" translatable="yes">Role</property>
|
<property name="label" translatable="yes">Role</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@ -24,6 +24,9 @@
|
|||||||
<property name="selectable">1</property>
|
<property name="selectable">1</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">role_label</relation>
|
||||||
|
</accessibility>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@ -36,7 +39,7 @@
|
|||||||
<property name="margin-bottom">10</property>
|
<property name="margin-bottom">10</property>
|
||||||
<property name="spacing">40</property>
|
<property name="spacing">40</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="path_label">
|
||||||
<property name="label" translatable="yes">Object path</property>
|
<property name="label" translatable="yes">Object path</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
@ -48,6 +51,9 @@
|
|||||||
<property name="selectable">1</property>
|
<property name="selectable">1</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">baseline</property>
|
<property name="valign">baseline</property>
|
||||||
|
<accessibility>
|
||||||
|
<relation name="labelled-by">path_label</relation>
|
||||||
|
</accessibility>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1249,6 +1249,23 @@ property_editor (GObject *object,
|
|||||||
|
|
||||||
notify_property (object, spec);
|
notify_property (object, spec);
|
||||||
|
|
||||||
|
if (GTK_IS_LABEL (prop_edit))
|
||||||
|
{
|
||||||
|
gtk_widget_set_can_focus (prop_edit, TRUE);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (prop_edit),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL,
|
||||||
|
g_strdup_printf ("%s: %s",
|
||||||
|
self->name,
|
||||||
|
gtk_label_get_text (GTK_LABEL (prop_edit))),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (prop_edit),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, self->name,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return prop_edit;
|
return prop_edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
#include "strv-editor.h"
|
#include "strv-editor.h"
|
||||||
|
#include "gtkaccessible.h"
|
||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
@ -69,6 +70,9 @@ add_string (GtkInspectorStrvEditor *editor,
|
|||||||
|
|
||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Value"),
|
||||||
|
NULL);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
gtk_box_append (GTK_BOX (box), entry);
|
gtk_box_append (GTK_BOX (box), entry);
|
||||||
g_object_set_data (G_OBJECT (box), "entry", entry);
|
g_object_set_data (G_OBJECT (box), "entry", entry);
|
||||||
@ -76,6 +80,10 @@ add_string (GtkInspectorStrvEditor *editor,
|
|||||||
|
|
||||||
button = gtk_button_new_from_icon_name ("user-trash-symbolic");
|
button = gtk_button_new_from_icon_name ("user-trash-symbolic");
|
||||||
gtk_widget_add_css_class (button, "image-button");
|
gtk_widget_add_css_class (button, "image-button");
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL,
|
||||||
|
g_strdup_printf (_("Remove %s"), str),
|
||||||
|
NULL);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_append (GTK_BOX (box), button);
|
gtk_box_append (GTK_BOX (box), button);
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor);
|
g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor);
|
||||||
@ -106,6 +114,9 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
|
|||||||
gtk_widget_add_css_class (editor->button, "image-button");
|
gtk_widget_add_css_class (editor->button, "image-button");
|
||||||
gtk_widget_set_focus_on_click (editor->button, FALSE);
|
gtk_widget_set_focus_on_click (editor->button, FALSE);
|
||||||
gtk_widget_set_halign (editor->button, GTK_ALIGN_END);
|
gtk_widget_set_halign (editor->button, GTK_ALIGN_END);
|
||||||
|
gtk_accessible_update_property (GTK_ACCESSIBLE (editor->button),
|
||||||
|
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Add"),
|
||||||
|
NULL);
|
||||||
gtk_widget_show (editor->button);
|
gtk_widget_show (editor->button);
|
||||||
g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor);
|
g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user