[gtk+/composite-templates] a11y: Solved leak on gtk_widget_accessible_get_description
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] a11y: Solved leak on gtk_widget_accessible_get_description
- Date: Fri, 14 Sep 2012 21:30:36 +0000 (UTC)
commit 4742e76eba14bbdbcfbb070e15a1299b9dbe777c
Author: Alejandro PiÃeiro <apinheiro igalia com>
Date: Tue Sep 11 21:17:22 2012 +0200
a11y: Solved leak on gtk_widget_accessible_get_description
https://bugzilla.gnome.org/show_bug.cgi?id=643611
gtk/a11y/gtkwidgetaccessible.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
index c386eb3..b37232a 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -24,6 +24,8 @@
#include "gtkwidgetaccessible.h"
#include "gtknotebookpageaccessible.h"
+#define TOOLTIP_KEY "tooltip"
+
extern GtkWidget *_focus_widget;
@@ -107,6 +109,16 @@ gtk_widget_accessible_focus_event (AtkObject *obj,
}
static void
+gtk_widget_accessible_update_tooltip (GtkWidgetAccessible *accessible,
+ GtkWidget *widget)
+{
+ g_object_set_data_full (G_OBJECT (accessible),
+ TOOLTIP_KEY,
+ gtk_widget_get_tooltip_text (widget),
+ g_free);
+}
+
+static void
gtk_widget_accessible_initialize (AtkObject *obj,
gpointer data)
{
@@ -123,6 +135,8 @@ gtk_widget_accessible_initialize (AtkObject *obj,
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WIDGET;
obj->role = ATK_ROLE_UNKNOWN;
+
+ gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (obj), widget);
}
static const gchar *
@@ -137,7 +151,7 @@ gtk_widget_accessible_get_description (AtkObject *accessible)
if (accessible->description)
return accessible->description;
- return gtk_widget_get_tooltip_text (widget);
+ return g_object_get_data (G_OBJECT (accessible), TOOLTIP_KEY);
}
static AtkObject *
@@ -475,7 +489,11 @@ gtk_widget_accessible_notify_gtk (GObject *obj,
state = ATK_STATE_HORIZONTAL;
value = (gtk_orientable_get_orientation (orientable) == GTK_ORIENTATION_HORIZONTAL);
}
- else
+ else if (g_strcmp0 (pspec->name, "tooltip-text") == 0)
+ {
+ gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (atk_obj),
+ widget);
+ }
return;
atk_object_notify_state_change (atk_obj, state, value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]