[gtk+/a11y] GtkLabelAccessible: remove broken workarounds
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/a11y] GtkLabelAccessible: remove broken workarounds
- Date: Thu, 23 Jun 2011 21:59:31 +0000 (UTC)
commit 535785ccb31391c7f4e836aedf55c98788f1ab81
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 23 17:54:07 2011 -0400
GtkLabelAccessible: remove broken workarounds
This removes a horrible workaround for bug 126797. To prevent
picking up accidental markup in label texts, the label accessible
is listening for window creation and mapping and defers initializing
its text until then.
gtk/a11y/gtklabelaccessible.c | 65 +++-------------------------------------
gtk/a11y/gtklabelaccessible.h | 2 -
2 files changed, 5 insertions(+), 62 deletions(-)
---
diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c
index e3ccfd1..7c4defe 100644
--- a/gtk/a11y/gtklabelaccessible.c
+++ b/gtk/a11y/gtklabelaccessible.c
@@ -23,7 +23,6 @@
#include <gtk/gtk.h>
#include "gtklabelaccessible.h"
-#include "gailwindow.h"
#include <libgail-util/gailmisc.h>
static void gtk_label_accessible_class_init (GtkLabelAccessibleClass *klass);
@@ -32,8 +31,6 @@ static void gtk_label_accessible_real_initialize (AtkObject *obj,
gpointer data);
static void gtk_label_accessible_real_notify_gtk (GObject *obj,
GParamSpec *pspec);
-static void gtk_label_accessible_map_gtk (GtkWidget *widget,
- gpointer data);
static void gtk_label_accessible_init_text_util (GtkLabelAccessible *gail_label,
GtkWidget *widget);
static void gtk_label_accessible_finalize (GObject *object);
@@ -142,8 +139,6 @@ gtk_label_accessible_real_initialize (AtkObject *obj,
accessible = GTK_LABEL_ACCESSIBLE (obj);
- accessible->window_create_handler = 0;
- accessible->has_top_level = FALSE;
accessible->cursor_position = 0;
accessible->selection_bound = 0;
accessible->textutil = NULL;
@@ -151,12 +146,7 @@ gtk_label_accessible_real_initialize (AtkObject *obj,
widget = GTK_WIDGET (data);
- if (gtk_widget_get_mapped (widget))
- gtk_label_accessible_init_text_util (accessible, widget);
- else
- g_signal_connect (widget, "map",
- G_CALLBACK (gtk_label_accessible_map_gtk),
- accessible);
+ gtk_label_accessible_init_text_util (accessible, widget);
/*
* Check whether ancestor of GtkLabel is a GtkButton and if so
@@ -179,16 +169,6 @@ gtk_label_accessible_real_initialize (AtkObject *obj,
}
static void
-gtk_label_accessible_map_gtk (GtkWidget *widget,
- gpointer data)
-{
- GtkLabelAccessible *accessible;
-
- accessible = GTK_LABEL_ACCESSIBLE (data);
- gtk_label_accessible_init_text_util (accessible, widget);
-}
-
-static void
gtk_label_accessible_init_text_util (GtkLabelAccessible *accessible,
GtkWidget *widget)
{
@@ -271,15 +251,6 @@ notify_name_change (AtkObject *atk_obj)
}
static void
-window_created (GObject *obj,
- gpointer data)
-{
- g_return_if_fail (GTK_LABEL_ACCESSIBLE (data));
-
- notify_name_change (ATK_OBJECT (data));
-}
-
-static void
gtk_label_accessible_real_notify_gtk (GObject *obj,
GParamSpec *pspec)
{
@@ -288,40 +259,14 @@ gtk_label_accessible_real_notify_gtk (GObject *obj,
GtkLabel *label;
GtkLabelAccessible *accessible;
GObject *gail_obj;
- AtkObject *top_level;
- AtkObject *temp_obj;
accessible = GTK_LABEL_ACCESSIBLE (atk_obj);
- if (strcmp (pspec->name, "label") == 0)
+ if (strcmp (pspec->name, "label") == 0 ||
+ strcmp (pspec->name, "use-underline") == 0 ||
+ strcmp (pspec->name, "use-markup") == 0)
{
- /*
- * We may get a label change for a label which is not attached to an
- * application. We wait until the toplevel window is created before
- * emitting the notification.
- *
- * This happens when [Ctrl+]Alt+Tab is pressed in metacity
- */
- if (!accessible->has_top_level)
- {
- temp_obj = atk_obj;
- top_level = NULL;
- while (temp_obj)
- {
- top_level = temp_obj;
- temp_obj = atk_object_get_parent (top_level);
- }
- if (atk_object_get_role (top_level) != ATK_ROLE_APPLICATION)
- {
- if (accessible->window_create_handler == 0 &&
- GAIL_IS_WINDOW (top_level))
- accessible->window_create_handler = g_signal_connect_after (top_level, "create", G_CALLBACK (window_created), atk_obj);
- }
- else
- accessible->has_top_level = TRUE;
- }
- if (accessible->has_top_level)
- notify_name_change (atk_obj);
+ notify_name_change (atk_obj);
}
else if (strcmp (pspec->name, "cursor-position") == 0)
{
diff --git a/gtk/a11y/gtklabelaccessible.h b/gtk/a11y/gtklabelaccessible.h
index 58a60f0..af054c2 100644
--- a/gtk/a11y/gtklabelaccessible.h
+++ b/gtk/a11y/gtklabelaccessible.h
@@ -43,8 +43,6 @@ struct _GtkLabelAccessible
gint cursor_position;
gint selection_bound;
gint label_length;
- gulong window_create_handler;
- gboolean has_top_level;
};
struct _GtkLabelAccessibleClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]