[gtk+/quartz-integration: 460/563] Convert GailLinkButton to GtkLinkButtonAccessible



commit 6d0c5f9f362c305e1fd86c75f7c3becaaf82660d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 26 23:48:54 2011 -0400

    Convert GailLinkButton to GtkLinkButtonAccessible

 gtk/a11y/Makefile.am                               |    4 +-
 gtk/a11y/gail.c                                    |    3 -
 gtk/a11y/gaillinkbutton.h                          |   53 -----------
 ...{gaillinkbutton.c => gtklinkbuttonaccessible.c} |   92 ++++++++++----------
 gtk/a11y/gtklinkbuttonaccessible.h                 |   53 +++++++++++
 gtk/gtklinkbutton.c                                |    4 +-
 6 files changed, 104 insertions(+), 105 deletions(-)
---
diff --git a/gtk/a11y/Makefile.am b/gtk/a11y/Makefile.am
index d025add..a224898 100644
--- a/gtk/a11y/Makefile.am
+++ b/gtk/a11y/Makefile.am
@@ -22,7 +22,7 @@ gail_c_sources =			\
 	gtkimageaccessible.c		\
 	gailimagecell.c			\
 	gtklabelaccessible.c		\
-	gaillinkbutton.c		\
+	gtklinkbuttonaccessible.c	\
 	gailmisc.c			\
 	gailmenu.c			\
 	gailmenushell.c			\
@@ -74,7 +74,7 @@ gail_private_h_sources =		\
 	gtkimageaccessible.h		\
 	gailimagecell.h			\
 	gtklabelaccessible.h		\
-	gaillinkbutton.h		\
+	gtklinkbuttonaccessible.h	\
 	gailmisc.h			\
 	gailmenu.h			\
 	gailmenushell.h			\
diff --git a/gtk/a11y/gail.c b/gtk/a11y/gail.c
index 93751f9..0aeb9d3 100644
--- a/gtk/a11y/gail.c
+++ b/gtk/a11y/gail.c
@@ -33,7 +33,6 @@
 #include "gailcontainercell.h"
 #include "gailexpander.h"
 #include "gailimagecell.h"
-#include "gaillinkbutton.h"
 #include "gailmenu.h"
 #include "gailmenushell.h"
 #include "gailmenuitem.h"
@@ -103,7 +102,6 @@ static GQuark quark_focus_object = 0;
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WIDGET, GailWidget, gail_widget, GTK_TYPE_WIDGET)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CONTAINER, GailContainer, gail_container, GTK_TYPE_CONTAINER)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_BUTTON, GailButton, gail_button, GTK_TYPE_BUTTON)
-GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_LINK_BUTTON, GailLinkButton, gail_link_button, GTK_TYPE_LINK_BUTTON)
 GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_MENU_ITEM, GailMenuItem, gail_menu_item, gail_menu_item_new)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TOGGLE_BUTTON, GailToggleButton, gail_toggle_button, GTK_TYPE_TOGGLE_BUTTON)
 GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_COMBO_BOX, GailComboBox, gail_combo_box, GTK_TYPE_COMBO_BOX)
@@ -868,7 +866,6 @@ gail_accessibility_module_init (void)
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WIDGET, gail_widget);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CONTAINER, gail_container);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BUTTON, gail_button);
-  GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LINK_BUTTON, gail_link_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TOGGLE_BUTTON, gail_toggle_button);
   GAIL_WIDGET_SET_FACTORY (GTK_TYPE_COMBO_BOX, gail_combo_box);
diff --git a/gtk/a11y/gaillinkbutton.c b/gtk/a11y/gtklinkbuttonaccessible.c
similarity index 50%
rename from gtk/a11y/gaillinkbutton.c
rename to gtk/a11y/gtklinkbuttonaccessible.c
index 7bc7187..fc2590c 100644
--- a/gtk/a11y/gaillinkbutton.c
+++ b/gtk/a11y/gtklinkbuttonaccessible.c
@@ -20,44 +20,44 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
-#include "gaillinkbutton.h"
+#include "gtklinkbuttonaccessible.h"
 
-typedef struct _GailLinkButtonLink GailLinkButtonLink;
-typedef struct _GailLinkButtonLinkClass GailLinkButtonLinkClass;
+typedef struct _GtkLinkButtonAccessibleLink GtkLinkButtonAccessibleLink;
+typedef struct _GtkLinkButtonAccessibleLinkClass GtkLinkButtonAccessibleLinkClass;
 
-struct _GailLinkButtonLink
+struct _GtkLinkButtonAccessibleLink
 {
   AtkHyperlink parent;
 
-  GailLinkButton *button;
+  GtkLinkButtonAccessible *button;
 };
 
