diff options
author | Valentin Villenave <[email protected]> | 2021-10-07 13:30:20 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-10-26 16:00:45 +0200 |
commit | 77ea4ad2917ac2054b08026f205d623b38229c1a (patch) | |
tree | 7a8b8fee1b300e7de587d06c8b780a93d7e01944 /timerapplet | |
parent | cf3bbe8ecb92548b6320d46d4a97197ab7bf6825 (diff) | |
download | mate-applets-77ea4ad2917ac2054b08026f205d623b38229c1a.tar.bz2 mate-applets-77ea4ad2917ac2054b08026f205d623b38229c1a.tar.xz |
Mate Timer applet: add accessible Atk object with proper label.
The accessible object also updates when the label gets updated.
Diffstat (limited to 'timerapplet')
-rw-r--r-- | timerapplet/src/timerapplet.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/timerapplet/src/timerapplet.c b/timerapplet/src/timerapplet.c index e72d8e21..8399ebb0 100644 --- a/timerapplet/src/timerapplet.c +++ b/timerapplet/src/timerapplet.c @@ -115,6 +115,7 @@ timer_applet_destroy (MatePanelApplet *applet_widget, TimerApplet *applet) static gboolean timer_callback (TimerApplet *applet) { + AtkObject *atk_obj; gboolean retval = TRUE; gchar *label; gchar *name; @@ -125,6 +126,7 @@ timer_callback (TimerApplet *applet) tooltip = NULL; name = g_settings_get_string (applet->settings, NAME_KEY); + atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet->applet)); if (!applet->active) { @@ -134,6 +136,7 @@ timer_callback (TimerApplet *applet) gtk_label_set_text (applet->label, name); gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), ""); gtk_widget_hide (GTK_WIDGET (applet->pause_image)); + atk_object_set_name (atk_obj, name); } else { @@ -154,6 +157,8 @@ timer_callback (TimerApplet *applet) gtk_label_set_text (applet->label, label); gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), name); gtk_widget_hide (GTK_WIDGET (applet->pause_image)); + atk_object_set_name (atk_obj, label); + atk_object_set_description (atk_obj, tooltip); if (g_settings_get_boolean (applet->settings, SHOW_NOTIFICATION_KEY)) { @@ -201,6 +206,7 @@ timer_callback (TimerApplet *applet) gtk_label_set_text (applet->label, label); gtk_widget_set_tooltip_text (GTK_WIDGET (applet->label), tooltip); gtk_widget_set_visible (GTK_WIDGET (applet->pause_image), applet->pause); + atk_object_set_name (atk_obj, label); } g_free (label); @@ -365,6 +371,7 @@ static gboolean timer_applet_fill (MatePanelApplet* applet_widget) { TimerApplet *applet; + AtkObject *atk_obj; g_set_application_name (_("Timer Applet")); gtk_window_set_default_icon_name (APPLET_ICON); @@ -386,6 +393,11 @@ timer_applet_fill (MatePanelApplet* applet_widget) applet->pause_image = GTK_IMAGE (gtk_image_new_from_icon_name ("media-playback-pause", GTK_ICON_SIZE_BUTTON)); applet->label = GTK_LABEL (gtk_label_new ("")); + atk_obj = gtk_widget_get_accessible (GTK_WIDGET (applet->applet)); + if (GTK_IS_ACCESSIBLE (atk_obj)) { + atk_object_set_name (atk_obj, _("Timer Applet")); + atk_object_set_description (atk_obj, _("Start a timer and receive a notification when it is finished")); + } /* we add the Gtk label into the applet */ gtk_box_pack_start (applet->box, GTK_WIDGET (applet->image), |