summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff252
1 files changed, 252 insertions, 0 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff b/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff
new file mode 100644
index 0000000000..b99d346f4b
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktoolbar.c.diff
@@ -0,0 +1,252 @@
1--- gtk+-2.6.4/gtk/gtktoolbar.c 2004-11-23 06:11:15.000000000 +0200
2+++ gtk+-2.6.4/gtk/gtktoolbar.c 2005-04-06 16:19:38.166736136 +0300
3@@ -67,7 +67,9 @@
4
5 #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
6 #define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH
7+#define DEFAULT_ANIMATION_STATE FALSE
8
9+#define DEFAULT_MAX_CHILD_SPACING G_MAXINT
10 #define MAX_HOMOGENEOUS_N_CHARS 13 /* Items that are wider than this do not participate
11 * in the homogeneous game. In units of
12 * pango_font_get_estimated_char_width().
13@@ -140,10 +142,14 @@
14
15 GTimer * timer;
16
17+ guint animation_connection;
18+
19 guint show_arrow : 1;
20 guint need_sync : 1;
21 guint is_sliding : 1;
22 guint need_rebuild : 1; /* whether the overflow menu should be regenerated */
23+ guint animation_set : 1;
24+ guint animation : 1;
25 };
26
27 static void gtk_toolbar_init (GtkToolbar *toolbar);
28@@ -225,9 +231,11 @@
29 static void gtk_toolbar_reconfigured (GtkToolbar *toolbar);
30 static gboolean gtk_toolbar_check_new_api (GtkToolbar *toolbar);
31 static gboolean gtk_toolbar_check_old_api (GtkToolbar *toolbar);
32+static void gtk_toolbar_update_animation_state (GtkToolbar *toolbar);
33
34 static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
35 static gint get_internal_padding (GtkToolbar *toolbar);
36+static gint get_max_child_expand (GtkToolbar *toolbar);
37 static GtkShadowType get_shadow_type (GtkToolbar *toolbar);
38 static gint get_space_size (GtkToolbar *toolbar);
39 static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
40@@ -563,6 +571,15 @@
41 G_PARAM_READABLE));
42
43 gtk_widget_class_install_style_property (widget_class,
44+ g_param_spec_int ("max_child_expand",
45+ P_("Maximum toolbar item spacing"),
46+ P_("Maximum space between the toolbar items."),
47+ 0,
48+ G_MAXINT,
49+ DEFAULT_MAX_CHILD_SPACING,
50+ G_PARAM_READABLE));
51+
52+ gtk_widget_class_install_style_property (widget_class,
53 g_param_spec_enum ("space_style",
54 P_("Space style"),
55 P_("Whether spacers are vertical lines or just blank"),
56@@ -598,6 +615,12 @@
57 GTK_TYPE_ICON_SIZE,
58 DEFAULT_ICON_SIZE,
59 G_PARAM_READWRITE));
60+
61+ gtk_settings_install_property (g_param_spec_boolean ("gtk-toolbar-animation",
62+ P_("Toolbar animation"),
63+ P_("Are we using toolbar animation"),
64+ DEFAULT_ANIMATION_STATE,
65+ G_PARAM_READWRITE));
66
67 binding_set = gtk_binding_set_by_class (klass);
68
69@@ -638,6 +661,7 @@
70 toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
71 toolbar->style = DEFAULT_TOOLBAR_STYLE;
72 toolbar->icon_size = DEFAULT_ICON_SIZE;
73+ priv->animation = DEFAULT_ANIMATION_STATE;
74 toolbar->tooltips = gtk_tooltips_new ();
75 g_object_ref (toolbar->tooltips);
76 gtk_object_sink (GTK_OBJECT (toolbar->tooltips));
77@@ -960,7 +984,7 @@
78 }
79
80 static gint
81-position (gint from, gint to, gdouble elapsed)
82+position (GtkToolbar *toolbar, gint from, gint to, gdouble elapsed)
83 {
84 gint n_pixels;
85
86@@ -978,11 +1002,20 @@
87 n_pixels = (SLIDE_SPEED / ACCEL_THRESHOLD) * elapsed * elapsed -
88 SLIDE_SPEED * elapsed + SLIDE_SPEED * ACCEL_THRESHOLD;
89 }
90-
91- if (to > from)
92- return MIN (from + n_pixels, to);
93- else
94- return MAX (from - n_pixels, to);
95+ if (GTK_TOOLBAR_GET_PRIVATE (toolbar)->animation) {
96+ if (to > from)
97+ return MIN (from + n_pixels, to);
98+ else
99+ return MAX (from - n_pixels, to);
100+ }
101+ return to;
102+}
103+
104+static GtkSettings *
105+toolbar_get_settings (GtkToolbar *toolbar)
106+{
107+ GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
108+ return priv->settings;
109 }
110
111 static void
112@@ -994,12 +1027,12 @@
113 GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
114 gdouble elapsed = g_timer_elapsed (priv->timer, NULL);
115
116- intermediate->x = position (start->x, goal->x, elapsed);
117- intermediate->y = position (start->y, goal->y, elapsed);
118+ intermediate->x = position (toolbar, start->x, goal->x, elapsed);
119+ intermediate->y = position (toolbar, start->y, goal->y, elapsed);
120 intermediate->width =
121- position (start->x + start->width, goal->x + goal->width, elapsed) - intermediate->x;
122+ position (toolbar, start->x + start->width, goal->x + goal->width, elapsed) - intermediate->x;
123 intermediate->height =
124- position (start->y + start->height, goal->y + goal->height, elapsed) - intermediate->y;
125+ position (toolbar, start->y + start->height, goal->y + goal->height, elapsed) - intermediate->y;
126 }
127
128 static void
129@@ -1047,6 +1080,32 @@
130 }
131 }
132
133+static void
134+gtk_toolbar_update_animation_state (GtkToolbar *toolbar)
135+{
136+ gboolean animation_state;
137+ GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
138+
139+ g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
140+
141+ if (priv->animation_set)
142+ {
143+ GtkSettings *settings = toolbar_get_settings (toolbar);
144+
145+ if (settings)
146+ {
147+ g_object_get (settings,
148+ "gtk-toolbar-animation", &animation_state,
149+ NULL);
150+ }
151+ else
152+ animation_state = DEFAULT_ANIMATION_STATE;
153+
154+ priv->animation = animation_state;
155+ priv->animation_set = FALSE;
156+ }
157+}
158+
159 static gboolean
160 slide_idle_handler (gpointer data)
161 {
162@@ -1537,10 +1596,14 @@
163
164 if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
165 {
166+ gint mexpand = get_max_child_expand(toolbar);
167 gint extra = size / n_expand_items;
168 if (size % n_expand_items != 0)
169 extra++;
170-
171+ if (extra > mexpand) {
172+ extra = mexpand;
173+ }
174+
175 allocations[i].width += extra;
176 size -= extra;
177 n_expand_items--;
178@@ -1932,11 +1995,16 @@
179 }
180 }
181
182-static GtkSettings *
183-toolbar_get_settings (GtkToolbar *toolbar)
184+static void
185+animation_change_notify (GtkToolbar *toolbar)
186 {
187 GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
188- return priv->settings;
189+ if (!priv->animation_set)
190+ {
191+ /* pretend it was set, then unset, thus reverting to new default */
192+ priv->animation_set = TRUE;
193+ gtk_toolbar_update_animation_state (toolbar);
194+ }
195 }
196
197 static void
198@@ -1960,6 +2028,7 @@
199 {
200 g_signal_handler_disconnect (old_settings, toolbar->style_set_connection);
201 g_signal_handler_disconnect (old_settings, toolbar->icon_size_connection);
202+ g_signal_handler_disconnect (old_settings, priv->animation_connection);
203
204 g_object_unref (old_settings);
205 }
206@@ -1976,6 +2045,11 @@
207 "notify::gtk-toolbar-icon-size",
208 G_CALLBACK (icon_size_change_notify),
209 toolbar);
210+ priv->animation_connection =
211+ g_signal_connect_swapped (settings,
212+ "notify::gtk-toolbar-animation",
213+ G_CALLBACK (animation_change_notify),
214+ toolbar);
215
216 g_object_ref (settings);
217 priv->settings = settings;
218@@ -1985,6 +2059,7 @@
219
220 style_change_notify (toolbar);
221 icon_size_change_notify (toolbar);
222+ animation_change_notify (toolbar);
223 }
224
225 static int
226@@ -2913,7 +2988,7 @@
227 * gtk_toolbar_get_icon_size:
228 * @toolbar: a #GtkToolbar
229 *
230- * Retrieves the icon size fo the toolbar. See gtk_toolbar_set_icon_size().
231+ * Retrieves the icon size for the toolbar. See gtk_toolbar_set_icon_size().
232 *
233 * Return value: the current icon size for the icons on the toolbar.
234 **/
235@@ -4642,6 +4717,17 @@
236 return ipadding;
237 }
238
239+static gint
240+get_max_child_expand (GtkToolbar *toolbar)
241+{
242+ gint mexpand = DEFAULT_MAX_CHILD_SPACING;
243+
244+ gtk_widget_style_get (GTK_WIDGET (toolbar),
245+ "max_child_expand", &mexpand,
246+ NULL);
247+ return mexpand;
248+}
249+
250 static GtkShadowType
251 get_shadow_type (GtkToolbar *toolbar)
252 {