Merge lp:~unity-team/unity/collapsing-place-groups into lp:unity
- collapsing-place-groups
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 370 |
Proposed branch: | lp:~unity-team/unity/collapsing-place-groups |
Merge into: | lp:unity |
Prerequisite: | lp:~unity-team/unity/njpatel-2010-07-02-bug-fixes |
Diff against target: |
741 lines (+395/-78) 11 files modified
.bzrignore (+1/-0) unity-private/places/places-default-renderer-group.vala (+138/-36) unity-private/places/places-default-renderer.vala (+1/-1) unity-private/places/places-place-search-bar.vala (+6/-1) unity-private/places/places-place-search-entry.vala (+14/-11) unity-private/places/places-view.vala (+4/-1) unity-private/testing/test-window.vala (+3/-0) unity/Makefile.am (+1/-0) unity/unity-expanding-bin.vala (+179/-0) unity/unity-pixbuf-cache.vala (+42/-28) vapi/clutk-0.3.vapi (+6/-0) |
To merge this branch: | bzr merge lp:~unity-team/unity/collapsing-place-groups |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jay Taoko (community) | Approve | ||
Review via email: mp+29371@code.launchpad.net |
Commit message
Description of the change
- Add an expandable bin actor that had three states, CLOSED (hidden), UNEXPANDED (open to a certian height) and EXPANDED (open to the height requested by children). It animates between the three states
- Add support for the auto-fade iconview property
- Adds incredibly lazy icon and text loading by deferring loading to the last possible point. Using the new api from the iconview, the DefaultRenderer
- There are lot's of other fixes for places
**** YOU REQUIRE lp:~unity-team/clutk/icon-view-auto-fade-children FOR THIS TO WORK PROPERLY ****
Neil J. Patel (njpatel) wrote : | # |
Jay Taoko (jaytaoko) wrote : | # |
Tested and Approved!
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-07-07 09:12:51 +0000 |
3 | +++ .bzrignore 2010-07-07 09:12:51 +0000 |
4 | @@ -321,3 +321,4 @@ |
5 | tests/unit/test-io.c |
6 | unity/unity-appinfo-manager.c |
7 | unity/unity-io.c |
8 | +unity/unity-expanding-bin.c |
9 | |
10 | === modified file 'unity-private/places/places-default-renderer-group.vala' |
11 | --- unity-private/places/places-default-renderer-group.vala 2010-07-07 09:12:51 +0000 |
12 | +++ unity-private/places/places-default-renderer-group.vala 2010-07-07 09:12:51 +0000 |
13 | @@ -19,9 +19,9 @@ |
14 | |
15 | namespace Unity.Places |
16 | { |
17 | - public class DefaultRendererGroup : Ctk.Box |
18 | + public class DefaultRendererGroup : ExpandingBin |
19 | { |
20 | - static const float PADDING = 0.0f; |
21 | + static const float PADDING = 24.0f; |
22 | static const int SPACING = 0; |
23 | |
24 | public uint group_id { get; construct; } |
25 | @@ -30,12 +30,17 @@ |
26 | public string icon_hint { get; construct; } |
27 | public Dee.Model results { get; construct; } |
28 | |
29 | + private Ctk.VBox vbox; |
30 | private Ctk.HBox title_box; |
31 | private Ctk.Image icon; |
32 | private Ctk.Text text; |
33 | private Ctk.Image expander; |
34 | private Ctk.IconView renderer; |
35 | |
36 | + /* Some caching to speed up lookups */ |
37 | + private uint n_results = 0; |
38 | + private bool dirty = false; |
39 | + |
40 | public DefaultRendererGroup (uint group_id, |
41 | string group_renderer, |
42 | string display_name, |
43 | @@ -51,17 +56,22 @@ |
44 | |
45 | construct |
46 | { |
47 | - padding = { PADDING, PADDING, PADDING , PADDING}; |
48 | - orientation = Ctk.Orientation.VERTICAL; |
49 | - spacing = SPACING; |
50 | - homogeneous = false; |
51 | + padding = { 0.0f, 0.0f, PADDING , 0.0f}; |
52 | hide (); |
53 | |
54 | - title_box = new Ctk.HBox (8); |
55 | - pack (title_box, false, false); |
56 | + vbox = new Ctk.VBox (SPACING); |
57 | + vbox.spacing = SPACING; |
58 | + vbox.homogeneous = false; |
59 | + add_actor (vbox); |
60 | + vbox.show (); |
61 | + |
62 | + title_box = new Ctk.HBox (5); |
63 | + vbox.pack (title_box, false, false); |
64 | title_box.show (); |
65 | + title_box.reactive = true; |
66 | |
67 | - icon = new Ctk.Image (24); |
68 | + icon = new Ctk.Image (22); |
69 | + icon.set_from_filename (PKGDATADIR + "/favourites.png"); |
70 | title_box.pack (icon, false, false); |
71 | icon.show (); |
72 | |
73 | @@ -69,20 +79,53 @@ |
74 | title_box.pack (text, true, true); |
75 | text.show (); |
76 | |
77 | - expander = new Ctk.Image (24); |
78 | + expander = new Ctk.Image (22); |
79 | + expander.set_from_filename (PKGDATADIR + "/maximize_up.png"); |
80 | + expander.opacity = 0; |
81 | title_box.pack (expander, false, true); |
82 | expander.show (); |
83 | |
84 | - var sep = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 }); |
85 | - sep.set_height (1); |
86 | - pack (sep, false, false); |
87 | - sep.show (); |
88 | + var rect = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 }); |
89 | + rect.height = 1; |
90 | + vbox.pack (rect, false, false); |
91 | + rect.show (); |
92 | + |
93 | + title_box.button_release_event.connect (() => { |
94 | + if (n_results <= renderer.get_n_cols ()) |
95 | + return true; |
96 | + |
97 | + if (bin_state == ExpandingBinState.UNEXPANDED) |
98 | + { |
99 | + bin_state = ExpandingBinState.EXPANDED; |
100 | + expander.set_from_filename (PKGDATADIR + "/minimize_up.png"); |
101 | + } |
102 | + else |
103 | + { |
104 | + bin_state = ExpandingBinState.UNEXPANDED; |
105 | + expander.set_from_filename (PKGDATADIR + "/maximize_up.png"); |
106 | + } |
107 | + return true; |
108 | + }); |
109 | + title_box.motion_event.connect (() => { |
110 | + if (dirty) |
111 | + { |
112 | + var children = renderer.get_children (); |
113 | + foreach (Clutter.Actor child in children) |
114 | + { |
115 | + Tile tile = child as Tile; |
116 | + tile.about_to_show (); |
117 | + } |
118 | + dirty = false; |
119 | + } |
120 | + }); |
121 | |
122 | renderer = new Ctk.IconView (); |
123 | renderer.padding = { 12.0f, 0.0f, 0.0f, 0.0f }; |
124 | renderer.spacing = 24; |
125 | - pack (renderer, true, true); |
126 | + vbox.pack (renderer, true, true); |
127 | renderer.show (); |
128 | + renderer.set ("auto-fade-children", true); |
129 | + renderer.notify["n-cols"].connect (on_n_cols_changed); |
130 | |
131 | unowned Dee.ModelIter iter = results.get_first_iter (); |
132 | while (!results.is_last (iter)) |
133 | @@ -97,21 +140,22 @@ |
134 | results.row_removed.connect (on_result_removed); |
135 | } |
136 | |
137 | - private override void get_preferred_height (float for_width, |
138 | - out float min_height, |
139 | - out float nat_height) |
140 | + private override void allocate (Clutter.ActorBox box, |
141 | + Clutter.AllocationFlags flags) |
142 | { |
143 | + base.allocate (box, flags); |
144 | + |
145 | + /* Update the unexpanded height if necessary */ |
146 | + /* FIXME: Can we please add some nice methods to CluTK which allow |
147 | + * doing something like $clutk_container.get_nth_child (), and so |
148 | + * bypass the stupid get_children stuff. In any case, cache the result |
149 | + */ |
150 | var children = renderer.get_children (); |
151 | - if (children.length () > 0) |
152 | - { |
153 | - base.get_preferred_height (for_width, out min_height, out nat_height); |
154 | - show (); |
155 | - } |
156 | - else |
157 | - { |
158 | - min_height = 0; |
159 | - nat_height = 0; |
160 | - hide (); |
161 | + var child = children.nth_data (0) as Clutter.Actor; |
162 | + if (child is Clutter.Actor && |
163 | + child.height != unexpanded_height) |
164 | + { |
165 | + unexpanded_height = title_box.height + 1.0f + child.height; |
166 | } |
167 | } |
168 | |
169 | @@ -132,7 +176,15 @@ |
170 | renderer.add_actor (button); |
171 | button.show (); |
172 | |
173 | - show (); |
174 | + add_to_n_results (1); |
175 | + |
176 | + if (bin_state == ExpandingBinState.CLOSED) |
177 | + { |
178 | + bin_state = ExpandingBinState.UNEXPANDED; |
179 | + show (); |
180 | + } |
181 | + |
182 | + dirty = true; |
183 | } |
184 | |
185 | private void on_result_removed (Dee.ModelIter iter) |
186 | @@ -148,18 +200,62 @@ |
187 | if (tile.iter == iter) |
188 | { |
189 | actor.destroy (); |
190 | + add_to_n_results (-1); |
191 | break; |
192 | } |
193 | } |
194 | |
195 | - if (children.length () <= 1) |
196 | - hide (); |
197 | + if (n_results < 1) |
198 | + { |
199 | + bin_state = ExpandingBinState.CLOSED; |
200 | + } |
201 | } |
202 | |
203 | private bool interesting (Dee.ModelIter iter) |
204 | { |
205 | return (results.get_uint (iter, 2) == group_id); |
206 | } |
207 | + |
208 | + private void add_to_n_results (int i) |
209 | + { |
210 | + n_results += i; |
211 | + |
212 | + if (n_results > renderer.get_n_cols ()) |
213 | + { |
214 | + expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, |
215 | + "opacity", 255); |
216 | + } |
217 | + else |
218 | + { |
219 | + expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, |
220 | + "opacity", 0); |
221 | + } |
222 | + } |
223 | + |
224 | + private void on_n_cols_changed () |
225 | + { |
226 | + var n_cols = renderer.get_n_cols (); |
227 | + |
228 | + if (bin_state == ExpandingBinState.UNEXPANDED) |
229 | + { |
230 | + var children = renderer.get_children (); |
231 | + int i = 0; |
232 | + |
233 | + foreach (Clutter.Actor child in children) |
234 | + { |
235 | + Tile tile = child as Tile; |
236 | + if (i < n_cols) |
237 | + { |
238 | + tile.about_to_show (); |
239 | + i++; |
240 | + } |
241 | + else |
242 | + break; |
243 | + } |
244 | + } |
245 | + |
246 | + add_to_n_results (0); |
247 | + } |
248 | } |
249 | |
250 | public class Tile : Ctk.Button |
251 | @@ -175,6 +271,8 @@ |
252 | public string? mimetype { get; construct; } |
253 | public string? comment { get; construct; } |
254 | |
255 | + private bool shown = false; |
256 | + |
257 | public Tile (Dee.ModelIter iter, |
258 | string uri, |
259 | string? icon_hint, |
260 | @@ -193,11 +291,17 @@ |
261 | |
262 | construct |
263 | { |
264 | - set_label (display_name); |
265 | - |
266 | unowned Ctk.Text text = get_text (); |
267 | text.ellipsize = Pango.EllipsizeMode.END; |
268 | - |
269 | + } |
270 | + |
271 | + public void about_to_show () |
272 | + { |
273 | + if (shown) |
274 | + return; |
275 | + shown = true; |
276 | + |
277 | + set_label (display_name); |
278 | set_icon (); |
279 | } |
280 | |
281 | @@ -226,7 +330,6 @@ |
282 | try { |
283 | var appinfos = AppInfoManager.get_instance (); |
284 | info = yield appinfos.lookup_async (id); |
285 | - debug ("Foo: %s", info.get_name()); |
286 | } catch (Error ee) { |
287 | warning ("Unable to read .desktop file '%s': %s", uri, ee.message); |
288 | return; |
289 | @@ -236,7 +339,6 @@ |
290 | { |
291 | try { |
292 | info.launch (null,null); |
293 | - debug ("Launched"); |
294 | } catch (Error e) { |
295 | warning ("Unable to launch desktop file %s: %s\n", |
296 | id, |
297 | |
298 | === modified file 'unity-private/places/places-default-renderer.vala' |
299 | --- unity-private/places/places-default-renderer.vala 2010-07-01 13:50:01 +0000 |
300 | +++ unity-private/places/places-default-renderer.vala 2010-07-07 09:12:51 +0000 |
301 | @@ -22,7 +22,7 @@ |
302 | public class DefaultRenderer : Ctk.ScrollView, Unity.Place.Renderer |
303 | { |
304 | static const float PADDING = 12.0f; |
305 | - static const int SPACING = 12; |
306 | + static const int SPACING = 0; |
307 | |
308 | private Ctk.VBox box; |
309 | private Dee.Model groups_model; |
310 | |
311 | === modified file 'unity-private/places/places-place-search-bar.vala' |
312 | --- unity-private/places/places-place-search-bar.vala 2010-06-24 07:43:05 +0000 |
313 | +++ unity-private/places/places-place-search-bar.vala 2010-07-07 09:12:51 +0000 |
314 | @@ -62,6 +62,11 @@ |
315 | bg.show (); |
316 | } |
317 | |
318 | + public void reset () |
319 | + { |
320 | + entry.reset (); |
321 | + } |
322 | + |
323 | private override void allocate (Clutter.ActorBox box, |
324 | Clutter.AllocationFlags flags) |
325 | { |
326 | @@ -94,7 +99,7 @@ |
327 | nat_height = nheight + SPACING * 3; |
328 | } |
329 | |
330 | - private void on_search_text_changed (string text) |
331 | + private void on_search_text_changed (string? text) |
332 | { |
333 | if (active_entry is PlaceEntry) |
334 | { |
335 | |
336 | === modified file 'unity-private/places/places-place-search-entry.vala' |
337 | --- unity-private/places/places-place-search-entry.vala 2010-07-01 14:22:01 +0000 |
338 | +++ unity-private/places/places-place-search-entry.vala 2010-07-07 09:12:51 +0000 |
339 | @@ -23,7 +23,7 @@ |
340 | { |
341 | static const string SEARCH_ICON_FILE = PKGDATADIR + "/search_icon.png"; |
342 | static const float PADDING = 1.0f; |
343 | - static const int LIVE_SEARCH_TIMEOUT = 300; /* Milliseconds */ |
344 | + static const int LIVE_SEARCH_TIMEOUT = 200; /* Milliseconds */ |
345 | const Clutter.Color nofocus_color = { 0xff, 0xff, 0xff, 0xbb }; |
346 | const Clutter.Color focus_color = { 0xff, 0xff, 0xff, 0xff }; |
347 | |
348 | @@ -32,9 +32,9 @@ |
349 | public ThemeImage right_icon; |
350 | |
351 | private uint live_search_timeout = 0; |
352 | - private string _static_text = "Search"; |
353 | + private string _static_text = _("Search"); |
354 | |
355 | - public signal void text_changed (string text); |
356 | + public signal void text_changed (string? text); |
357 | |
358 | public PlaceSearchEntry () |
359 | { |
360 | @@ -89,7 +89,7 @@ |
361 | Source.remove (live_search_timeout); |
362 | |
363 | live_search_timeout = Timeout.add (LIVE_SEARCH_TIMEOUT, () => { |
364 | - text_changed (text.text); |
365 | + text_changed (text.text == _static_text ? "" : text.text); |
366 | live_search_timeout = 0; |
367 | |
368 | return false; |
369 | @@ -99,21 +99,24 @@ |
370 | private void on_key_focus_in () |
371 | { |
372 | if (text.text == _static_text) |
373 | - { |
374 | text.set_text (""); |
375 | - text.cursor_visible = true; |
376 | - text.set_selection (0, -1); |
377 | - text.color = focus_color; |
378 | - } |
379 | + |
380 | + text.cursor_visible = true; |
381 | + text.color = focus_color; |
382 | } |
383 | |
384 | private void on_key_focus_out () |
385 | { |
386 | |
387 | text.cursor_visible = false; |
388 | + text.color = nofocus_color; |
389 | + } |
390 | + |
391 | + public void reset () |
392 | + { |
393 | + text.cursor_visible = false; |
394 | + text.color = nofocus_color; |
395 | text.text = _static_text; |
396 | - text.color = nofocus_color; |
397 | - |
398 | } |
399 | } |
400 | } |
401 | |
402 | === modified file 'unity-private/places/places-view.vala' |
403 | --- unity-private/places/places-view.vala 2010-07-01 13:50:01 +0000 |
404 | +++ unity-private/places/places-view.vala 2010-07-07 09:12:51 +0000 |
405 | @@ -52,7 +52,10 @@ |
406 | public void about_to_show () |
407 | { |
408 | if (_model is PlaceFileModel) |
409 | - return; |
410 | + { |
411 | + search_bar.reset (); |
412 | + return; |
413 | + } |
414 | |
415 | _model = new PlaceFileModel () as PlaceModel; |
416 | |
417 | |
418 | === modified file 'unity-private/testing/test-window.vala' |
419 | --- unity-private/testing/test-window.vala 2010-07-07 09:12:51 +0000 |
420 | +++ unity-private/testing/test-window.vala 2010-07-07 09:12:51 +0000 |
421 | @@ -300,12 +300,14 @@ |
422 | { |
423 | this.showing_places = false; |
424 | this.panel.set_indicator_mode (true); |
425 | + this.background.opacity = 160; |
426 | this.places.opacity = 255; |
427 | } |
428 | else |
429 | { |
430 | this.showing_places = true; |
431 | this.panel.set_indicator_mode (false); |
432 | + this.background.opacity = 255; |
433 | this.places.opacity = 0; |
434 | } |
435 | |
436 | @@ -318,6 +320,7 @@ |
437 | { |
438 | showing_places = true; |
439 | panel.set_indicator_mode (false); |
440 | + background.opacity = 255; |
441 | places.opacity = 0; |
442 | } |
443 | } |
444 | |
445 | === modified file 'unity/Makefile.am' |
446 | --- unity/Makefile.am 2010-07-01 15:22:49 +0000 |
447 | +++ unity/Makefile.am 2010-07-07 09:12:51 +0000 |
448 | @@ -70,6 +70,7 @@ |
449 | theme.vala \ |
450 | unity-appinfo-manager.vala \ |
451 | unity-cairo-canvas.vala \ |
452 | + unity-expanding-bin.vala \ |
453 | unity-favorites.vala \ |
454 | unity-io.vala \ |
455 | unity-pixbuf-cache.vala \ |
456 | |
457 | === added file 'unity/unity-expanding-bin.vala' |
458 | --- unity/unity-expanding-bin.vala 1970-01-01 00:00:00 +0000 |
459 | +++ unity/unity-expanding-bin.vala 2010-07-07 09:12:51 +0000 |
460 | @@ -0,0 +1,179 @@ |
461 | +/* |
462 | + * Copyright (C) 2010 Canonical, Ltd. |
463 | + * |
464 | + * This library is free software; you can redistribute it and/or modify |
465 | + * it under the terms of the GNU Lesser General Public License |
466 | + * version 3.0 as published by the Free Software Foundation. |
467 | + * |
468 | + * This library is distributed in the hope that it will be useful, |
469 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
470 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
471 | + * GNU Lesser General Public License version 3.0 for more details. |
472 | + * |
473 | + * You should have received a copy of the GNU Lesser General Public |
474 | + * License along with this library. If not, see |
475 | + <http://www.gnu.org/licenses/>. |
476 | + * |
477 | + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> |
478 | + */ |
479 | + |
480 | +using GLib; |
481 | + |
482 | +namespace Unity |
483 | +{ |
484 | + public enum ExpandingBinState |
485 | + { |
486 | + CLOSED, |
487 | + UNEXPANDED, |
488 | + EXPANDED |
489 | + } |
490 | + |
491 | + public class ExpandingBin : Ctk.Bin |
492 | + { |
493 | + public static const int ANIMATION_TIME = 200; |
494 | + /* |
495 | + * Properties |
496 | + */ |
497 | + public float size_factor { |
498 | + get { return _size_factor; } |
499 | + set { _size_factor = value; queue_relayout (); } |
500 | + } |
501 | + |
502 | + public ExpandingBinState bin_state { |
503 | + get { return _state; } |
504 | + set { _change_state (value); } |
505 | + } |
506 | + |
507 | + public float unexpanded_height { |
508 | + get { return _unexpanded_height; } |
509 | + set { |
510 | + if (_unexpanded_height != value) |
511 | + { |
512 | + _unexpanded_height = value; |
513 | + |
514 | + if (_state == ExpandingBinState.UNEXPANDED) |
515 | + { |
516 | + _state = ExpandingBinState.CLOSED; |
517 | + _change_state (ExpandingBinState.UNEXPANDED); |
518 | + } |
519 | + } |
520 | + } |
521 | + } |
522 | + |
523 | + private float _size_factor = 0.0f; |
524 | + private ExpandingBinState _state = ExpandingBinState.CLOSED; |
525 | + private ExpandingBinState _old_state = ExpandingBinState.CLOSED; |
526 | + private float _unexpanded_height = 100.0f; |
527 | + private float _expanded_height = 0.0f; |
528 | + private float _target_height = 0.0f; |
529 | + |
530 | + private float last_height; |
531 | + private float last_width; |
532 | + |
533 | + /* |
534 | + * Construction |
535 | + */ |
536 | + public ExpandingBin () |
537 | + { |
538 | + Object (); |
539 | + } |
540 | + |
541 | + construct |
542 | + { |
543 | + } |
544 | + |
545 | + /* |
546 | + * Private Methods |
547 | + */ |
548 | + private override void allocate (Clutter.ActorBox box, |
549 | + Clutter.AllocationFlags flags) |
550 | + { |
551 | + float x = padding.left; |
552 | + float y = padding.top; |
553 | + float width = Math.floorf (box.x2 - box.x1) - padding.left - padding.right; |
554 | + Clutter.ActorBox child_box = Clutter.ActorBox (); |
555 | + child_box.x1 = x; |
556 | + child_box.x2 = x + width; |
557 | + child_box.y1 = y; |
558 | + child_box.y2 = y + last_height + ((_target_height - last_height) * _size_factor); |
559 | + |
560 | + base.allocate (box, flags); |
561 | + get_child ().allocate (child_box, flags); |
562 | + |
563 | + last_height = child_box.y2 - child_box.y1; |
564 | + last_width = child_box.x2 - child_box.x1; |
565 | + } |
566 | + |
567 | + private override void get_preferred_height (float for_width, |
568 | + out float min_height, |
569 | + out float nat_height) |
570 | + { |
571 | + var vpadding = padding.top + padding.bottom; |
572 | + |
573 | + get_child ().get_preferred_height (last_width, null, out _expanded_height); |
574 | + if (_state == ExpandingBinState.CLOSED) |
575 | + { |
576 | + _target_height = 0.0f; |
577 | + } |
578 | + else if (_state == ExpandingBinState.UNEXPANDED) |
579 | + { |
580 | + _target_height = _unexpanded_height + vpadding; |
581 | + } |
582 | + else |
583 | + { |
584 | + _target_height = _expanded_height + vpadding; |
585 | + } |
586 | + |
587 | + min_height = last_height + ((_target_height - last_height) *_size_factor); |
588 | + nat_height = last_height + ((_target_height - last_height) *_size_factor); |
589 | + } |
590 | + |
591 | + private void _change_state (ExpandingBinState new_state) |
592 | + { |
593 | + if (_state == new_state) |
594 | + return; |
595 | + |
596 | + _old_state = _state; |
597 | + _state = new_state; |
598 | + |
599 | + _size_factor = 0.0f; |
600 | + switch (_state) |
601 | + { |
602 | + case ExpandingBinState.CLOSED: |
603 | + var anim = animate (Clutter.AnimationMode.EASE_OUT_SINE, ANIMATION_TIME, |
604 | + "size_factor", 1.0f, |
605 | + "opacity", 0); |
606 | + _target_height = 0.0f; |
607 | + |
608 | + anim.completed.connect (() => { |
609 | + if (_state == ExpandingBinState.CLOSED) |
610 | + hide (); |
611 | + }); |
612 | + break; |
613 | + |
614 | + case ExpandingBinState.UNEXPANDED: |
615 | + animate (_old_state == ExpandingBinState.CLOSED ? Clutter.AnimationMode.EASE_IN_SINE |
616 | + : Clutter.AnimationMode.EASE_OUT_SINE, |
617 | + ANIMATION_TIME, |
618 | + "size_factor", 1.0f, |
619 | + "opacity", 255); |
620 | + _target_height = _unexpanded_height; |
621 | + show (); |
622 | + break; |
623 | + |
624 | + case ExpandingBinState.EXPANDED: |
625 | + animate (Clutter.AnimationMode.EASE_IN_SINE, ANIMATION_TIME, |
626 | + "size_factor", 1.0f, |
627 | + "opacity", 255); |
628 | + get_child ().get_preferred_height (width, null, out _expanded_height); |
629 | + _target_height = _expanded_height; |
630 | + show (); |
631 | + break; |
632 | + |
633 | + default: |
634 | + warning ("ExpandingBinState %d not supported", _state); |
635 | + break; |
636 | + } |
637 | + } |
638 | + } |
639 | +} |
640 | |
641 | === modified file 'unity/unity-pixbuf-cache.vala' |
642 | --- unity/unity-pixbuf-cache.vala 2010-07-01 14:02:24 +0000 |
643 | +++ unity/unity-pixbuf-cache.vala 2010-07-07 09:12:51 +0000 |
644 | @@ -157,36 +157,50 @@ |
645 | |
646 | if (ret == null) |
647 | { |
648 | - try { |
649 | - unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string); |
650 | - var info = theme.lookup_by_gicon (icon, size, 0); |
651 | - if (info != null) |
652 | - ret = info.load_icon (); |
653 | - |
654 | - if (ret == null) |
655 | - { |
656 | - /* There is some funkiness in some programs where they install |
657 | - * their icon to /usr/share/icons/hicolor/apps/, but they |
658 | - * name the Icon= key as `foo.$extension` which breaks loading |
659 | - * So we can try and work around that here. |
660 | - */ |
661 | - if (gicon_as_string.has_suffix (".png") |
662 | - || gicon_as_string.has_suffix (".xpm") |
663 | - || gicon_as_string.has_suffix (".gir") |
664 | - || gicon_as_string.has_suffix (".jpg")) |
665 | + if (gicon_as_string[0] == '/') |
666 | + { |
667 | + try { |
668 | + ret = new Gdk.Pixbuf.from_file (gicon_as_string); |
669 | + } catch (Error err) { |
670 | + message (@"Unable to load $gicon_as_string as file: %s", |
671 | + err.message); |
672 | + } |
673 | + } |
674 | + |
675 | + if (ret == null) |
676 | + { |
677 | + try { |
678 | + unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string); |
679 | + var info = theme.lookup_by_gicon (icon, size, 0); |
680 | + if (info != null) |
681 | + ret = info.load_icon (); |
682 | + |
683 | + if (ret == null) |
684 | { |
685 | - string real_name = gicon_as_string[0:gicon_as_string.length-4]; |
686 | - ret = theme.load_icon (real_name, size, 0); |
687 | + /* There is some funkiness in some programs where they install |
688 | + * their icon to /usr/share/icons/hicolor/apps/, but they |
689 | + * name the Icon= key as `foo.$extension` which breaks loading |
690 | + * So we can try and work around that here. |
691 | + */ |
692 | + if (gicon_as_string.has_suffix (".png") |
693 | + || gicon_as_string.has_suffix (".xpm") |
694 | + || gicon_as_string.has_suffix (".gir") |
695 | + || gicon_as_string.has_suffix (".jpg")) |
696 | + { |
697 | + string real_name = gicon_as_string[0:gicon_as_string.length-4]; |
698 | + ret = theme.load_icon (real_name, size, 0); |
699 | + } |
700 | } |
701 | - } |
702 | - |
703 | - if (ret is Pixbuf) |
704 | - { |
705 | - cache[key] = ret; |
706 | - } |
707 | - } catch (Error e) { |
708 | - warning (@"Unable to load icon $gicon_as_string: '%s'", e.message); |
709 | - } |
710 | + |
711 | + } catch (Error e) { |
712 | + warning (@"Unable to load icon $gicon_as_string: '%s'", e.message); |
713 | + } |
714 | + } |
715 | + |
716 | + if (ret is Pixbuf) |
717 | + { |
718 | + cache[key] = ret; |
719 | + } |
720 | } |
721 | |
722 | if (ret is Pixbuf) |
723 | |
724 | === modified file 'vapi/clutk-0.3.vapi' |
725 | --- vapi/clutk-0.3.vapi 2010-03-25 13:26:16 +0000 |
726 | +++ vapi/clutk-0.3.vapi 2010-07-07 09:12:51 +0000 |
727 | @@ -162,8 +162,14 @@ |
728 | public class IconView : Ctk.Actor, Clutter.Scriptable, Ctk.Focusable, Clutter.Container { |
729 | [CCode (type = "ClutterActor*", has_construct_function = false)] |
730 | public IconView (); |
731 | + public uint get_n_cols (); |
732 | + public uint get_n_rows (); |
733 | public int get_spacing (); |
734 | public void set_spacing (int spacing); |
735 | + [NoAccessorMethod] |
736 | + public bool auto_fade_children { get; set construct; } |
737 | + public uint n_cols { get; } |
738 | + public uint n_rows { get; } |
739 | public int spacing { get; set construct; } |
740 | } |
741 | [CCode (cheader_filename = "clutk/clutk.h")] |
The clutk branch has been merged into trunk, so just grab lp:clutk to test this work