[gtk+/wip/a11y: 5/10] a11y: Call statusbar accessible directly



commit 6c68b2500857666142c66e35b7a2b03fc53326e6
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 10 18:49:36 2013 +0100

    a11y: Call statusbar accessible directly

 gtk/a11y/Makefile.am                     |    1 +
 gtk/a11y/gtkstatusbaraccessible.c        |   37 +++++++++++++----------------
 gtk/a11y/gtkstatusbaraccessibleprivate.h |   29 +++++++++++++++++++++++
 gtk/gtkstatusbar.c                       |    4 ++-
 4 files changed, 50 insertions(+), 21 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 6ef98d9..c97cf92 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 7d84a5a..7c3c250 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 0000000..8df87b2
--- /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 4735037..3d141d3 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);
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]