a11y: Simplify GtkTextViewAccessible

Drop the GtkWidgetAccessible.notify_gtk override.
This commit is contained in:
Emmanuele Bassi 2020-05-28 15:46:42 +01:00
parent c3eafed472
commit 6f4ed6c105

View File

@ -67,6 +67,18 @@ G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TY
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)) G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init))
static void
on_editable_changed (GObject *gobject,
GParamSpec *pspec,
AtkObject *accessible)
{
GtkTextView *text_view = GTK_TEXT_VIEW (gobject);
atk_object_notify_state_change (accessible,
ATK_STATE_EDITABLE,
gtk_text_view_get_editable (text_view));
}
static void static void
gtk_text_view_accessible_initialize (AtkObject *obj, gtk_text_view_accessible_initialize (AtkObject *obj,
gpointer data) gpointer data)
@ -74,25 +86,10 @@ gtk_text_view_accessible_initialize (AtkObject *obj,
ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->initialize (obj, data); ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_TEXT; obj->role = ATK_ROLE_TEXT;
}
static void g_signal_connect (data, "notify::editable",
gtk_text_view_accessible_notify_gtk (GObject *obj, G_CALLBACK (on_editable_changed),
GParamSpec *pspec) obj);
{
AtkObject *atk_obj;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (obj));
if (!strcmp (pspec->name, "editable"))
{
gboolean editable;
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);
} }
static AtkStateSet* static AtkStateSet*
@ -167,15 +164,12 @@ gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass)
{ {
AtkObjectClass *class = ATK_OBJECT_CLASS (klass); AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_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_set = gtk_text_view_accessible_widget_set;
accessible_class->widget_unset = gtk_text_view_accessible_widget_unset; accessible_class->widget_unset = gtk_text_view_accessible_widget_unset;
class->ref_state_set = gtk_text_view_accessible_ref_state_set; class->ref_state_set = gtk_text_view_accessible_ref_state_set;
class->initialize = gtk_text_view_accessible_initialize; class->initialize = gtk_text_view_accessible_initialize;
widget_class->notify_gtk = gtk_text_view_accessible_notify_gtk;
} }
static void static void