-struct _GailLinkButtonLinkClass
+struct _GtkLinkButtonAccessibleLinkClass
 {
   AtkHyperlinkClass parent_class;
 };
 
 static void atk_action_interface_init (AtkActionIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (GailLinkButtonLink, gail_link_button_link, ATK_TYPE_HYPERLINK,
+G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessibleLink, gtk_link_button_accessible_link, ATK_TYPE_HYPERLINK,
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
 
 static AtkHyperlink *
-gail_link_button_link_new (GailLinkButton *button)
+gtk_link_button_accessible_link_new (GtkLinkButtonAccessible *button)
 {
-  GailLinkButtonLink *link;
+  GtkLinkButtonAccessibleLink *link;
 
-  link = g_object_new (gail_link_button_link_get_type (), NULL);
+  link = g_object_new (gtk_link_button_accessible_link_get_type (), NULL);
   link->button = button;
 
   return ATK_HYPERLINK (link);
 }
 
 static gchar *
-gail_link_button_link_get_uri (AtkHyperlink *link,
+gtk_link_button_accessible_link_get_uri (AtkHyperlink *link,
                                gint          i)
 {
-  GailLinkButtonLink *l = (GailLinkButtonLink *)link;
+  GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)link;
   GtkWidget *widget;
   const gchar *uri;
 
@@ -68,63 +68,63 @@ gail_link_button_link_get_uri (AtkHyperlink *link,
 }
 
 static gint
-gail_link_button_link_get_n_anchors (AtkHyperlink *link)
+gtk_link_button_accessible_link_get_n_anchors (AtkHyperlink *link)
 {
   return 1;
 }
 
 static gboolean
-gail_link_button_link_is_valid (AtkHyperlink *link)
+gtk_link_button_accessible_link_is_valid (AtkHyperlink *link)
 {
   return TRUE;
 }
 
 static AtkObject *
-gail_link_button_link_get_object (AtkHyperlink *link,
+gtk_link_button_accessible_link_get_object (AtkHyperlink *link,
                                   gint          i)
 {
-  GailLinkButtonLink *l = (GailLinkButtonLink *)link;
+  GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)link;
 
   return ATK_OBJECT (l->button);
 }
 
 static gint
-gail_link_button_link_get_start_index (AtkHyperlink *link)
+gtk_link_button_accessible_link_get_start_index (AtkHyperlink *link)
 {
   return 0;
 }
 
 static gint
-gail_link_button_link_get_end_index (AtkHyperlink *link)
+gtk_link_button_accessible_link_get_end_index (AtkHyperlink *link)
 {
-  GailLinkButtonLink *l = (GailLinkButtonLink *)link;
+  GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)link;
 
   return atk_text_get_character_count (ATK_TEXT (l->button));
 }
 
 static void
-gail_link_button_link_init (GailLinkButtonLink *link)
+gtk_link_button_accessible_link_init (GtkLinkButtonAccessibleLink *link)
 {
 }
 
 static void
-gail_link_button_link_class_init (GailLinkButtonLinkClass *class)
+gtk_link_button_accessible_link_class_init (GtkLinkButtonAccessibleLinkClass *class)
 {
   AtkHyperlinkClass *hyperlink_class = ATK_HYPERLINK_CLASS (class);
 
-  hyperlink_class->get_uri = gail_link_button_link_get_uri;
-  hyperlink_class->get_n_anchors = gail_link_button_link_get_n_anchors;
-  hyperlink_class->is_valid = gail_link_button_link_is_valid;
-  hyperlink_class->get_object = gail_link_button_link_get_object;
-  hyperlink_class->get_start_index = gail_link_button_link_get_start_index;
-  hyperlink_class->get_end_index = gail_link_button_link_get_end_index;
+  hyperlink_class->get_uri = gtk_link_button_accessible_link_get_uri;
+  hyperlink_class->get_n_anchors = gtk_link_button_accessible_link_get_n_anchors;
+  hyperlink_class->is_valid = gtk_link_button_accessible_link_is_valid;
+  hyperlink_class->get_object = gtk_link_button_accessible_link_get_object;
+  hyperlink_class->get_start_index = gtk_link_button_accessible_link_get_start_index;
+  hyperlink_class->get_end_index = gtk_link_button_accessible_link_get_end_index;
 }
 
 static gboolean
-gail_link_button_link_do_action (AtkAction *action,
+gtk_link_button_accessible_link_do_action (AtkAction *action,
                                  gint       i)
 {
-  GailLinkButtonLink *link = (GailLinkButtonLink *)action;
+  GtkLinkButtonAccessibleLink *link = (GtkLinkButtonAccessibleLink *)action;
   GtkWidget *widget;
 
   widget = GTK_WIDGET (link->button);
@@ -143,14 +143,14 @@ gail_link_button_link_do_action (AtkAction *action,
 }
 
 static gint
-gail_link_button_link_get_n_actions (AtkAction *action)
+gtk_link_button_accessible_link_get_n_actions (AtkAction *action)
 {
   return 1;
 }
 
 static const gchar *
-gail_link_button_link_get_name (AtkAction *action,
-                                gint i)
+gtk_link_button_accessible_link_get_name (AtkAction *action,
+                                          gint       i)
 {
   g_return_val_if_fail (i == 0, NULL);
 
@@ -160,9 +160,9 @@ gail_link_button_link_get_name (AtkAction *action,
 static void
 atk_action_interface_init (AtkActionIface *iface)
 {
-  iface->do_action = gail_link_button_link_do_action;
-  iface->get_n_actions = gail_link_button_link_get_n_actions;
-  iface->get_name = gail_link_button_link_get_name;
+  iface->do_action = gtk_link_button_accessible_link_do_action;
+  iface->get_n_actions = gtk_link_button_accessible_link_get_n_actions;
+  iface->get_name = gtk_link_button_accessible_link_get_name;
 }
 
 static gboolean
@@ -174,13 +174,13 @@ activate_link (GtkLinkButton *button, AtkHyperlink *link)
 }
 
 static AtkHyperlink *
-gail_link_button_get_hyperlink (AtkHyperlinkImpl *impl)
+gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
 {
-  GailLinkButton *button = GAIL_LINK_BUTTON (impl);
+  GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (impl);
 
   if (!button->link)
     {
-      button->link = gail_link_button_link_new (button);
+      button->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->link);
     }
@@ -190,33 +190,33 @@ gail_link_button_get_hyperlink (AtkHyperlinkImpl *impl)
 
 static void atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (GailLinkButton, gail_link_button, GAIL_TYPE_BUTTON,
+G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessible, gtk_link_button_accessible, GAIL_TYPE_BUTTON,
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERLINK_IMPL, atk_hypertext_impl_interface_init))
 
 static void
-gail_link_button_init (GailLinkButton *button)
+gtk_link_button_accessible_init (GtkLinkButtonAccessible *button)
 {
 }
 
 static void
-gail_link_button_finalize (GObject *object)
+gtk_link_button_accessible_finalize (GObject *object)
 {
-  GailLinkButton *button = GAIL_LINK_BUTTON (object);
+  GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (object);
 
   if (button->link)
     g_object_unref (button->link);
 
-  G_OBJECT_CLASS (gail_link_button_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_link_button_accessible_parent_class)->finalize (object);
 }
 
 static void
-gail_link_button_class_init (GailLinkButtonClass *klass)
+gtk_link_button_accessible_class_init (GtkLinkButtonAccessibleClass *klass)
 {
-  G_OBJECT_CLASS (klass)->finalize = gail_link_button_finalize;
+  G_OBJECT_CLASS (klass)->finalize = gtk_link_button_accessible_finalize;
 }
 
 static void
 atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface)
 {
-  iface->get_hyperlink = gail_link_button_get_hyperlink;
+  iface->get_hyperlink = gtk_link_button_accessible_get_hyperlink;
 }
diff --git a/gtk/a11y/gtklinkbuttonaccessible.h b/gtk/a11y/gtklinkbuttonaccessible.h
new file mode 100644
index 0000000..ff944c7
--- /dev/null
+++ b/gtk/a11y/gtklinkbuttonaccessible.h
@@ -0,0 +1,53 @@
+/* GAIL - The GNOME Accessibility Implementation Library
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_LINK_BUTTON_ACCESSIBLE_H__
+#define __GTK_LINK_BUTTON_ACCESSIBLE_H__
+
+#include "gailbutton.h"
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_LINK_BUTTON_ACCESSIBLE                (gtk_link_button_accessible_get_type ())
+#define GTK_LINK_BUTTON_ACCESSIBLE(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessible))
+#define GTK_LINK_BUTTON_ACCESSIBLE_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass))
+#define GTK_IS_LINK_BUTTON_ACCESSIBLE(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE))
+#define GTK_IS_LINK_BUTTON_ACCESSIBLE_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE))
+#define GTK_LINK_BUTTON_ACCESSIBLE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass))
+
+typedef struct _GtkLinkButtonAccessible      GtkLinkButtonAccessible;
+typedef struct _GtkLinkButtonAccessibleClass GtkLinkButtonAccessibleClass;
+
+struct _GtkLinkButtonAccessible
+{
+  GailButton parent;
+
+  AtkHyperlink *link;
+};
+
+struct _GtkLinkButtonAccessibleClass
+{
+  GailButtonClass parent_class;
+};
+
+GType gtk_link_button_accessible_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GTK_LINK_BUTTON_ACCESSIBLE_H__ */
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index b98972f..cafa3aa 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -63,9 +63,9 @@
 #include "gtkstock.h"
 #include "gtkshow.h"
 #include "gtktooltip.h"
-
 #include "gtkintl.h"
 
+#include "a11y/gtklinkbuttonaccessible.h"
 
 struct _GtkLinkButtonPrivate
 {
@@ -214,6 +214,8 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass)
                   _gtk_boolean_handled_accumulator, NULL,
                   _gtk_marshal_BOOLEAN__VOID,
                   G_TYPE_BOOLEAN, 0);
+
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LINK_BUTTON_ACCESSIBLE);
 }
 
 static void



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