[gtk/a11y/label-name: 2/3] atspi: Use name and description as provided




commit 77d1026c5a56e7dc47721cd98ce29b39864bb8d8
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 19 14:57:43 2020 -0400

    atspi: Use name and description as provided
    
    GtkATContext already does fallbacks to derive values
    for these, so no need for the atspi implementation to
    do its own fallback on top of that.

 gtk/a11y/gtkatspicontext.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 1a2434ff7c..6c3810a1fd 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -592,29 +592,14 @@ handle_accessible_get_property (GDBusConnection       *connection,
 
   if (g_strcmp0 (property_name, "Name") == 0)
     {
-      if (GTK_IS_WIDGET (accessible))
-        res = g_variant_new_string (gtk_widget_get_name (GTK_WIDGET (accessible)));
-      else if (GTK_IS_STACK_PAGE (accessible))
-        {
-          const char *name = gtk_stack_page_get_name (GTK_STACK_PAGE (accessible));
-          if (name == NULL)
-             name = G_OBJECT_TYPE_NAME (accessible);
-          res = g_variant_new_string (name);
-        }
-      else
-        res = g_variant_new_string (G_OBJECT_TYPE_NAME (accessible));
+      char *label = gtk_at_context_get_name (GTK_AT_CONTEXT (self));
+      res = g_variant_new_string (label ? label : "");
+      g_free (label);
     }
   else if (g_strcmp0 (property_name, "Description") == 0)
     {
       char *label = gtk_at_context_get_description (GTK_AT_CONTEXT (self));
-
-      if (label == NULL || *label == '\0')
-        {
-          g_free (label);
-          label = gtk_at_context_get_name (GTK_AT_CONTEXT (self));
-        }
-
-      res = g_variant_new_string (label);
+      res = g_variant_new_string (label ? label : "");
       g_free (label);
     }
   else if (g_strcmp0 (property_name, "Locale") == 0)


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