[gimp] app: set GimpHandleBar's lower and upper bounds in the adjustment callback



commit 63ff0fc77bb88b9443b18fa4e44f745e8e2f87e6
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 7 21:40:35 2012 +0200

    app: set GimpHandleBar's lower and upper bounds in the adjustment callback
    
    so it keeps working correctly when the adjustments get reconfigured.

 app/widgets/gimphandlebar.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/app/widgets/gimphandlebar.c b/app/widgets/gimphandlebar.c
index 5bfab70..01d76fe 100644
--- a/app/widgets/gimphandlebar.c
+++ b/app/widgets/gimphandlebar.c
@@ -328,28 +328,21 @@ gimp_handle_bar_set_adjustment (GimpHandleBar  *bar,
       bar->slider_adj[handle_no] = NULL;
     }
 
-    bar->slider_adj[handle_no] = adjustment;
+  bar->slider_adj[handle_no] = adjustment;
 
-    if (bar->slider_adj[handle_no])
-      {
-        g_object_ref (bar->slider_adj[handle_no]);
-
-        g_signal_connect (bar->slider_adj[handle_no], "value-changed",
-                          G_CALLBACK (gimp_handle_bar_adjustment_changed),
-                          bar);
-      }
-
-    if (bar->slider_adj[0])
-      bar->lower = gtk_adjustment_get_lower (bar->slider_adj[0]);
-    else
-      bar->lower = gtk_adjustment_get_lower (bar->slider_adj[handle_no]);
-
-    if (bar->slider_adj[2])
-      bar->upper = gtk_adjustment_get_upper (bar->slider_adj[2]);
-    else
-      bar->upper = gtk_adjustment_get_upper (bar->slider_adj[handle_no]);
+  if (bar->slider_adj[handle_no])
+    {
+      g_object_ref (bar->slider_adj[handle_no]);
+
+      g_signal_connect (bar->slider_adj[handle_no], "value-changed",
+                        G_CALLBACK (gimp_handle_bar_adjustment_changed),
+                        bar);
+      g_signal_connect (bar->slider_adj[handle_no], "changed",
+                        G_CALLBACK (gimp_handle_bar_adjustment_changed),
+                        bar);
+    }
 
-    gimp_handle_bar_adjustment_changed (bar->slider_adj[handle_no], bar);
+  gimp_handle_bar_adjustment_changed (bar->slider_adj[handle_no], bar);
 }
 
 
@@ -359,5 +352,11 @@ static void
 gimp_handle_bar_adjustment_changed (GtkAdjustment *adjustment,
                                     GimpHandleBar *bar)
 {
+  if (bar->slider_adj[0])
+    bar->lower = gtk_adjustment_get_lower (bar->slider_adj[0]);
+
+  if (bar->slider_adj[2])
+    bar->upper = gtk_adjustment_get_upper (bar->slider_adj[2]);
+
   gtk_widget_queue_draw (GTK_WIDGET (bar));
 }



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