[gtkhtml] Adjust to gtk+ a11y changes



commit bf664ecd0d8d76490f42f080ad64b5b3dbeeeabf
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Jan 8 03:09:58 2013 +0100

    Adjust to gtk+ a11y changes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669441

 a11y/Makefile.am  |    2 -
 a11y/factory.c    |   64 -----------------------------------------------------
 a11y/factory.h    |   29 ------------------------
 a11y/object.c     |   55 ++++++++++++++-------------------------------
 a11y/object.h     |    5 ++-
 configure.ac      |    2 +-
 gtkhtml/gtkhtml.c |    4 +-
 7 files changed, 23 insertions(+), 138 deletions(-)
---
diff --git a/a11y/Makefile.am b/a11y/Makefile.am
index 64bfdba..b9702e7 100644
--- a/a11y/Makefile.am
+++ b/a11y/Makefile.am
@@ -9,8 +9,6 @@ noinst_LTLIBRARIES = libgtkhtml-a11y.la
 libgtkhtml_a11y_la_SOURCES =                           \
        cell.h                                          \
        cell.c                                          \
-       factory.h                                       \
-       factory.c                                       \
        html.h                                          \
        html.c                                          \
        hyperlink.h                                     \
diff --git a/a11y/object.c b/a11y/object.c
index 207dc53..6ec52af 100644
--- a/a11y/object.c
+++ b/a11y/object.c
@@ -35,8 +35,10 @@
 
 static void gtk_html_a11y_class_init (GtkHTMLA11YClass *klass);
 static void gtk_html_a11y_init       (GtkHTMLA11Y *a11y);
+static void gtk_html_a11y_initialize (AtkObject *obj,
+                                      gpointer data);
 
-static GtkAccessibleClass *parent_class = NULL;
+static GtkContainerAccessibleClass *parent_class = NULL;
 
 static gint
 get_n_actions (AtkAction *action)
@@ -129,21 +131,7 @@ gtk_html_a11y_get_type (void)
                        NULL
                };
 
-               /*
-                * Figure out the size of the class and instance
-                * we are deriving from
-                */
-               AtkObjectFactory *factory;
-               GTypeQuery query;
-               GType derived_atk_type;
-
-               factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
-               derived_atk_type = atk_object_factory_get_accessible_type (factory);
-               g_type_query (derived_atk_type, &query);
-               tinfo.class_size = query.class_size;
-               tinfo.instance_size = query.instance_size;
-
-               type = g_type_register_static (derived_atk_type, "GtkHTMLA11Y", &tinfo, 0);
+               type = g_type_register_static (GTK_TYPE_CONTAINER_ACCESSIBLE, "GtkHTMLA11Y", &tinfo, 0);
 
                g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info);
        }
@@ -157,18 +145,6 @@ gtk_html_a11y_finalize (GObject *obj)
        G_OBJECT_CLASS (parent_class)->finalize (obj);
 }
 
-static void
-gtk_html_a11y_initialize (AtkObject *obj,
-                          gpointer data)
-{
-       /* printf ("gtk_html_a11y_initialize\n"); */
-
-       if (ATK_OBJECT_CLASS (parent_class)->initialize)
-               ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
-
-       g_object_set_data (G_OBJECT (obj), GTK_HTML_ID, data);
-}
-
 static gint
 gtk_html_a11y_get_n_children (AtkObject *accessible)
 {
@@ -386,22 +362,27 @@ gtk_html_a11y_delete_object_cb (GtkWidget *widget,
        }
 }
 
-AtkObject *
-gtk_html_a11y_new (GtkWidget *widget)
+static void
+gtk_html_a11y_initialize (AtkObject *obj,
+                          gpointer data)
 {
+       GtkWidget *widget;
        GtkHTML *html;
-       GObject *object;
        AtkObject *accessible;
        AtkObject *focus_object = NULL;
 
-       g_return_val_if_fail (GTK_IS_HTML (widget), NULL);
+       /* printf ("gtk_html_a11y_initialize\n"); */
+
+       if (ATK_OBJECT_CLASS (parent_class)->initialize)
+               ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
+
+       g_object_set_data (G_OBJECT (obj), GTK_HTML_ID, data);
 
-       object = g_object_new (G_TYPE_GTK_HTML_A11Y, NULL);
+       obj->role = ATK_ROLE_PANEL;
 
-       accessible = ATK_OBJECT (object);
-       atk_object_initialize (accessible, widget);
+       widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
+       accessible = ATK_OBJECT (obj);
 
-       accessible->role = ATK_ROLE_PANEL;
        g_signal_connect (widget, "grab_focus",
                        G_CALLBACK (gtk_html_a11y_grab_focus_cb),
                        NULL);
@@ -426,6 +407,4 @@ gtk_html_a11y_new (GtkWidget *widget)
                gtk_html_a11y_focus_object = focus_object;
                atk_focus_tracker_notify (focus_object);
        }
-
-       return accessible;
 }
diff --git a/a11y/object.h b/a11y/object.h
index 5d71712..09f4c2d 100644
--- a/a11y/object.h
+++ b/a11y/object.h
@@ -25,6 +25,7 @@
 #define __GTK_HTML_A11Y_OBJECT_H__
 
 #include <gtk/gtk.h>
+#include <gtk/gtk-a11y.h>
 
 #define G_TYPE_GTK_HTML_A11Y                     (gtk_html_a11y_get_type ())
 #define GTK_HTML_A11Y(obj)                       (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_GTK_HTML_A11Y, 
GtkHTMLA11Y))
@@ -42,14 +43,14 @@ typedef struct _GtkHTMLA11YClass GtkHTMLA11YClass;
 
 struct _GtkHTMLA11Y
 {
-       GtkAccessible parent;
+       GtkContainerAccessible parent;
 };
 
 GType gtk_html_a11y_get_type (void);
 
 struct _GtkHTMLA11YClass
 {
-  GtkAccessibleClass parent_class;
+  GtkContainerAccessibleClass parent_class;
 };
 
 AtkObject * gtk_html_a11y_new (GtkWidget *widget);
diff --git a/configure.ac b/configure.ac
index 54bb902..d73c692 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ AC_CONFIG_SRCDIR(README)
 PACKAGE=gtkhtml
 
 dnl Required Package Versions
-m4_define([gtk_minimum_version], [3.0.2])
+m4_define([gtk_minimum_version], [3.2.0])
 m4_define([enchant_minimum_version], [1.1.7])
 m4_define([gnome_icon_theme_minimum_version], [2.22.0])
 m4_define([cairo_minimum_version], [1.10.0])
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index 8d8f820..861200c 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -26,7 +26,7 @@
 #include <glib/gi18n-lib.h>
 #include <string.h>
 
-#include "../a11y/factory.h"
+#include "../a11y/object.h"
 
 #include "htmlcolorset.h"
 #include "htmlcluev.h"
@@ -3270,7 +3270,7 @@ gtk_html_class_init (GtkHTMLClass *klass)
        html_class->properties        = gtk_html_class_properties_new ();
 
        add_bindings (klass);
-       gtk_html_accessibility_init ();
+       gtk_widget_class_set_accessible_type (widget_class, G_TYPE_GTK_HTML_A11Y);
 
        filename = g_build_filename (PREFIX, "share", GTKHTML_RELEASE_STRING, "keybindingsrc.emacs", NULL);
        gtk_rc_parse (filename);


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