diff options
author | Benjamin Otte <otte@redhat.com> | 2012-07-09 03:11:01 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-07-09 03:12:13 +0200 |
commit | b900016a05b9bdb3736fe79ce8413b6e5ba2efa3 (patch) | |
tree | 01749d89d36f3116a88c2b9759575c1f7a626d7e /gtk | |
parent | 58cf6dfaaf3f7c6360881709b2cdf995c6666dc6 (diff) | |
download | gtk+-b900016a05b9bdb3736fe79ce8413b6e5ba2efa3.tar.gz |
a11y: Make lockbutton notify about state changes
In particular, ensure that the name of the lockbutton gets updated as
the displayed text of the lockbutton changes.
https://bugzilla.gnome.org/show_bug.cgi?id=677347
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/a11y/gtklockbuttonaccessible.c | 17 | ||||
-rw-r--r-- | gtk/a11y/gtklockbuttonaccessible.h | 4 | ||||
-rw-r--r-- | gtk/gtklockbutton.c | 10 |
3 files changed, 28 insertions, 3 deletions
diff --git a/gtk/a11y/gtklockbuttonaccessible.c b/gtk/a11y/gtklockbuttonaccessible.c index a24e3109b1..641cfe33b8 100644 --- a/gtk/a11y/gtklockbuttonaccessible.c +++ b/gtk/a11y/gtklockbuttonaccessible.c @@ -17,9 +17,11 @@ #include "config.h" -#include "gtk/gtklockbuttonprivate.h" #include "gtklockbuttonaccessible.h" +#include "gtk/gtklockbuttonprivate.h" +#include "gtk/gtkwidgetprivate.h" + G_DEFINE_TYPE (GtkLockButtonAccessible, _gtk_lock_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE) static const gchar * @@ -46,3 +48,16 @@ static void _gtk_lock_button_accessible_init (GtkLockButtonAccessible *lockbutton) { } + +void +_gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton) +{ + AtkObject *obj; + + obj = _gtk_widget_peek_accessible (GTK_WIDGET (lockbutton)); + if (obj == NULL) + return; + + g_object_notify (G_OBJECT (obj), "accessible-name"); +} + diff --git a/gtk/a11y/gtklockbuttonaccessible.h b/gtk/a11y/gtklockbuttonaccessible.h index 21bc93f343..9430129ac8 100644 --- a/gtk/a11y/gtklockbuttonaccessible.h +++ b/gtk/a11y/gtklockbuttonaccessible.h @@ -19,6 +19,7 @@ #define __GTK_LOCK_BUTTON_ACCESSIBLE_H__ #include "gtkbuttonaccessible.h" +#include "gtk/gtklockbutton.h" G_BEGIN_DECLS @@ -44,6 +45,9 @@ struct _GtkLockButtonAccessibleClass GType _gtk_lock_button_accessible_get_type (void); +void _gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton); + + G_END_DECLS #endif /* __GTK_LOCK_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/gtklockbutton.c b/gtk/gtklockbutton.c index 9cb828b843..6121adef23 100644 --- a/gtk/gtklockbutton.c +++ b/gtk/gtklockbutton.c @@ -185,10 +185,12 @@ gtk_lock_button_set_property (GObject *object, case PROP_TEXT_LOCK: gtk_label_set_text (GTK_LABEL (priv->label_lock), g_value_get_string (value)); + _gtk_lock_button_accessible_name_changed (button); break; case PROP_TEXT_UNLOCK: gtk_label_set_text (GTK_LABEL (priv->label_unlock), g_value_get_string (value)); + _gtk_lock_button_accessible_name_changed (button); break; case PROP_TOOLTIP_LOCK: @@ -388,8 +390,12 @@ update_state (GtkLockButton *button) } gtk_image_set_from_gicon (GTK_IMAGE (priv->image), icon, GTK_ICON_SIZE_MENU); - gtk_widget_set_visible (priv->label_lock, allowed); - gtk_widget_set_visible (priv->label_unlock, !allowed); + if (gtk_widget_get_visible (priv->label_lock) != allowed) + { + gtk_widget_set_visible (priv->label_lock, allowed); + gtk_widget_set_visible (priv->label_unlock, !allowed); + _gtk_lock_button_accessible_name_changed (button); + } gtk_widget_set_tooltip_markup (GTK_WIDGET (button), tooltip); gtk_widget_set_sensitive (GTK_WIDGET (button), sensitive); gtk_widget_set_visible (GTK_WIDGET (button), visible); |