summaryrefslogtreecommitdiffstats
path: root/x11-toolkits/gtk20/files/patch-gtk_gtkscalebutton.c
blob: eb85ae27856e7b1fc296129106c16fb581835f97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
--- gtk/gtkscalebutton.c    2009/03/06 14:06:46 22478
+++ gtk/gtkscalebutton.c    2009/03/18 21:19:07 22574
@@ -119,6 +119,8 @@
                         guint                prop_id,
                         GValue              *value,
                         GParamSpec          *pspec);
+static void gtk_scale_button_set_orientation_private (GtkScaleButton *button,
+                                                      GtkOrientation  orientation);
 static gboolean    gtk_scale_button_scroll     (GtkWidget           *widget,
                         GdkEventScroll      *event);
 static void gtk_scale_button_screen_changed    (GtkWidget           *widget,
@@ -434,7 +436,7 @@
   switch (prop_id)
     {
     case PROP_ORIENTATION:
-      gtk_scale_button_set_orientation (button, g_value_get_enum (value));
+      gtk_scale_button_set_orientation_private (button, g_value_get_enum (value));
       break;
     case PROP_VALUE:
       gtk_scale_button_set_value (button, g_value_get_double (value));
@@ -739,54 +741,9 @@
 gtk_scale_button_set_orientation (GtkScaleButton *button,
                                   GtkOrientation  orientation)
 {
-  GtkScaleButtonPrivate *priv;
-
   g_return_if_fail (GTK_IS_SCALE_BUTTON (button));
 
-  priv = button->priv;
-
-  if (orientation != priv->orientation)
-    {
-      priv->orientation = orientation;
-
-      gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box),
-                                      orientation);
-      gtk_container_child_set (GTK_CONTAINER (priv->box),
-                               button->plus_button,
-                               "pack-type",
-                               orientation == GTK_ORIENTATION_VERTICAL ?
-                               GTK_PACK_START : GTK_PACK_END,
-                               NULL);
-      gtk_container_child_set (GTK_CONTAINER (priv->box),
-                               button->minus_button,
-                               "pack-type",
-                               orientation == GTK_ORIENTATION_VERTICAL ?
-                               GTK_PACK_END : GTK_PACK_START,
-                               NULL);
-
-      gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->scale),
-                                      orientation);
-
-      if (orientation == GTK_ORIENTATION_VERTICAL)
-        {
-          gtk_widget_set_size_request (GTK_WIDGET (priv->scale),
-                                       -1, SCALE_SIZE);
-          gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE);
-        }
-      else
-        {
-          gtk_widget_set_size_request (GTK_WIDGET (priv->scale),
-                                       SCALE_SIZE, -1);
-          gtk_range_set_inverted (GTK_RANGE (priv->scale), FALSE);
-        }
-
-      /* FIXME: without this, the popup window appears as a square
-       * after changing the orientation
-       */
-      gtk_window_resize (GTK_WINDOW (priv->dock), 1, 1);
-
-      g_object_notify (G_OBJECT (button), "orientation");
-    }
+  gtk_scale_button_set_orientation_private (button, orientation);
 }
 
 /**
@@ -843,6 +800,56 @@
   return button->priv->dock;
 }
 
+static void
+gtk_scale_button_set_orientation_private (GtkScaleButton *button,
+                                          GtkOrientation  orientation)
+{
+  GtkScaleButtonPrivate *priv = button->priv;
+
+  if (orientation != priv->orientation)
+    {
+      priv->orientation = orientation;
+
+      gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box),
+                                      orientation);
+      gtk_container_child_set (GTK_CONTAINER (priv->box),
+                               button->plus_button,
+                               "pack-type",
+                               orientation == GTK_ORIENTATION_VERTICAL ?
+                               GTK_PACK_START : GTK_PACK_END,
+                               NULL);
+      gtk_container_child_set (GTK_CONTAINER (priv->box),
+                               button->minus_button,
+                               "pack-type",
+                               orientation == GTK_ORIENTATION_VERTICAL ?
+                               GTK_PACK_END : GTK_PACK_START,
+                               NULL);
+
+      gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->scale),
+                                      orientation);
+
+      if (orientation == GTK_ORIENTATION_VERTICAL)
+        {
+          gtk_widget_set_size_request (GTK_WIDGET (priv->scale),
+                                       -1, SCALE_SIZE);
+          gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE);
+        }
+      else
+        {
+          gtk_widget_set_size_request (GTK_WIDGET (priv->scale),
+                                       SCALE_SIZE, -1);
+          gtk_range_set_inverted (GTK_RANGE (priv->scale), FALSE);
+        }
+
+      /* FIXME: without this, the popup window appears as a square
+       * after changing the orientation
+       */
+      gtk_window_resize (GTK_WINDOW (priv->dock), 1, 1);
+
+      g_object_notify (G_OBJECT (button), "orientation");
+    }
+}
+
 /*
  * button callbacks.
  */