[gtk+/wip/a11y: 4/10] a11y: Use notify_gtk signal for accessible-value notification



commit 0c6deef968d8f1e4ea2a5151f526fcde4195cf81
Author: Mike Gorse <mgorse suse com>
Date:   Thu Jan 10 15:59:49 2013 +0100

    a11y: Use notify_gtk signal for accessible-value notification
    
    ... instead of using a signal handler on the adjustment to essentially
    do the same thing.

 gtk/a11y/gtkspinbuttonaccessible.c |   34 ++--------------------------------
 1 files changed, 2 insertions(+), 32 deletions(-)
---
diff --git a/gtk/a11y/gtkspinbuttonaccessible.c b/gtk/a11y/gtkspinbuttonaccessible.c
index d344f4e..ff55f1e 100644
--- a/gtk/a11y/gtkspinbuttonaccessible.c
+++ b/gtk/a11y/gtkspinbuttonaccessible.c
@@ -28,34 +28,11 @@ G_DEFINE_TYPE_WITH_CODE (GtkSpinButtonAccessible, gtk_spin_button_accessible, GT
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
 
 static void
-gtk_spin_button_accessible_value_changed (GtkAdjustment *adjustment,
-                                          gpointer       data)
-{
-  GtkSpinButtonAccessible *spin_button;
-
-  if (adjustment == NULL || data == NULL)
-    return;
-
-  spin_button = GTK_SPIN_BUTTON_ACCESSIBLE (data);
-
-  g_object_notify (G_OBJECT (spin_button), "accessible-value");
-}
-
-static void
 gtk_spin_button_accessible_initialize (AtkObject *obj,
                                        gpointer  data)
 {
-  GtkAdjustment *adjustment;
-
   ATK_OBJECT_CLASS (gtk_spin_button_accessible_parent_class)->initialize (obj, data);
 
-  adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (data));
-  if (adjustment)
-    g_signal_connect (adjustment,
-                      "value-changed",
-                      G_CALLBACK (gtk_spin_button_accessible_value_changed),
-                      obj);
-
   obj->role = ATK_ROLE_SPIN_BUTTON;
 }
 
@@ -66,15 +43,8 @@ gtk_spin_button_accessible_notify_gtk (GObject    *obj,
   GtkWidget *widget = GTK_WIDGET (obj);
   GtkSpinButtonAccessible *spin_button = GTK_SPIN_BUTTON_ACCESSIBLE (gtk_widget_get_accessible (widget));
 
-  if (strcmp (pspec->name, "adjustment") == 0)
-    {
-      GtkAdjustment* adjustment;
-
-      adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
-      g_signal_connect (adjustment, "value-changed",
-                        G_CALLBACK (gtk_spin_button_accessible_value_changed),
-                        spin_button);
-    }
+  if (strcmp (pspec->name, "value") == 0)
+    g_object_notify (G_OBJECT (spin_button), "accessible-value");
   else
     GTK_WIDGET_ACCESSIBLE_CLASS (gtk_spin_button_accessible_parent_class)->notify_gtk (obj, pspec);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]