[gtk+/wip/a11y: 9/10] a11y: Notify linkbutton directly instead of using signals



commit b0e2fd453c22a08462be395b2287fc426f658b67
Author: Benjamin Otte <otte redhat com>
Date:   Sun Jan 13 17:55:38 2013 +0100

    a11y: Notify linkbutton directly instead of using signals

 gtk/a11y/Makefile.am                      |    1 +
 gtk/a11y/gtklinkbuttonaccessible.c        |   29 ++++++++++++++++-------------
 gtk/a11y/gtklinkbuttonaccessibleprivate.h |   29 +++++++++++++++++++++++++++++
 gtk/gtklinkbutton.c                       |    4 +++-
 4 files changed, 49 insertions(+), 14 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index 6e93b3e..8962129 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -105,6 +105,7 @@ gtka11y_private_h_sources =		\
 	gtkcolorswatchaccessibleprivate.h \
 	gtkcontaineraccessibleprivate.h \
 	gtkiconviewaccessibleprivate.h	\
+	gtklinkbuttonaccessibleprivate.h \
 	gtklockbuttonaccessibleprivate.h \
 	gtkrangeaccessibleprivate.h     \
 	gtkstatusbaraccessibleprivate.h	\
diff --git a/gtk/a11y/gtklinkbuttonaccessible.c b/gtk/a11y/gtklinkbuttonaccessible.c
index b76f237..9c70a37 100644
--- a/gtk/a11y/gtklinkbuttonaccessible.c
+++ b/gtk/a11y/gtklinkbuttonaccessible.c
@@ -17,8 +17,8 @@
 
 #include "config.h"
 
-#include <gtk/gtk.h>
-#include "gtklinkbuttonaccessible.h"
+#include "gtklinkbuttonaccessibleprivate.h"
+#include "gtkwidgetprivate.h"
 
 typedef struct _GtkLinkButtonAccessibleLink GtkLinkButtonAccessibleLink;
 typedef struct _GtkLinkButtonAccessibleLinkClass GtkLinkButtonAccessibleLinkClass;
@@ -171,15 +171,6 @@ atk_action_interface_init (AtkActionIface *iface)
   iface->get_name = gtk_link_button_accessible_link_get_name;
 }
 
-static gboolean
-activate_link (GtkLinkButton *button,
-               AtkHyperlink  *atk_link)
-{
-  g_signal_emit_by_name (atk_link, "link-activated");
-
-  return FALSE;
-}
-
 static AtkHyperlink *
 gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
 {
@@ -188,8 +179,6 @@ gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
   if (!button->priv->link)
     {
       button->priv->link = gtk_link_button_accessible_link_new (button);
-      g_signal_connect (gtk_accessible_get_widget (GTK_ACCESSIBLE (button)),
-                        "activate-link", G_CALLBACK (activate_link), button->priv->link);
     }
 
   return g_object_ref (button->priv->link);
@@ -232,3 +221,17 @@ atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface)
 {
   iface->get_hyperlink = gtk_link_button_accessible_get_hyperlink;
 }
+
+void
+_gtk_link_button_accessible_activate_link (GtkLinkButton *link_button)
+{
+  GtkLinkButtonAccessible *accessible;
+
+  accessible = GTK_LINK_BUTTON_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (link_button)));
+  if (accessible == NULL)
+    return;
+
+  if (accessible->priv->link)
+    g_signal_emit_by_name (accessible->priv->link, "link-activated");
+}
+
diff --git a/gtk/a11y/gtklinkbuttonaccessibleprivate.h b/gtk/a11y/gtklinkbuttonaccessibleprivate.h
new file mode 100644
index 0000000..749e40a
--- /dev/null
+++ b/gtk/a11y/gtklinkbuttonaccessibleprivate.h
@@ -0,0 +1,29 @@
+/* GTK+ - accessibility implementations
+ * Copyright (C) 2013 Benjamin Otte <otte gnome 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_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__
+#define __GTK_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__
+
+#include <gtk/a11y/gtklinkbuttonaccessible.h>
+
+G_BEGIN_DECLS
+
+void _gtk_link_button_accessible_activate_link (GtkLinkButton *link_button);
+
+G_END_DECLS
+
+#endif /* __GTK_LINK_BUTTON_ACCESSIBLE_PRIVATE_H__ */
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index b5981c7..3f4b3b1 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -65,7 +65,7 @@
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
-#include "a11y/gtklinkbuttonaccessible.h"
+#include "a11y/gtklinkbuttonaccessibleprivate.h"
 
 struct _GtkLinkButtonPrivate
 {
@@ -548,6 +548,8 @@ gtk_link_button_activate_link (GtkLinkButton *link_button)
   GdkScreen *screen;
   GError *error;
 
+  _gtk_link_button_accessible_activate_link (link_button);
+
   if (gtk_widget_has_screen (GTK_WIDGET (link_button)))
     screen = gtk_widget_get_screen (GTK_WIDGET (link_button));
   else



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