From 83c74ff7d055692d3e1310a0d87bedc6a6a52607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 26 Feb 2018 20:23:45 +0100 Subject: [PATCH] spinbutton: Fold function into only caller --- gtk/gtkspinbutton.c | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 58d0587822..c7ee077c04 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -720,28 +720,6 @@ scroll_controller_scroll (GtkEventControllerScroll *Scroll, gtk_spin_button_real_spin (spin, -dy * gtk_adjustment_get_step_increment (priv->adjustment)); } -static void -update_node_ordering (GtkSpinButton *spin_button) -{ - GtkSpinButtonPrivate *priv = spin_button->priv; - - g_assert (priv->orientation != gtk_orientable_get_orientation (GTK_ORIENTABLE (priv->box))); - - if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) - { - /* Current orientation of the box is vertical! */ - gtk_box_reorder_child (GTK_BOX (priv->box), priv->entry, 0); - gtk_box_reorder_child (GTK_BOX (priv->box), priv->down_button, 1); - } - else - { - /* Current orientation of the box is horizontal! */ - gtk_box_reorder_child (GTK_BOX (priv->box), priv->up_button, 0); - } - - gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), priv->orientation); -} - static gboolean gtk_spin_button_stop_spinning (GtkSpinButton *spin) { @@ -1032,10 +1010,21 @@ gtk_spin_button_set_orientation (GtkSpinButton *spin, gtk_entry_get_alignment (entry) == 0.5) gtk_entry_set_alignment (entry, 0.0); - update_node_ordering (spin); + if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) + { + /* Current orientation of the box is vertical! */ + gtk_box_reorder_child (GTK_BOX (priv->box), priv->entry, 0); + gtk_box_reorder_child (GTK_BOX (priv->box), priv->down_button, 1); + } + else + { + /* Current orientation of the box is horizontal! */ + gtk_box_reorder_child (GTK_BOX (priv->box), priv->up_button, 0); + } + + gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), priv->orientation); g_object_notify (G_OBJECT (spin), "orientation"); - gtk_widget_queue_resize (GTK_WIDGET (spin)); } static gchar *