[gtk/wip/ebassi/a11y-2: 431/442] a11y: Simplify GtkWindowAccessible
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/a11y-2: 431/442] a11y: Simplify GtkWindowAccessible
- Date: Fri, 5 Jun 2020 19:37:32 +0000 (UTC)
commit 24e8b484e034b760a3fc3615f8de328fac33376e
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu May 28 14:02:04 2020 +0100
a11y: Simplify GtkWindowAccessible
Have GtkWindow notify of title changes, instead of overriding
GtkWidgetAccessible.notify_gtk.
gtk/a11y/gtkwindowaccessible.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c
index b25eeffb96..6485cf8e69 100644
--- a/gtk/a11y/gtkwindowaccessible.c
+++ b/gtk/a11y/gtkwindowaccessible.c
@@ -61,19 +61,14 @@ gtk_window_accessible_focus_event (AtkObject *obj,
}
static void
-gtk_window_accessible_notify_gtk (GObject *obj,
- GParamSpec *pspec)
+on_title_changed (GObject *gobject,
+ GParamSpec *pspec,
+ GtkWindowAccessible *self)
{
- GtkWidget *widget = GTK_WIDGET (obj);
- AtkObject* atk_obj = gtk_widget_get_accessible (widget);
+ AtkObject *atk_obj = ATK_OBJECT (self);
- if (g_strcmp0 (pspec->name, "title") == 0)
- {
- g_object_notify (G_OBJECT (atk_obj), "accessible-name");
- g_signal_emit_by_name (atk_obj, "visible-data-changed");
- }
- else
- GTK_WIDGET_ACCESSIBLE_CLASS (gtk_window_accessible_parent_class)->notify_gtk (obj, pspec);
+ g_object_notify (G_OBJECT (atk_obj), "accessible-name");
+ g_signal_emit_by_name (atk_obj, "visible-data-changed");
}
static const gchar *
@@ -244,14 +239,21 @@ gtk_window_accessible_ref_child (AtkObject *object,
return NULL;
}
+static void
+gtk_window_accessible_initialize (AtkObject *object,
+ gpointer data)
+{
+ GtkWidget *window = data;
+
+ g_signal_connect (window, "notify::title", G_CALLBACK (on_title_changed), object);
+}
+
static void
gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
{
- GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- widget_class->notify_gtk = gtk_window_accessible_notify_gtk;
-
+ class->initialize = gtk_window_accessible_initialize;
class->get_name = gtk_window_accessible_get_name;
class->get_index_in_parent = gtk_window_accessible_get_index_in_parent;
class->ref_relation_set = gtk_window_accessible_ref_relation_set;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]