[gucharmap] Adapt GucharmapChartableAccessible to the GTK3 GtkScrollable interface.



commit b25451e8b700af0e0927e8ec1460c4913f154e9e
Author: Daiki Ueno <ueno unixuser org>
Date:   Thu Mar 31 12:00:56 2011 +0900

    Adapt GucharmapChartableAccessible to the GTK3 GtkScrollable interface.

 gucharmap/gucharmap-chartable-accessible.c |   30 ++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gucharmap/gucharmap-chartable-accessible.c b/gucharmap/gucharmap-chartable-accessible.c
index 597e1d6..845646e 100644
--- a/gucharmap/gucharmap-chartable-accessible.c
+++ b/gucharmap/gucharmap-chartable-accessible.c
@@ -444,6 +444,26 @@ gucharmap_chartable_accessible_set_scroll_adjustments (GucharmapChartable *chart
 }
 
 static void
+sync_adjustment (GucharmapChartable           *chartable,
+                 GParamSpec                   *pspec,
+                 GucharmapChartableAccessible *accessible)
+{
+  GtkAdjustment *hadjustment, *vadjustment;
+
+  g_object_get (chartable,
+                "hadjustment", &hadjustment,
+                "vadjustment", &vadjustment,
+                NULL);
+  /* hadjustment and vadjustment are set to NULL in
+     gtk_scrolled_window_remove() */
+  if (hadjustment && vadjustment)
+    gucharmap_chartable_accessible_set_scroll_adjustments (chartable,
+                                                           hadjustment,
+                                                           vadjustment,
+                                                           accessible);
+}
+
+static void
 gucharmap_chartable_accessible_initialize (AtkObject *obj,
                                            gpointer  data)
 {
@@ -473,9 +493,16 @@ gucharmap_chartable_accessible_initialize (AtkObject *obj,
                         G_CALLBACK (adjustment_changed), obj);
     }
 
+#if GTK_CHECK_VERSION (2, 91, 2)
+  g_signal_connect_after (chartable, "notify::hadjustment",
+                          G_CALLBACK (sync_adjustment), obj);
+  g_signal_connect_after (chartable, "notify::vadjustment",
+                          G_CALLBACK (sync_adjustment), obj);
+#else
   g_signal_connect_after (chartable, "set-scroll-adjustments",
                           G_CALLBACK (gucharmap_chartable_accessible_set_scroll_adjustments),
                           obj);
+#endif  /* GTK3 */
   g_signal_connect (widget, "size-allocate",
                     G_CALLBACK (size_allocated), obj);
   g_signal_connect (chartable, "notify::active-character",
@@ -512,6 +539,9 @@ gucharmap_chartable_accessible_destroyed (GtkWidget *widget,
                                         G_CALLBACK (gucharmap_chartable_accessible_set_scroll_adjustments),
                                         obj);
   g_signal_handlers_disconnect_by_func (widget,
+					G_CALLBACK (sync_adjustment),
+					obj);
+  g_signal_handlers_disconnect_by_func (widget,
                                         G_CALLBACK (size_allocated),
                                         obj);
   g_signal_handlers_disconnect_by_func (widget,



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