[gtk/wip/baedert/for-master: 14/24] range: Inline function into only caller



commit 5bcae332c17b3c728007b6c28a787f58e1747a46
Author: Timm Bäder <mail baedert org>
Date:   Sat Feb 22 14:11:05 2020 +0100

    range: Inline function into only caller

 gtk/gtkrange.c | 29 +++++++++--------------------
 1 file changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index a57963b4c8..bb31898e9b 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -204,7 +204,6 @@ static void          gtk_range_compute_slider_position  (GtkRange      *range,
                                                          GdkRectangle  *slider_rect);
 static gboolean      gtk_range_scroll                   (GtkRange      *range,
                                                          GtkScrollType  scroll);
-static void          gtk_range_calc_slider              (GtkRange      *range);
 static void          gtk_range_calc_marks               (GtkRange      *range);
 static void          gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
                                                          gpointer       data);
@@ -2299,11 +2298,18 @@ gtk_range_drag_gesture_begin (GtkGestureDrag *gesture,
 
 static void
 gtk_range_adjustment_changed (GtkAdjustment *adjustment,
-                             gpointer       data)
+                              gpointer       data)
 {
   GtkRange *range = GTK_RANGE (data);
+  GtkRangePrivate *priv = gtk_range_get_instance_private (range);
+
+  if (gtk_adjustment_get_upper (priv->adjustment) == gtk_adjustment_get_lower (priv->adjustment) &&
+      GTK_IS_SCALE (range))
+    gtk_widget_hide (priv->slider_widget);
+  else
+    gtk_widget_show (priv->slider_widget);
 
-  gtk_range_calc_slider (range);
+  gtk_widget_queue_allocate (priv->trough_widget);
 
   /* Note that we don't round off to priv->round_digits here.
    * that's because it's really broken to change a value
@@ -2636,23 +2642,6 @@ gtk_range_compute_slider_position (GtkRange     *range,
     }
 }
 
-static void
-gtk_range_calc_slider (GtkRange *range)
-{
-  GtkRangePrivate *priv = gtk_range_get_instance_private (range);
-  gboolean visible;
-
-  if (GTK_IS_SCALE (range) &&
-      gtk_adjustment_get_upper (priv->adjustment) == gtk_adjustment_get_lower (priv->adjustment))
-    visible = FALSE;
-  else
-    visible = TRUE;
-
-  gtk_widget_set_visible (priv->slider_widget, visible);
-
-  gtk_widget_queue_allocate (priv->trough_widget);
-}
-
 static void
 gtk_range_calc_marks (GtkRange *range)
 {


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