From b13fa490fb368b779a99543d18d5c68c01f8eb31 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 4 Feb 2011 13:57:23 +1100 Subject: Add accessible_name support --- example/simple-client.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'example') diff --git a/example/simple-client.c b/example/simple-client.c index ac8360f..9c9a14b 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -27,6 +27,7 @@ with this program. If not, see . GMainLoop * mainloop = NULL; static gboolean active = TRUE; static gboolean can_haz_label = TRUE; +static gboolean can_haz_a11yname = TRUE; static void label_toggle_cb (GtkWidget * widget, gpointer data) @@ -42,6 +43,20 @@ label_toggle_cb (GtkWidget * widget, gpointer data) return; } +static void +a11yname_toggle_cb (GtkWidget * widget, gpointer data) +{ + can_haz_a11yname = !can_haz_a11yname; + + if (can_haz_a11yname) { + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide accessible name"); + } else { + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show accessible name"); + } + + return; +} + static void activate_clicked_cb (GtkWidget *widget, gpointer data) { @@ -140,6 +155,13 @@ percent_change (gpointer user_data) } else { app_indicator_set_label (APP_INDICATOR(user_data), NULL, NULL); } + if (can_haz_a11yname) { + gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); + app_indicator_set_accessible_name (APP_INDICATOR(user_data), percentstr); + g_free(percentstr); + } else { + app_indicator_set_accessible_name (APP_INDICATOR(user_data), NULL); + } return TRUE; } @@ -213,6 +235,13 @@ main (int argc, char ** argv) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show(item); + item = gtk_menu_item_new_with_label ("Show accessible name"); + a11yname_toggle_cb(item, ci); + g_signal_connect (item, "activate", + G_CALLBACK (a11yname_toggle_cb), ci); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); + app_indicator_set_menu (ci, GTK_MENU (menu)); mainloop = g_main_loop_new(NULL, FALSE); -- cgit v1.2.3 From fffab2e1e8d991a41cc591ceaca77c8a40f31f33 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 8 Feb 2011 17:55:35 +1100 Subject: accessible_name -> accessible_desc --- example/simple-client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'example') diff --git a/example/simple-client.c b/example/simple-client.c index 9c9a14b..d5c9ad8 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -49,9 +49,9 @@ a11yname_toggle_cb (GtkWidget * widget, gpointer data) can_haz_a11yname = !can_haz_a11yname; if (can_haz_a11yname) { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide accessible name"); + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide accessible description"); } else { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show accessible name"); + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show accessible description"); } return; @@ -157,10 +157,10 @@ percent_change (gpointer user_data) } if (can_haz_a11yname) { gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); - app_indicator_set_accessible_name (APP_INDICATOR(user_data), percentstr); + app_indicator_set_accessible_desc (APP_INDICATOR(user_data), percentstr); g_free(percentstr); } else { - app_indicator_set_accessible_name (APP_INDICATOR(user_data), NULL); + app_indicator_set_accessible_desc (APP_INDICATOR(user_data), NULL); } return TRUE; } @@ -235,7 +235,7 @@ main (int argc, char ** argv) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show(item); - item = gtk_menu_item_new_with_label ("Show accessible name"); + item = gtk_menu_item_new_with_label ("Show accessible description"); a11yname_toggle_cb(item, ci); g_signal_connect (item, "activate", G_CALLBACK (a11yname_toggle_cb), ci); -- cgit v1.2.3 From f4920ad7a859f4cb35548741954fece0af6264ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 22:21:55 -0600 Subject: Switching to the new style of setting the a11y label --- example/simple-client.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'example') diff --git a/example/simple-client.c b/example/simple-client.c index 5d464ac..9e63e14 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -27,7 +27,6 @@ with this program. If not, see . GMainLoop * mainloop = NULL; static gboolean active = TRUE; static gboolean can_haz_label = TRUE; -static gboolean can_haz_a11yname = TRUE; static void label_toggle_cb (GtkWidget * widget, gpointer data) @@ -43,20 +42,6 @@ label_toggle_cb (GtkWidget * widget, gpointer data) return; } -static void -a11yname_toggle_cb (GtkWidget * widget, gpointer data) -{ - can_haz_a11yname = !can_haz_a11yname; - - if (can_haz_a11yname) { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide accessible description"); - } else { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show accessible description"); - } - - return; -} - static void activate_clicked_cb (GtkWidget *widget, gpointer data) { @@ -80,9 +65,9 @@ local_icon_toggle_cb (GtkWidget *widget, gpointer data) AppIndicator * ci = APP_INDICATOR(data); if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { - app_indicator_set_icon(ci, LOCAL_ICON); + app_indicator_set_icon_full(ci, LOCAL_ICON, "Local Icon"); } else { - app_indicator_set_icon(ci, "indicator-messages"); + app_indicator_set_icon_full(ci, "indicator-messages", "System Icon"); } return; @@ -161,13 +146,6 @@ percent_change (gpointer user_data) } else { app_indicator_set_label (APP_INDICATOR(user_data), NULL, NULL); } - if (can_haz_a11yname) { - gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); - app_indicator_set_accessible_desc (APP_INDICATOR(user_data), percentstr); - g_free(percentstr); - } else { - app_indicator_set_accessible_desc (APP_INDICATOR(user_data), NULL); - } return TRUE; } @@ -187,7 +165,7 @@ main (int argc, char ** argv) g_assert (G_IS_OBJECT (ci)); app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon(ci, "indicator-messages-new"); + app_indicator_set_attention_icon_full(ci, "indicator-messages-new", "System Messages Icon Highlighted"); app_indicator_set_label (ci, "1%", "100%"); g_signal_connect (ci, "scroll-event", @@ -244,13 +222,6 @@ main (int argc, char ** argv) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show(item); - item = gtk_menu_item_new_with_label ("Show accessible description"); - a11yname_toggle_cb(item, ci); - g_signal_connect (item, "activate", - G_CALLBACK (a11yname_toggle_cb), ci); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); - app_indicator_set_menu (ci, GTK_MENU (menu)); mainloop = g_main_loop_new(NULL, FALSE); -- cgit v1.2.3