Commit a3b07073 authored by Michael Catanzaro's avatar Michael Catanzaro

Use the first grid element for the initial accessible name of the grid

Instead of "Volumes Grid", so the user doesn't have to switch to another
grid element and back to read the first partition, and so that it is
possible to read the first partition when there is only one partition.

Also, use gdu_volume_grid_get_no_media_string() for the accessible name
when appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=747490
parent 25402614
......@@ -232,6 +232,18 @@ gdu_volume_grid_set_property (GObject *object,
}
}
static void
gdu_volume_grid_set_accessible_name_for_grid_element (GduVolumeGrid *grid, GridElement *element)
{
AtkObject *accessible = gtk_widget_get_accessible (GTK_WIDGET (grid));
const char *accessible_name;
accessible_name = element->text ? element->text :
gdu_volume_grid_get_no_media_string (grid);
atk_object_set_name (accessible, accessible_name);
}
static void
gdu_volume_grid_constructed (GObject *object)
{
......@@ -245,6 +257,10 @@ gdu_volume_grid_constructed (GObject *object)
recompute_grid (grid);
accessible = gtk_widget_get_accessible (GTK_WIDGET (grid));
atk_object_set_role (accessible, ATK_ROLE_PANEL);
atk_object_set_name (accessible, _("Volumes Grid"));
/* select the first element */
if (grid->elements != NULL)
{
......@@ -253,10 +269,6 @@ gdu_volume_grid_constructed (GObject *object)
grid->focused = element;
}
accessible = gtk_widget_get_accessible (GTK_WIDGET (grid));
atk_object_set_name (accessible, _("Volumes Grid"));
atk_object_set_role (accessible, ATK_ROLE_PANEL);
if (G_OBJECT_CLASS (gdu_volume_grid_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gdu_volume_grid_parent_class)->constructed (object);
}
......@@ -268,7 +280,6 @@ gdu_volume_grid_key_press_event (GtkWidget *widget,
GduVolumeGrid *grid = GDU_VOLUME_GRID (widget);
gboolean handled;
GridElement *target;
AtkObject *accessible;
handled = FALSE;
......@@ -348,8 +359,7 @@ gdu_volume_grid_key_press_event (GtkWidget *widget,
signals[CHANGED_SIGNAL],
0);
accessible = gtk_widget_get_accessible (GTK_WIDGET (grid));
atk_object_set_name (accessible, target->text);
gdu_volume_grid_set_accessible_name_for_grid_element (grid, target);
}
gtk_widget_queue_draw (GTK_WIDGET (grid));
}
......@@ -383,7 +393,6 @@ gdu_volume_grid_button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
GduVolumeGrid *grid = GDU_VOLUME_GRID (widget);
AtkObject *accessible;
gboolean handled;
handled = FALSE;
......@@ -406,8 +415,7 @@ gdu_volume_grid_button_press_event (GtkWidget *widget,
gtk_widget_grab_focus (GTK_WIDGET (grid));
gtk_widget_queue_draw (GTK_WIDGET (grid));
accessible = gtk_widget_get_accessible (GTK_WIDGET (grid));
atk_object_set_name (accessible, element->text);
gdu_volume_grid_set_accessible_name_for_grid_element (grid, element);
}
handled = TRUE;
}
......@@ -1489,6 +1497,8 @@ recompute_grid (GduVolumeGrid *grid)
if (grid->focused == NULL)
grid->focused = grid->elements->data;
gdu_volume_grid_set_accessible_name_for_grid_element (grid, grid->selected);
/* queue a redraw */
gtk_widget_queue_draw (GTK_WIDGET (grid));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment