[gtk/wip/ebassi/a11y-2: 434/442] a11y: Simplify GtkTextViewAccessible
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/a11y-2: 434/442] a11y: Simplify GtkTextViewAccessible
- Date: Fri, 5 Jun 2020 19:37:47 +0000 (UTC)
commit 6f4ed6c105f7e1f867d65fd5134b3e758d3a8ef6
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu May 28 15:46:42 2020 +0100
a11y: Simplify GtkTextViewAccessible
Drop the GtkWidgetAccessible.notify_gtk override.
gtk/a11y/gtktextviewaccessible.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
---
diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c
index 109d56bc17..9962c23607 100644
--- a/gtk/a11y/gtktextviewaccessible.c
+++ b/gtk/a11y/gtktextviewaccessible.c
@@ -68,31 +68,28 @@ G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TY
static void
-gtk_text_view_accessible_initialize (AtkObject *obj,
- gpointer data)
+on_editable_changed (GObject *gobject,
+ GParamSpec *pspec,
+ AtkObject *accessible)
{
- ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->initialize (obj, data);
+ GtkTextView *text_view = GTK_TEXT_VIEW (gobject);
- obj->role = ATK_ROLE_TEXT;
+ atk_object_notify_state_change (accessible,
+ ATK_STATE_EDITABLE,
+ gtk_text_view_get_editable (text_view));
}
static void
-gtk_text_view_accessible_notify_gtk (GObject *obj,
- GParamSpec *pspec)
+gtk_text_view_accessible_initialize (AtkObject *obj,
+ gpointer data)
{
- AtkObject *atk_obj;
-
- atk_obj = gtk_widget_get_accessible (GTK_WIDGET (obj));
+ ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->initialize (obj, data);
- if (!strcmp (pspec->name, "editable"))
- {
- gboolean editable;
+ obj->role = ATK_ROLE_TEXT;
- editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (obj));
- atk_object_notify_state_change (atk_obj, ATK_STATE_EDITABLE, editable);
- }
- else
- GTK_WIDGET_ACCESSIBLE_CLASS (gtk_text_view_accessible_parent_class)->notify_gtk (obj, pspec);
+ g_signal_connect (data, "notify::editable",
+ G_CALLBACK (on_editable_changed),
+ obj);
}
static AtkStateSet*
@@ -167,15 +164,12 @@ gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass);
- GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
accessible_class->widget_set = gtk_text_view_accessible_widget_set;
accessible_class->widget_unset = gtk_text_view_accessible_widget_unset;
class->ref_state_set = gtk_text_view_accessible_ref_state_set;
class->initialize = gtk_text_view_accessible_initialize;
-
- widget_class->notify_gtk = gtk_text_view_accessible_notify_gtk;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]