[network-manager-applet] applet: Improve accessibility of info dialog by adding atk label relationships
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: Improve accessibility of info dialog by adding atk label relationships
- Date: Sat, 7 Feb 2015 17:02:54 +0000 (UTC)
commit e4589f9c760a4bea69776ca8556757245be25a13
Author: Luke Yelavich <themuso ubuntu com>
Date: Mon Mar 10 19:14:37 2014 +1100
applet: Improve accessibility of info dialog by adding atk label relationships
https://bugzilla.gnome.org/show_bug.cgi?id=726018
src/applet-dialogs.c | 170 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 135 insertions(+), 35 deletions(-)
---
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index e671a0f..22d9bb9 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -377,14 +377,22 @@ wimax_bsid_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
static void
display_ip4_info (NMIP4Address *def_addr, GtkGrid *grid, int *row)
{
+ GtkWidget *desc_widget, *data_widget = NULL;
+ AtkObject *desc_object, *data_object = NULL;
guint32 hostmask, network, bcast, netmask;
char *str;
/* Address */
- gtk_grid_attach (grid, create_info_label (_("IP Address:"), FALSE),
- 0, *row, 1, 1);
str = def_addr ? ip4_address_as_string (nm_ip4_address_get_address (def_addr)) : g_strdup
(C_("Address", "Unknown"));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("IP Address:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
@@ -397,29 +405,47 @@ display_ip4_info (NMIP4Address *def_addr, GtkGrid *grid, int *row)
bcast = htonl (network | hostmask);
}
- gtk_grid_attach (grid, create_info_label (_("Broadcast Address:"), FALSE),
- 0, *row, 1, 1);
str = def_addr ? ip4_address_as_string (bcast) : g_strdup (C_("Address", "Unknown"));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("Broadcast Address:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
/* Prefix */
- gtk_grid_attach (grid, create_info_label (_("Subnet Mask:"), FALSE),
- 0, *row, 1, 1);
str = def_addr ? ip4_address_as_string (netmask) : g_strdup (C_("Subnet Mask", "Unknown"));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("Subnet Mask:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
/* Gateway */
if (def_addr && nm_ip4_address_get_gateway (def_addr)) {
- gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
- 0, *row, 1, 1);
str = ip4_address_as_string (nm_ip4_address_get_gateway (def_addr));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("Default Route:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
@@ -429,6 +455,8 @@ display_ip4_info (NMIP4Address *def_addr, GtkGrid *grid, int *row)
static void
display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, int *row)
{
+ GtkWidget *desc_widget, *data_widget = NULL;
+ AtkObject *desc_object, *data_object = NULL;
char *tmp_addr;
guint32 prefix;
char *str;
@@ -437,24 +465,36 @@ display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, in
return;
/* Address */
- gtk_grid_attach (grid, create_info_label (_("IP Address:"), FALSE),
- 0, *row, 1, 1);
tmp_addr = ip6_address_as_string (nm_ip6_address_get_address (def6_addr));
prefix = nm_ip6_address_get_prefix (def6_addr);
str = g_strdup_printf ("%s/%d", tmp_addr, prefix);
g_free (tmp_addr);
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("IP Address:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
/* Gateway */
if (nm_ip6_address_get_gateway (def6_addr)) {
- gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
- 0, *row, 1, 1);
str = ip6_address_as_string (nm_ip6_address_get_gateway (def6_addr));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_("Default Route:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
@@ -464,15 +504,23 @@ display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, in
static void
display_dns4_info (const GArray *dns, GtkGrid *grid, int *row)
{
+ GtkWidget *desc_widget, *data_widget = NULL;
+ AtkObject *desc_object, *data_object = NULL;
char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" };
char *str;
int i;
for (i = 0; dns && i < dns->len && i < 3; i++) {
- gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE),
- 0, *row, 1, 1);
str = ip4_address_as_string (g_array_index (dns, guint32, i));
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_(label[i]), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
@@ -482,15 +530,23 @@ display_dns4_info (const GArray *dns, GtkGrid *grid, int *row)
static void
display_dns6_info (const GSList *dns6, GtkGrid *grid, int *row)
{
+ GtkWidget *desc_widget, *data_widget = NULL;
+ AtkObject *desc_object, *data_object = NULL;
char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" };
char *str;
int i;
for (i = 0; dns6 && i < 3 ; dns6 = g_slist_next (dns6), i++) {
- gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE),
- 0, *row, 1, 1);
str = ip6_address_as_string (dns6->data);
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ desc_widget = create_info_label (_(label[i]), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
+ 0, *row, 1, 1);
+ gtk_grid_attach (grid, data_widget,
1, *row, 1, 1);
g_free (str);
(*row)++;
@@ -515,9 +571,10 @@ info_dialog_add_page (GtkNotebook *notebook,
NMIP6Address *def6_addr = NULL;
NMSettingIP6Config *s_ip6;
int row = 0;
- GtkWidget* speed_label, *sec_label = NULL;
+ GtkWidget* speed_label, *sec_label, *desc_widget, *data_widget = NULL;
const GSList *addresses;
gboolean show_security = FALSE;
+ AtkObject *desc_object, *data_object = NULL;
grid = GTK_GRID (gtk_grid_new ());
gtk_grid_set_column_spacing (grid, 12);
@@ -553,9 +610,15 @@ info_dialog_add_page (GtkNotebook *notebook,
0, row, 1, 1);
row++;
- gtk_grid_attach (grid, create_info_label (_("Interface:"), FALSE),
+ desc_widget = create_info_label (_("Interface:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ gtk_grid_attach (grid, data_widget,
1, row, 1, 1);
g_free (str);
row++;
@@ -569,17 +632,29 @@ info_dialog_add_page (GtkNotebook *notebook,
else if (NM_IS_DEVICE_WIMAX (device))
str = g_strdup (nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device)));
- gtk_grid_attach (grid, create_info_label (_("Hardware Address:"), FALSE),
+ desc_widget = create_info_label (_("Hardware Address:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (str, TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
- gtk_grid_attach (grid, create_info_label (str, TRUE),
+ gtk_grid_attach (grid, data_widget,
1, row, 1, 1);
g_free (str);
row++;
/* Driver */
- gtk_grid_attach (grid, create_info_label (_("Driver:"), FALSE),
+ desc_widget = create_info_label (_("Driver:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_widget = create_info_label (nm_device_get_driver (device), TRUE);
+ data_object = gtk_widget_get_accessible (data_widget);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
- gtk_grid_attach (grid, create_info_label (nm_device_get_driver (device), TRUE),
+ gtk_grid_attach (grid, data_widget,
1, row, 1, 1);
row++;
@@ -606,7 +681,12 @@ info_dialog_add_page (GtkNotebook *notebook,
gtk_label_set_text (GTK_LABEL(speed_label), str ? str : C_("Speed", "Unknown"));
g_free (str);
- gtk_grid_attach (grid, create_info_label (_("Speed:"), FALSE),
+ desc_widget = create_info_label (_("Speed:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_object = gtk_widget_get_accessible (speed_label);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
gtk_grid_attach (grid, speed_label,
1, row, 1, 1);
@@ -616,7 +696,12 @@ info_dialog_add_page (GtkNotebook *notebook,
if (show_security) {
sec_label = create_info_label_security (connection);
if (sec_label) {
- gtk_grid_attach (grid, create_info_label (_("Security:"), FALSE),
+ desc_widget = create_info_label (_("Security:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_object = gtk_widget_get_accessible (sec_label);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
gtk_grid_attach (grid, sec_label,
1, row, 1, 1);
@@ -629,7 +714,12 @@ info_dialog_add_page (GtkNotebook *notebook,
/* CINR */
cinr_label = create_info_label ("", TRUE);
- gtk_grid_attach (grid, create_info_label (_("CINR:"), FALSE),
+ desc_widget = create_info_label (_("CINR:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_object = gtk_widget_get_accessible (cinr_label);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
gtk_grid_attach (grid, cinr_label,
1, row, 1, 1);
@@ -642,7 +732,12 @@ info_dialog_add_page (GtkNotebook *notebook,
/* Base Station ID */
bsid_label = create_info_label ("", TRUE);
- gtk_grid_attach (grid, create_info_label (_("BSID:"), FALSE),
+ desc_widget = create_info_label (_("BSID:"), FALSE);
+ desc_object = gtk_widget_get_accessible (desc_widget);
+ data_object = gtk_widget_get_accessible (bsid_label);
+ atk_object_add_relationship (desc_object, ATK_RELATION_LABEL_FOR, data_object);
+
+ gtk_grid_attach (grid, desc_widget,
0, row, 1, 1);
gtk_grid_attach (grid, bsid_label,
1, row, 1, 1);
@@ -705,6 +800,11 @@ info_dialog_add_page (GtkNotebook *notebook,
dns6 = def6_addr ? nm_ip6_config_get_nameservers (ip6_config) : NULL;
display_dns6_info (dns6, grid, &row);
+ desc_widget = NULL;
+ desc_object = NULL;
+ data_widget = NULL;
+ data_object = NULL;
+
gtk_notebook_append_page (notebook, GTK_WIDGET (grid),
create_info_notebook_label (connection, is_default));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]