Commit 9b8a7199 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Add accessible descriptions to tiles

We use the app summary as the accessible description for each
tile. That way, all the information thats visible on the screen
is also available in accessible form.

https://bugzilla.gnome.org/show_bug.cgi?id=708489
parent 7a0731e8
......@@ -61,6 +61,8 @@ app_state_changed (GsApp *app, GParamSpec *pspec, GsAppTile *tile)
{
GsAppTilePrivate *priv;
AtkObject *accessible;
gchar *name;
gboolean installed;
priv = gs_app_tile_get_instance_private (tile);
accessible = gtk_widget_get_accessible (priv->button);
......@@ -70,24 +72,25 @@ app_state_changed (GsApp *app, GParamSpec *pspec, GsAppTile *tile)
case GS_APP_STATE_INSTALLING:
case GS_APP_STATE_REMOVING:
case GS_APP_STATE_UPDATABLE:
gtk_widget_show (priv->eventbox);
if (GTK_IS_ACCESSIBLE (accessible)) {
gchar *name;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (app),
_("Installed"));
atk_object_set_name (accessible, name);
g_free (name);
}
installed = TRUE;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (app),
_("Installed"));
break;
case GS_APP_STATE_AVAILABLE:
default:
gtk_widget_hide (priv->eventbox);
if (GTK_IS_ACCESSIBLE (accessible)) {
atk_object_set_name (accessible, gs_app_get_name (app));
}
installed = FALSE;
name = g_strdup (gs_app_get_name (app));
break;
}
gtk_widget_set_visible (priv->eventbox, installed);
if (GTK_IS_ACCESSIBLE (accessible)) {
atk_object_set_name (accessible, name);
atk_object_set_description (accessible, gs_app_get_summary (app));
}
g_free (name);
}
void
......
......@@ -56,6 +56,38 @@ gs_feature_tile_get_app (GsFeatureTile *tile)
return priv->app;
}
static void
app_state_changed (GsApp *app, GParamSpec *pspec, GsFeatureTile *tile)
{
GsFeatureTilePrivate *priv;
AtkObject *accessible;
gchar *name;
priv = gs_feature_tile_get_instance_private (tile);
accessible = gtk_widget_get_accessible (priv->button);
switch (gs_app_get_state (app)) {
case GS_APP_STATE_INSTALLED:
case GS_APP_STATE_INSTALLING:
case GS_APP_STATE_REMOVING:
case GS_APP_STATE_UPDATABLE:
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (app),
_("Installed"));
break;
case GS_APP_STATE_AVAILABLE:
default:
name = g_strdup (gs_app_get_name (app));
break;
}
if (GTK_IS_ACCESSIBLE (accessible)) {
atk_object_set_name (accessible, name);
atk_object_set_description (accessible, gs_app_get_summary (app));
}
g_free (name);
}
void
gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
{
......@@ -70,6 +102,10 @@ gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
g_clear_object (&priv->app);
priv->app = g_object_ref (app);
g_signal_connect (priv->app, "notify::state",
G_CALLBACK (app_state_changed), tile);
app_state_changed (priv->app, NULL, tile);
gtk_label_set_label (GTK_LABEL (priv->title), gs_app_get_name (app));
gtk_label_set_label (GTK_LABEL (priv->subtitle), gs_app_get_summary (app));
data = g_strdup_printf (
......
......@@ -60,6 +60,8 @@ app_state_changed (GsApp *app, GParamSpec *pspec, GsPopularTile *tile)
{
GsPopularTilePrivate *priv;
AtkObject *accessible;
gchar *name;
gboolean installed;
priv = gs_popular_tile_get_instance_private (tile);
accessible = gtk_widget_get_accessible (priv->button);
......@@ -69,24 +71,25 @@ app_state_changed (GsApp *app, GParamSpec *pspec, GsPopularTile *tile)
case GS_APP_STATE_INSTALLING:
case GS_APP_STATE_REMOVING:
case GS_APP_STATE_UPDATABLE:
gtk_widget_show (priv->eventbox);
if (GTK_IS_ACCESSIBLE (accessible)) {
gchar *name;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (app),
_("Installed"));
atk_object_set_name (accessible, name);
g_free (name);
}
installed = TRUE;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (app),
_("Installed"));
break;
case GS_APP_STATE_AVAILABLE:
default:
gtk_widget_hide (priv->eventbox);
if (GTK_IS_ACCESSIBLE (accessible)) {
atk_object_set_name (accessible, gs_app_get_name (app));
}
installed = FALSE;
name = g_strdup (gs_app_get_name (app));
break;
}
gtk_widget_set_visible (priv->eventbox, installed);
if (GTK_IS_ACCESSIBLE (accessible)) {
atk_object_set_name (accessible, name);
atk_object_set_description (accessible, gs_app_get_summary (app));
}
g_free (name);
}
void
......
Supports Markdown
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