diff options
author | Benjamin Otte <otte@redhat.com> | 2013-01-10 18:49:36 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2013-01-13 23:47:40 +0100 |
commit | 6c68b2500857666142c66e35b7a2b03fc53326e6 (patch) | |
tree | 00babe934c9bf03416bf983ef657967e0569f2e3 | |
parent | 0c6deef968d8f1e4ea2a5151f526fcde4195cf81 (diff) | |
download | gtk+-6c68b2500857666142c66e35b7a2b03fc53326e6.tar.gz |
a11y: Call statusbar accessible directly
-rw-r--r-- | gtk/a11y/Makefile.am | 1 | ||||
-rw-r--r-- | gtk/a11y/gtkstatusbaraccessible.c | 37 | ||||
-rw-r--r-- | gtk/a11y/gtkstatusbaraccessibleprivate.h | 29 | ||||
-rw-r--r-- | gtk/gtkstatusbar.c | 4 |
4 files changed, 50 insertions, 21 deletions
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am index 6ef98d9b4a..c97cf928f7 100644 --- a/gtk/a11y/Makefile.am +++ b/gtk/a11y/Makefile.am @@ -106,6 +106,7 @@ gtka11y_private_h_sources = \ gtkiconviewaccessibleprivate.h \ gtklockbuttonaccessibleprivate.h \ gtkrangeaccessibleprivate.h \ + gtkstatusbaraccessibleprivate.h \ gtktextviewaccessibleprivate.h \ gtktreeviewaccessibleprivate.h \ gtkwidgetaccessibleprivate.h diff --git a/gtk/a11y/gtkstatusbaraccessible.c b/gtk/a11y/gtkstatusbaraccessible.c index 7d84a5aa40..7c3c250c9b 100644 --- a/gtk/a11y/gtkstatusbaraccessible.c +++ b/gtk/a11y/gtkstatusbaraccessible.c @@ -17,37 +17,20 @@ #include "config.h" -#include <string.h> -#include <gtk/gtk.h> #include "gtkstatusbaraccessible.h" +#include "gtkstatusbaraccessibleprivate.h" +#include "gtkwidgetprivate.h" -G_DEFINE_TYPE (GtkStatusbarAccessible, gtk_statusbar_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) -static void -text_changed (GtkStatusbar *statusbar, - guint context_id, - const gchar *text, - AtkObject *obj) -{ - if (!obj->name) - g_object_notify (G_OBJECT (obj), "accessible-name"); - g_signal_emit_by_name (obj, "visible-data-changed"); -} +G_DEFINE_TYPE (GtkStatusbarAccessible, gtk_statusbar_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE) static void gtk_statusbar_accessible_initialize (AtkObject *obj, gpointer data) { - GtkWidget *statusbar = data; - ATK_OBJECT_CLASS (gtk_statusbar_accessible_parent_class)->initialize (obj, data); - g_signal_connect_after (statusbar, "text-pushed", - G_CALLBACK (text_changed), obj); - g_signal_connect_after (statusbar, "text-popped", - G_CALLBACK (text_changed), obj); - obj->role = ATK_ROLE_STATUSBAR; } @@ -146,3 +129,17 @@ static void gtk_statusbar_accessible_init (GtkStatusbarAccessible *bar) { } + +void +_gtk_statusbar_accessible_update_text (GtkStatusbar *statusbar) +{ + AtkObject *obj; + + obj = _gtk_widget_peek_accessible (GTK_WIDGET (statusbar)); + if (obj == NULL) + return; + + if (!obj->name) + g_object_notify (G_OBJECT (obj), "accessible-name"); + g_signal_emit_by_name (obj, "visible-data-changed"); +} diff --git a/gtk/a11y/gtkstatusbaraccessibleprivate.h b/gtk/a11y/gtkstatusbaraccessibleprivate.h new file mode 100644 index 0000000000..8df87b2815 --- /dev/null +++ b/gtk/a11y/gtkstatusbaraccessibleprivate.h @@ -0,0 +1,29 @@ +/* GTK+ - accessibility implementations + * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__ +#define __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__ + +#include <gtk/a11y/gtkstatusbaraccessible.h> + +G_BEGIN_DECLS + +void _gtk_statusbar_accessible_update_text (GtkStatusbar *statusbar); + +G_END_DECLS + +#endif /* __GTK_STATUSBAR_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 47350376ad..3d141d35b6 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -37,7 +37,7 @@ #include "gtkbuildable.h" #include "gtkorientable.h" #include "gtktypebuiltins.h" -#include "a11y/gtkstatusbaraccessible.h" +#include "a11y/gtkstatusbaraccessibleprivate.h" /** * SECTION:gtkstatusbar @@ -286,6 +286,8 @@ gtk_statusbar_update (GtkStatusbar *statusbar, text = ""; gtk_label_set_text (GTK_LABEL (priv->label), text); + + _gtk_statusbar_accessible_update_text (statusbar); } /** |