Merge lp:~unity-team/unity/collapsing-place-groups into lp:unity

Proposed by Neil J. Patel
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
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+29371@code.launchpad.net

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 DefaultRendererGroup will only request icons to load on the number of visible Tiles in the unexpanded state. When the user hovers over the group header (so they can click to open the group), the group will ask the rest of the tiles to load their icons. This speeds up the rendering time of places tremendously on netbooks.

- 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 ****

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

The clutk branch has been merged into trunk, so just grab lp:clutk to test this work

Revision history for this message
Jay Taoko (jaytaoko) wrote :

Tested and Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-07-07 09:12:51 +0000
+++ .bzrignore 2010-07-07 09:12:51 +0000
@@ -321,3 +321,4 @@
321tests/unit/test-io.c321tests/unit/test-io.c
322unity/unity-appinfo-manager.c322unity/unity-appinfo-manager.c
323unity/unity-io.c323unity/unity-io.c
324unity/unity-expanding-bin.c
324325
=== modified file 'unity-private/places/places-default-renderer-group.vala'
--- unity-private/places/places-default-renderer-group.vala 2010-07-07 09:12:51 +0000
+++ unity-private/places/places-default-renderer-group.vala 2010-07-07 09:12:51 +0000
@@ -19,9 +19,9 @@
1919
20namespace Unity.Places20namespace Unity.Places
21{21{
22 public class DefaultRendererGroup : Ctk.Box22 public class DefaultRendererGroup : ExpandingBin
23 {23 {
24 static const float PADDING = 0.0f;24 static const float PADDING = 24.0f;
25 static const int SPACING = 0;25 static const int SPACING = 0;
2626
27 public uint group_id { get; construct; }27 public uint group_id { get; construct; }
@@ -30,12 +30,17 @@
30 public string icon_hint { get; construct; }30 public string icon_hint { get; construct; }
31 public Dee.Model results { get; construct; }31 public Dee.Model results { get; construct; }
3232
33 private Ctk.VBox vbox;
33 private Ctk.HBox title_box;34 private Ctk.HBox title_box;
34 private Ctk.Image icon;35 private Ctk.Image icon;
35 private Ctk.Text text;36 private Ctk.Text text;
36 private Ctk.Image expander;37 private Ctk.Image expander;
37 private Ctk.IconView renderer;38 private Ctk.IconView renderer;
3839
40 /* Some caching to speed up lookups */
41 private uint n_results = 0;
42 private bool dirty = false;
43
39 public DefaultRendererGroup (uint group_id,44 public DefaultRendererGroup (uint group_id,
40 string group_renderer,45 string group_renderer,
41 string display_name,46 string display_name,
@@ -51,17 +56,22 @@
5156
52 construct57 construct
53 {58 {
54 padding = { PADDING, PADDING, PADDING , PADDING};59 padding = { 0.0f, 0.0f, PADDING , 0.0f};
55 orientation = Ctk.Orientation.VERTICAL;
56 spacing = SPACING;
57 homogeneous = false;
58 hide ();60 hide ();
5961
60 title_box = new Ctk.HBox (8);62 vbox = new Ctk.VBox (SPACING);
61 pack (title_box, false, false);63 vbox.spacing = SPACING;
64 vbox.homogeneous = false;
65 add_actor (vbox);
66 vbox.show ();
67
68 title_box = new Ctk.HBox (5);
69 vbox.pack (title_box, false, false);
62 title_box.show ();70 title_box.show ();
71 title_box.reactive = true;
6372
64 icon = new Ctk.Image (24);73 icon = new Ctk.Image (22);
74 icon.set_from_filename (PKGDATADIR + "/favourites.png");
65 title_box.pack (icon, false, false);75 title_box.pack (icon, false, false);
66 icon.show ();76 icon.show ();
6777
@@ -69,20 +79,53 @@
69 title_box.pack (text, true, true);79 title_box.pack (text, true, true);
70 text.show ();80 text.show ();
7181
72 expander = new Ctk.Image (24);82 expander = new Ctk.Image (22);
83 expander.set_from_filename (PKGDATADIR + "/maximize_up.png");
84 expander.opacity = 0;
73 title_box.pack (expander, false, true);85 title_box.pack (expander, false, true);
74 expander.show ();86 expander.show ();
7587
76 var sep = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 });88 var rect = new Clutter.Rectangle.with_color ({ 255, 255, 255, 255 });
77 sep.set_height (1);89 rect.height = 1;
78 pack (sep, false, false);90 vbox.pack (rect, false, false);
79 sep.show ();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 });
80121
81 renderer = new Ctk.IconView ();122 renderer = new Ctk.IconView ();
82 renderer.padding = { 12.0f, 0.0f, 0.0f, 0.0f };123 renderer.padding = { 12.0f, 0.0f, 0.0f, 0.0f };
83 renderer.spacing = 24;124 renderer.spacing = 24;
84 pack (renderer, true, true);125 vbox.pack (renderer, true, true);
85 renderer.show ();126 renderer.show ();
127 renderer.set ("auto-fade-children", true);
128 renderer.notify["n-cols"].connect (on_n_cols_changed);
86129
87 unowned Dee.ModelIter iter = results.get_first_iter ();130 unowned Dee.ModelIter iter = results.get_first_iter ();
88 while (!results.is_last (iter))131 while (!results.is_last (iter))
@@ -97,21 +140,22 @@
97 results.row_removed.connect (on_result_removed);140 results.row_removed.connect (on_result_removed);
98 }141 }
99142
100 private override void get_preferred_height (float for_width,143 private override void allocate (Clutter.ActorBox box,
101 out float min_height,144 Clutter.AllocationFlags flags)
102 out float nat_height)
103 {145 {
146 base.allocate (box, flags);
147
148 /* Update the unexpanded height if necessary */
149 /* FIXME: Can we please add some nice methods to CluTK which allow
150 * doing something like $clutk_container.get_nth_child (), and so
151 * bypass the stupid get_children stuff. In any case, cache the result
152 */
104 var children = renderer.get_children ();153 var children = renderer.get_children ();
105 if (children.length () > 0)154 var child = children.nth_data (0) as Clutter.Actor;
106 {155 if (child is Clutter.Actor &&
107 base.get_preferred_height (for_width, out min_height, out nat_height);156 child.height != unexpanded_height)
108 show ();157 {
109 }158 unexpanded_height = title_box.height + 1.0f + child.height;
110 else
111 {
112 min_height = 0;
113 nat_height = 0;
114 hide ();
115 }159 }
116 }160 }
117161
@@ -132,7 +176,15 @@
132 renderer.add_actor (button);176 renderer.add_actor (button);
133 button.show ();177 button.show ();
134178
135 show ();179 add_to_n_results (1);
180
181 if (bin_state == ExpandingBinState.CLOSED)
182 {
183 bin_state = ExpandingBinState.UNEXPANDED;
184 show ();
185 }
186
187 dirty = true;
136 }188 }
137189
138 private void on_result_removed (Dee.ModelIter iter)190 private void on_result_removed (Dee.ModelIter iter)
@@ -148,18 +200,62 @@
148 if (tile.iter == iter)200 if (tile.iter == iter)
149 {201 {
150 actor.destroy ();202 actor.destroy ();
203 add_to_n_results (-1);
151 break;204 break;
152 }205 }
153 }206 }
154207
155 if (children.length () <= 1)208 if (n_results < 1)
156 hide ();209 {
210 bin_state = ExpandingBinState.CLOSED;
211 }
157 }212 }
158213
159 private bool interesting (Dee.ModelIter iter)214 private bool interesting (Dee.ModelIter iter)
160 {215 {
161 return (results.get_uint (iter, 2) == group_id);216 return (results.get_uint (iter, 2) == group_id);
162 }217 }
218
219 private void add_to_n_results (int i)
220 {
221 n_results += i;
222
223 if (n_results > renderer.get_n_cols ())
224 {
225 expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200,
226 "opacity", 255);
227 }
228 else
229 {
230 expander.animate (Clutter.AnimationMode.EASE_IN_SINE, 200,
231 "opacity", 0);
232 }
233 }
234
235 private void on_n_cols_changed ()
236 {
237 var n_cols = renderer.get_n_cols ();
238
239 if (bin_state == ExpandingBinState.UNEXPANDED)
240 {
241 var children = renderer.get_children ();
242 int i = 0;
243
244 foreach (Clutter.Actor child in children)
245 {
246 Tile tile = child as Tile;
247 if (i < n_cols)
248 {
249 tile.about_to_show ();
250 i++;
251 }
252 else
253 break;
254 }
255 }
256
257 add_to_n_results (0);
258 }
163 }259 }
164260
165 public class Tile : Ctk.Button261 public class Tile : Ctk.Button
@@ -175,6 +271,8 @@
175 public string? mimetype { get; construct; }271 public string? mimetype { get; construct; }
176 public string? comment { get; construct; }272 public string? comment { get; construct; }
177273
274 private bool shown = false;
275
178 public Tile (Dee.ModelIter iter,276 public Tile (Dee.ModelIter iter,
179 string uri,277 string uri,
180 string? icon_hint,278 string? icon_hint,
@@ -193,11 +291,17 @@
193291
194 construct292 construct
195 {293 {
196 set_label (display_name);
197
198 unowned Ctk.Text text = get_text ();294 unowned Ctk.Text text = get_text ();
199 text.ellipsize = Pango.EllipsizeMode.END;295 text.ellipsize = Pango.EllipsizeMode.END;
200296 }
297
298 public void about_to_show ()
299 {
300 if (shown)
301 return;
302 shown = true;
303
304 set_label (display_name);
201 set_icon ();305 set_icon ();
202 }306 }
203307
@@ -226,7 +330,6 @@
226 try {330 try {
227 var appinfos = AppInfoManager.get_instance ();331 var appinfos = AppInfoManager.get_instance ();
228 info = yield appinfos.lookup_async (id);332 info = yield appinfos.lookup_async (id);
229 debug ("Foo: %s", info.get_name());
230 } catch (Error ee) {333 } catch (Error ee) {
231 warning ("Unable to read .desktop file '%s': %s", uri, ee.message);334 warning ("Unable to read .desktop file '%s': %s", uri, ee.message);
232 return;335 return;
@@ -236,7 +339,6 @@
236 {339 {
237 try {340 try {
238 info.launch (null,null);341 info.launch (null,null);
239 debug ("Launched");
240 } catch (Error e) {342 } catch (Error e) {
241 warning ("Unable to launch desktop file %s: %s\n",343 warning ("Unable to launch desktop file %s: %s\n",
242 id,344 id,
243345
=== modified file 'unity-private/places/places-default-renderer.vala'
--- unity-private/places/places-default-renderer.vala 2010-07-01 13:50:01 +0000
+++ unity-private/places/places-default-renderer.vala 2010-07-07 09:12:51 +0000
@@ -22,7 +22,7 @@
22 public class DefaultRenderer : Ctk.ScrollView, Unity.Place.Renderer22 public class DefaultRenderer : Ctk.ScrollView, Unity.Place.Renderer
23 {23 {
24 static const float PADDING = 12.0f;24 static const float PADDING = 12.0f;
25 static const int SPACING = 12;25 static const int SPACING = 0;
2626
27 private Ctk.VBox box;27 private Ctk.VBox box;
28 private Dee.Model groups_model;28 private Dee.Model groups_model;
2929
=== modified file 'unity-private/places/places-place-search-bar.vala'
--- unity-private/places/places-place-search-bar.vala 2010-06-24 07:43:05 +0000
+++ unity-private/places/places-place-search-bar.vala 2010-07-07 09:12:51 +0000
@@ -62,6 +62,11 @@
62 bg.show ();62 bg.show ();
63 }63 }
6464
65 public void reset ()
66 {
67 entry.reset ();
68 }
69
65 private override void allocate (Clutter.ActorBox box,70 private override void allocate (Clutter.ActorBox box,
66 Clutter.AllocationFlags flags)71 Clutter.AllocationFlags flags)
67 {72 {
@@ -94,7 +99,7 @@
94 nat_height = nheight + SPACING * 3;99 nat_height = nheight + SPACING * 3;
95 }100 }
96101
97 private void on_search_text_changed (string text)102 private void on_search_text_changed (string? text)
98 {103 {
99 if (active_entry is PlaceEntry)104 if (active_entry is PlaceEntry)
100 {105 {
101106
=== modified file 'unity-private/places/places-place-search-entry.vala'
--- unity-private/places/places-place-search-entry.vala 2010-07-01 14:22:01 +0000
+++ unity-private/places/places-place-search-entry.vala 2010-07-07 09:12:51 +0000
@@ -23,7 +23,7 @@
23 {23 {
24 static const string SEARCH_ICON_FILE = PKGDATADIR + "/search_icon.png";24 static const string SEARCH_ICON_FILE = PKGDATADIR + "/search_icon.png";
25 static const float PADDING = 1.0f;25 static const float PADDING = 1.0f;
26 static const int LIVE_SEARCH_TIMEOUT = 300; /* Milliseconds */26 static const int LIVE_SEARCH_TIMEOUT = 200; /* Milliseconds */
27 const Clutter.Color nofocus_color = { 0xff, 0xff, 0xff, 0xbb };27 const Clutter.Color nofocus_color = { 0xff, 0xff, 0xff, 0xbb };
28 const Clutter.Color focus_color = { 0xff, 0xff, 0xff, 0xff };28 const Clutter.Color focus_color = { 0xff, 0xff, 0xff, 0xff };
2929
@@ -32,9 +32,9 @@
32 public ThemeImage right_icon;32 public ThemeImage right_icon;
3333
34 private uint live_search_timeout = 0;34 private uint live_search_timeout = 0;
35 private string _static_text = "Search";35 private string _static_text = _("Search");
3636
37 public signal void text_changed (string text);37 public signal void text_changed (string? text);
3838
39 public PlaceSearchEntry ()39 public PlaceSearchEntry ()
40 {40 {
@@ -89,7 +89,7 @@
89 Source.remove (live_search_timeout);89 Source.remove (live_search_timeout);
9090
91 live_search_timeout = Timeout.add (LIVE_SEARCH_TIMEOUT, () => {91 live_search_timeout = Timeout.add (LIVE_SEARCH_TIMEOUT, () => {
92 text_changed (text.text);92 text_changed (text.text == _static_text ? "" : text.text);
93 live_search_timeout = 0;93 live_search_timeout = 0;
9494
95 return false;95 return false;
@@ -99,21 +99,24 @@
99 private void on_key_focus_in ()99 private void on_key_focus_in ()
100 {100 {
101 if (text.text == _static_text)101 if (text.text == _static_text)
102 {
103 text.set_text ("");102 text.set_text ("");
104 text.cursor_visible = true;103
105 text.set_selection (0, -1);104 text.cursor_visible = true;
106 text.color = focus_color;105 text.color = focus_color;
107 }
108 }106 }
109107
110 private void on_key_focus_out ()108 private void on_key_focus_out ()
111 {109 {
112110
113 text.cursor_visible = false;111 text.cursor_visible = false;
112 text.color = nofocus_color;
113 }
114
115 public void reset ()
116 {
117 text.cursor_visible = false;
118 text.color = nofocus_color;
114 text.text = _static_text;119 text.text = _static_text;
115 text.color = nofocus_color;
116
117 }120 }
118 }121 }
119}122}
120123
=== modified file 'unity-private/places/places-view.vala'
--- unity-private/places/places-view.vala 2010-07-01 13:50:01 +0000
+++ unity-private/places/places-view.vala 2010-07-07 09:12:51 +0000
@@ -52,7 +52,10 @@
52 public void about_to_show ()52 public void about_to_show ()
53 {53 {
54 if (_model is PlaceFileModel)54 if (_model is PlaceFileModel)
55 return;55 {
56 search_bar.reset ();
57 return;
58 }
5659
57 _model = new PlaceFileModel () as PlaceModel;60 _model = new PlaceFileModel () as PlaceModel;
5861
5962
=== modified file 'unity-private/testing/test-window.vala'
--- unity-private/testing/test-window.vala 2010-07-07 09:12:51 +0000
+++ unity-private/testing/test-window.vala 2010-07-07 09:12:51 +0000
@@ -300,12 +300,14 @@
300 {300 {
301 this.showing_places = false;301 this.showing_places = false;
302 this.panel.set_indicator_mode (true);302 this.panel.set_indicator_mode (true);
303 this.background.opacity = 160;
303 this.places.opacity = 255;304 this.places.opacity = 255;
304 }305 }
305 else306 else
306 {307 {
307 this.showing_places = true;308 this.showing_places = true;
308 this.panel.set_indicator_mode (false);309 this.panel.set_indicator_mode (false);
310 this.background.opacity = 255;
309 this.places.opacity = 0;311 this.places.opacity = 0;
310 }312 }
311313
@@ -318,6 +320,7 @@
318 {320 {
319 showing_places = true;321 showing_places = true;
320 panel.set_indicator_mode (false);322 panel.set_indicator_mode (false);
323 background.opacity = 255;
321 places.opacity = 0;324 places.opacity = 0;
322 }325 }
323 }326 }
324327
=== modified file 'unity/Makefile.am'
--- unity/Makefile.am 2010-07-01 15:22:49 +0000
+++ unity/Makefile.am 2010-07-07 09:12:51 +0000
@@ -70,6 +70,7 @@
70 theme.vala \70 theme.vala \
71 unity-appinfo-manager.vala \71 unity-appinfo-manager.vala \
72 unity-cairo-canvas.vala \72 unity-cairo-canvas.vala \
73 unity-expanding-bin.vala \
73 unity-favorites.vala \74 unity-favorites.vala \
74 unity-io.vala \75 unity-io.vala \
75 unity-pixbuf-cache.vala \76 unity-pixbuf-cache.vala \
7677
=== added file 'unity/unity-expanding-bin.vala'
--- unity/unity-expanding-bin.vala 1970-01-01 00:00:00 +0000
+++ unity/unity-expanding-bin.vala 2010-07-07 09:12:51 +0000
@@ -0,0 +1,179 @@
1/*
2 * Copyright (C) 2010 Canonical, Ltd.
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License
6 * version 3.0 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License version 3.0 for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library. If not, see
15 <http://www.gnu.org/licenses/>.
16 *
17 * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
18 */
19
20using GLib;
21
22namespace Unity
23{
24 public enum ExpandingBinState
25 {
26 CLOSED,
27 UNEXPANDED,
28 EXPANDED
29 }
30
31 public class ExpandingBin : Ctk.Bin
32 {
33 public static const int ANIMATION_TIME = 200;
34 /*
35 * Properties
36 */
37 public float size_factor {
38 get { return _size_factor; }
39 set { _size_factor = value; queue_relayout (); }
40 }
41
42 public ExpandingBinState bin_state {
43 get { return _state; }
44 set { _change_state (value); }
45 }
46
47 public float unexpanded_height {
48 get { return _unexpanded_height; }
49 set {
50 if (_unexpanded_height != value)
51 {
52 _unexpanded_height = value;
53
54 if (_state == ExpandingBinState.UNEXPANDED)
55 {
56 _state = ExpandingBinState.CLOSED;
57 _change_state (ExpandingBinState.UNEXPANDED);
58 }
59 }
60 }
61 }
62
63 private float _size_factor = 0.0f;
64 private ExpandingBinState _state = ExpandingBinState.CLOSED;
65 private ExpandingBinState _old_state = ExpandingBinState.CLOSED;
66 private float _unexpanded_height = 100.0f;
67 private float _expanded_height = 0.0f;
68 private float _target_height = 0.0f;
69
70 private float last_height;
71 private float last_width;
72
73 /*
74 * Construction
75 */
76 public ExpandingBin ()
77 {
78 Object ();
79 }
80
81 construct
82 {
83 }
84
85 /*
86 * Private Methods
87 */
88 private override void allocate (Clutter.ActorBox box,
89 Clutter.AllocationFlags flags)
90 {
91 float x = padding.left;
92 float y = padding.top;
93 float width = Math.floorf (box.x2 - box.x1) - padding.left - padding.right;
94 Clutter.ActorBox child_box = Clutter.ActorBox ();
95 child_box.x1 = x;
96 child_box.x2 = x + width;
97 child_box.y1 = y;
98 child_box.y2 = y + last_height + ((_target_height - last_height) * _size_factor);
99
100 base.allocate (box, flags);
101 get_child ().allocate (child_box, flags);
102
103 last_height = child_box.y2 - child_box.y1;
104 last_width = child_box.x2 - child_box.x1;
105 }
106
107 private override void get_preferred_height (float for_width,
108 out float min_height,
109 out float nat_height)
110 {
111 var vpadding = padding.top + padding.bottom;
112
113 get_child ().get_preferred_height (last_width, null, out _expanded_height);
114 if (_state == ExpandingBinState.CLOSED)
115 {
116 _target_height = 0.0f;
117 }
118 else if (_state == ExpandingBinState.UNEXPANDED)
119 {
120 _target_height = _unexpanded_height + vpadding;
121 }
122 else
123 {
124 _target_height = _expanded_height + vpadding;
125 }
126
127 min_height = last_height + ((_target_height - last_height) *_size_factor);
128 nat_height = last_height + ((_target_height - last_height) *_size_factor);
129 }
130
131 private void _change_state (ExpandingBinState new_state)
132 {
133 if (_state == new_state)
134 return;
135
136 _old_state = _state;
137 _state = new_state;
138
139 _size_factor = 0.0f;
140 switch (_state)
141 {
142 case ExpandingBinState.CLOSED:
143 var anim = animate (Clutter.AnimationMode.EASE_OUT_SINE, ANIMATION_TIME,
144 "size_factor", 1.0f,
145 "opacity", 0);
146 _target_height = 0.0f;
147
148 anim.completed.connect (() => {
149 if (_state == ExpandingBinState.CLOSED)
150 hide ();
151 });
152 break;
153
154 case ExpandingBinState.UNEXPANDED:
155 animate (_old_state == ExpandingBinState.CLOSED ? Clutter.AnimationMode.EASE_IN_SINE
156 : Clutter.AnimationMode.EASE_OUT_SINE,
157 ANIMATION_TIME,
158 "size_factor", 1.0f,
159 "opacity", 255);
160 _target_height = _unexpanded_height;
161 show ();
162 break;
163
164 case ExpandingBinState.EXPANDED:
165 animate (Clutter.AnimationMode.EASE_IN_SINE, ANIMATION_TIME,
166 "size_factor", 1.0f,
167 "opacity", 255);
168 get_child ().get_preferred_height (width, null, out _expanded_height);
169 _target_height = _expanded_height;
170 show ();
171 break;
172
173 default:
174 warning ("ExpandingBinState %d not supported", _state);
175 break;
176 }
177 }
178 }
179}
0180
=== modified file 'unity/unity-pixbuf-cache.vala'
--- unity/unity-pixbuf-cache.vala 2010-07-01 14:02:24 +0000
+++ unity/unity-pixbuf-cache.vala 2010-07-07 09:12:51 +0000
@@ -157,36 +157,50 @@
157157
158 if (ret == null)158 if (ret == null)
159 {159 {
160 try {160 if (gicon_as_string[0] == '/')
161 unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string);161 {
162 var info = theme.lookup_by_gicon (icon, size, 0);162 try {
163 if (info != null)163 ret = new Gdk.Pixbuf.from_file (gicon_as_string);
164 ret = info.load_icon ();164 } catch (Error err) {
165165 message (@"Unable to load $gicon_as_string as file: %s",
166 if (ret == null)166 err.message);
167 {167 }
168 /* There is some funkiness in some programs where they install168 }
169 * their icon to /usr/share/icons/hicolor/apps/, but they169
170 * name the Icon= key as `foo.$extension` which breaks loading170 if (ret == null)
171 * So we can try and work around that here.171 {
172 */172 try {
173 if (gicon_as_string.has_suffix (".png")173 unowned GLib.Icon icon = GLib.Icon.new_for_string (gicon_as_string);
174 || gicon_as_string.has_suffix (".xpm")174 var info = theme.lookup_by_gicon (icon, size, 0);
175 || gicon_as_string.has_suffix (".gir")175 if (info != null)
176 || gicon_as_string.has_suffix (".jpg"))176 ret = info.load_icon ();
177
178 if (ret == null)
177 {179 {
178 string real_name = gicon_as_string[0:gicon_as_string.length-4];180 /* There is some funkiness in some programs where they install
179 ret = theme.load_icon (real_name, size, 0);181 * their icon to /usr/share/icons/hicolor/apps/, but they
182 * name the Icon= key as `foo.$extension` which breaks loading
183 * So we can try and work around that here.
184 */
185 if (gicon_as_string.has_suffix (".png")
186 || gicon_as_string.has_suffix (".xpm")
187 || gicon_as_string.has_suffix (".gir")
188 || gicon_as_string.has_suffix (".jpg"))
189 {
190 string real_name = gicon_as_string[0:gicon_as_string.length-4];
191 ret = theme.load_icon (real_name, size, 0);
192 }
180 }193 }
181 }194
182195 } catch (Error e) {
183 if (ret is Pixbuf)196 warning (@"Unable to load icon $gicon_as_string: '%s'", e.message);
184 {197 }
185 cache[key] = ret;198 }
186 }199
187 } catch (Error e) {200 if (ret is Pixbuf)
188 warning (@"Unable to load icon $gicon_as_string: '%s'", e.message);201 {
189 }202 cache[key] = ret;
203 }
190 }204 }
191205
192 if (ret is Pixbuf)206 if (ret is Pixbuf)
193207
=== modified file 'vapi/clutk-0.3.vapi'
--- vapi/clutk-0.3.vapi 2010-03-25 13:26:16 +0000
+++ vapi/clutk-0.3.vapi 2010-07-07 09:12:51 +0000
@@ -162,8 +162,14 @@
162 public class IconView : Ctk.Actor, Clutter.Scriptable, Ctk.Focusable, Clutter.Container {162 public class IconView : Ctk.Actor, Clutter.Scriptable, Ctk.Focusable, Clutter.Container {
163 [CCode (type = "ClutterActor*", has_construct_function = false)]163 [CCode (type = "ClutterActor*", has_construct_function = false)]
164 public IconView ();164 public IconView ();
165 public uint get_n_cols ();
166 public uint get_n_rows ();
165 public int get_spacing ();167 public int get_spacing ();
166 public void set_spacing (int spacing);168 public void set_spacing (int spacing);
169 [NoAccessorMethod]
170 public bool auto_fade_children { get; set construct; }
171 public uint n_cols { get; }
172 public uint n_rows { get; }
167 public int spacing { get; set construct; }173 public int spacing { get; set construct; }
168 }174 }
169 [CCode (cheader_filename = "clutk/clutk.h")]175 [CCode (cheader_filename = "clutk/clutk.h")]