[gtk/wip/ebassi/a11y-2: 416/442] Drop unused AtkRegistry path



commit 959c10140041a093f3baede54a48ecfd615eade0
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Apr 22 20:06:55 2020 +0100

    Drop unused AtkRegistry path
    
    We expect widgets to use their own derived GtkWidgetAccessible type,
    these days, and given that we hard code the default accessible type of a
    GtkWidget to GtkWidgetAccessible, and that we enforce the dependency of
    the type passed to gtk_widget_class_set_accessible_type(), the registry
    code path is clearly unused.

 gtk/gtkwidget.c | 47 ++++++++++++++---------------------------------
 1 file changed, 14 insertions(+), 33 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1e95cb2dc5..0b23197342 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -937,7 +937,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   klass->system_setting_changed = gtk_widget_real_system_setting_changed;
 
   /* Accessibility support */
-  klass->priv->accessible_type = GTK_TYPE_ACCESSIBLE;
+  klass->priv->accessible_type = GTK_TYPE_WIDGET_ACCESSIBLE;
   klass->priv->accessible_role = ATK_ROLE_INVALID;
   klass->get_accessible = gtk_widget_real_get_accessible;
 
@@ -1659,7 +1659,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                               G_TYPE_FROM_CLASS (klass),
                               _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECTv);
 
-  gtk_widget_class_set_accessible_type (klass, GTK_TYPE_WIDGET_ACCESSIBLE);
   gtk_widget_class_set_css_name (klass, I_("widget"));
 }
 
@@ -7934,44 +7933,26 @@ gtk_widget_real_get_accessible (GtkWidget *widget)
     {
       GtkWidgetClass *widget_class;
       GtkWidgetClassPrivate *priv;
-      AtkObjectFactory *factory;
-      AtkRegistry *default_registry;
 
       widget_class = GTK_WIDGET_GET_CLASS (widget);
       priv = widget_class->priv;
 
-      if (priv->accessible_type == GTK_TYPE_ACCESSIBLE)
-        {
-          default_registry = atk_get_default_registry ();
-          factory = atk_registry_get_factory (default_registry,
-                                              G_TYPE_FROM_INSTANCE (widget));
-          accessible = atk_object_factory_create_accessible (factory, G_OBJECT (widget));
-
-          if (priv->accessible_role != ATK_ROLE_INVALID)
-            atk_object_set_role (accessible, priv->accessible_role);
-
-          widget->priv->accessible = accessible;
-        }
-      else
-        {
-          accessible = g_object_new (priv->accessible_type,
-                                     "widget", widget,
-                                     NULL);
-          if (priv->accessible_role != ATK_ROLE_INVALID)
-            atk_object_set_role (accessible, priv->accessible_role);
+      accessible = g_object_new (priv->accessible_type,
+                                 "widget", widget,
+                                 NULL);
+      if (priv->accessible_role != ATK_ROLE_INVALID)
+        atk_object_set_role (accessible, priv->accessible_role);
 
-          widget->priv->accessible = accessible;
+      widget->priv->accessible = accessible;
 
-          atk_object_initialize (accessible, widget);
-
-          /* Set the role again, since we don't want a role set
-           * in some parent initialize() function to override
-           * our own.
-           */
-          if (priv->accessible_role != ATK_ROLE_INVALID)
-            atk_object_set_role (accessible, priv->accessible_role);
-        }
+      atk_object_initialize (accessible, widget);
 
+      /* Set the role again, since we don't want a role set
+       * in some parent initialize() function to override
+       * our own.
+       */
+      if (priv->accessible_role != ATK_ROLE_INVALID)
+        atk_object_set_role (accessible, priv->accessible_role);
     }
 
   return accessible;


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