Merge lp:~unity-team/unity/places-fixes-2010-09-22 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Merged at revision: 544
Proposed branch: lp:~unity-team/unity/places-fixes-2010-09-22
Merge into: lp:unity
Diff against target: 493 lines (+155/-26)
13 files modified
targets/mutter/plugin.vala (+4/-4)
unity-private/launcher/application-controller.vala (+9/-4)
unity-private/places/places-controller.vala (+1/-0)
unity-private/places/places-default-renderer-group.vala (+1/-1)
unity-private/places/places-default-renderer.vala (+7/-1)
unity-private/places/places-place-home-renderer.vala (+2/-1)
unity-private/places/places-place-home.vala (+61/-1)
unity-private/places/places-place-search-bar.vala (+28/-2)
unity-private/places/places-place-search-navigation.vala (+9/-0)
unity-private/places/places-place.vala (+3/-3)
unity-private/places/places-view.vala (+28/-8)
unity-private/unity-utils.c (+1/-0)
unity/theme.vala (+1/-1)
To merge this branch: bzr merge lp:~unity-team/unity/places-fixes-2010-09-22
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+36332@code.launchpad.net

Description of the change

All bug reports linked

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

CODE REVIEW:
unity-private/places/places-place-home.vala:
 You are using ObjectRegistry to look up the view. This seems like a pretty big hack, abusing the testing infrastructure..?

FUNCTIONAL REVIEW:

Bug #607821: Search Field does not behave as specified when the search fails
 - Fix confirmed

Bug #607829: Clicking a Place icon while viewing the same place in the Dash should return to the Home screen of that place and clear the search
 - Fix confirmed

Bug #612562: URI activation in global view
 - Fix confirmed

Bug #634364: unity crashed with SIGSEGV in unity_places_place_entry_remote_set_active()
 - I could reproduce this now. See http://paste.ubuntu.com/498597/. I can't exactly figure out where to insert the null checks. And frankly I am more concerned why u-p-a fails to come up...

Bug #637136: launchers should act like if the application was not focussed in the place views
 - Fix confirmed

Bug #638402: clicking on a category from CoFs does not directly take you to the desired category
 - Fix confirmed

Bug #638857: dash initial icons states
 - Fix confirmed

Bug #641554: cropping an image in shotwell crashes unity
 - Not tested

Bug #641669: Launcher loads 48 px icons instead of 32 px
 - Fix confirmed

Bug #641894: Clicking on the "Files & Folders" icon while a folder is already displayed in the overlay view causes unity to crash and re-start
 - I get a crash here still. 100% reproducible.

Bug #642669: mutter crashes when closing pop-up dialog
 - I still get very rare crashes when I close the 'bzr gcommit' dialog, in maximized state, when clicking the commit button

Bug #643627: mutter crashed with SIGSEGV in unity_places_place_entry_get_parent()
 -

Bug #644215: "Applications" and "Files & Folders" tooltips are not translatable
 - Fix confirmed

CONCLUSION
 * Can you recheck the fix for bug #641894?
 * Bug #634364 scares me a bit... I don't have a ready fix right now.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Bugs #634364, #641894, and #643627 have been removed from the fixes-list of this merge proposal and re-opened as agreed with Neil.

The ObjectRegistry hack was is acknowledged as a hack. We'll fix it properly for Natty.

Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'targets/mutter/plugin.vala'
--- targets/mutter/plugin.vala 2010-09-22 04:36:17 +0000
+++ targets/mutter/plugin.vala 2010-09-22 16:03:41 +0000
@@ -844,10 +844,10 @@
844 {844 {
845 window = actor as Mutter.Window;845 window = actor as Mutter.Window;
846846
847 if (start_pan_window.get_window_type () != Mutter.MetaCompWindowType.NORMAL &&847 if (window.get_window_type () != Mutter.MetaCompWindowType.NORMAL &&
848 start_pan_window.get_window_type () != Mutter.MetaCompWindowType.DIALOG &&848 window.get_window_type () != Mutter.MetaCompWindowType.DIALOG &&
849 start_pan_window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG &&849 window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG &&
850 start_pan_window.get_window_type () != Mutter.MetaCompWindowType.UTILITY)850 window.get_window_type () != Mutter.MetaCompWindowType.UTILITY)
851 window = null;851 window = null;
852 }852 }
853853
854854
=== modified file 'unity-private/launcher/application-controller.vala'
--- unity-private/launcher/application-controller.vala 2010-09-02 10:59:56 +0000
+++ unity-private/launcher/application-controller.vala 2010-09-22 16:03:41 +0000
@@ -349,14 +349,18 @@
349349
350 public override void activate ()350 public override void activate ()
351 {351 {
352 global_shell.hide_unity ();
353
354 if (app is Bamf.Application)352 if (app is Bamf.Application)
355 {353 {
356 if (app.is_active ())354 if (app.is_active ())
357 {355 {
358 Array<uint32> xids = app.get_xids ();356 /* We only want to do expose if the window was _actually_
359 global_shell.expose_xids (xids);357 * active i.e. the dash wasn't showing.
358 */
359 if (global_shell.get_mode () == ShellMode.MINIMIZED)
360 {
361 Array<uint32> xids = app.get_xids ();
362 global_shell.expose_xids (xids);
363 }
360 }364 }
361 else if (app.is_running ())365 else if (app.is_running ())
362 {366 {
@@ -384,6 +388,7 @@
384 warning (e.message);388 warning (e.message);
385 }389 }
386 }390 }
391 global_shell.hide_unity ();
387 }392 }
388393
389 private bool on_launch_timeout ()394 private bool on_launch_timeout ()
390395
=== modified file 'unity-private/places/places-controller.vala'
--- unity-private/places/places-controller.vala 2010-08-18 22:04:31 +0000
+++ unity-private/places/places-controller.vala 2010-09-22 16:03:41 +0000
@@ -119,6 +119,7 @@
119 shell.show_unity ();119 shell.show_unity ();
120 }120 }
121 view.on_entry_view_activated (cont.entry, section_id);121 view.on_entry_view_activated (cont.entry, section_id);
122 view.search_bar.reset ();
122 }123 }
123 }124 }
124}125}
125126
=== modified file 'unity-private/places/places-default-renderer-group.vala'
--- unity-private/places/places-default-renderer-group.vala 2010-09-22 09:51:13 +0000
+++ unity-private/places/places-default-renderer-group.vala 2010-09-22 16:03:41 +0000
@@ -72,7 +72,7 @@
72 private bool last_result_timeout = false;72 private bool last_result_timeout = false;
7373
74 public signal void activated (string uri, string mimetype);74 public signal void activated (string uri, string mimetype);
7575
76 private GLib.List<Tile?> cleanup_tiles = new GLib.List<Tile?> ();76 private GLib.List<Tile?> cleanup_tiles = new GLib.List<Tile?> ();
77 private uint cleanup_operation = 0;77 private uint cleanup_operation = 0;
7878
7979
=== modified file 'unity-private/places/places-default-renderer.vala'
--- unity-private/places/places-default-renderer.vala 2010-09-17 17:22:27 +0000
+++ unity-private/places/places-default-renderer.vala 2010-09-22 16:03:41 +0000
@@ -17,6 +17,8 @@
17 *17 *
18 */18 */
1919
20using Unity.Testing;
21
20namespace Unity.Places22namespace Unity.Places
21{23{
22 public class DefaultRenderer : LayeredBin, Unity.Place.Renderer24 public class DefaultRenderer : LayeredBin, Unity.Place.Renderer
@@ -40,6 +42,7 @@
40 private Ctk.VBox box;42 private Ctk.VBox box;
41 private Dee.Model groups_model;43 private Dee.Model groups_model;
42 private Dee.Model results_model;44 private Dee.Model results_model;
45 private Places.View place_view;
4346
44 private string[] expanded = null;47 private string[] expanded = null;
4548
@@ -285,6 +288,8 @@
285 box.homogeneous = false;288 box.homogeneous = false;
286 scroll.add_actor (box);289 scroll.add_actor (box);
287 box.show ();290 box.show ();
291
292 place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View;
288 }293 }
289294
290 /*295 /*
@@ -342,6 +347,8 @@
342 300,347 300,
343 "opacity", groups_box_opacity);348 "opacity", groups_box_opacity);
344349
350 place_view.search_bar.search_fail = section_empty.active
351 || search_empty.active;
345 }352 }
346353
347 private void activate_default ()354 private void activate_default ()
@@ -687,4 +694,3 @@
687 }694 }
688 }695 }
689}696}
690
691697
=== modified file 'unity-private/places/places-place-home-renderer.vala'
--- unity-private/places/places-place-home-renderer.vala 2010-09-14 08:50:05 +0000
+++ unity-private/places/places-place-home-renderer.vala 2010-09-22 16:03:41 +0000
@@ -183,7 +183,7 @@
183 }183 }
184 }184 }
185185
186 public class HomeButton : Ctk.Button186 public class HomeButton : Button
187 {187 {
188 static const int ICON_SIZE = 128;188 static const int ICON_SIZE = 128;
189189
@@ -201,6 +201,7 @@
201201
202 construct202 construct
203 {203 {
204 padding = { 0.0f, 0.0f, 8.0f, 0.0f };
204 get_image ().size = 128;205 get_image ().size = 128;
205 get_image ().filename = icon;206 get_image ().filename = icon;
206 get_text ().text = name;207 get_text ().text = name;
207208
=== modified file 'unity-private/places/places-place-home.vala'
--- unity-private/places/places-place-home.vala 2010-08-26 11:14:00 +0000
+++ unity-private/places/places-place-home.vala 2010-09-22 16:03:41 +0000
@@ -17,6 +17,7 @@
17 *17 *
18 */18 */
19using Unity;19using Unity;
20using Unity.Testing;
2021
21namespace Unity.Places22namespace Unity.Places
22{23{
@@ -62,6 +63,7 @@
62 public PlaceModel place_model { get; set construct; }63 public PlaceModel place_model { get; set construct; }
6364
64 private Gee.HashMap<PlaceEntry?, uint> entry_group_map;65 private Gee.HashMap<PlaceEntry?, uint> entry_group_map;
66 private Places.View place_view = null;
6567
66 public PlaceHomeEntry (Shell shell, PlaceModel model)68 public PlaceHomeEntry (Shell shell, PlaceModel model)
67 {69 {
@@ -131,6 +133,7 @@
131 5, _model.get_string (it, 5),133 5, _model.get_string (it, 5),
132 -1);134 -1);
133135
136 update_search_failed ();
134 });137 });
135138
136 entry.global_results_model.row_removed.connect ((it) => {139 entry.global_results_model.row_removed.connect ((it) => {
@@ -149,11 +152,28 @@
149152
150 i = _model.next (i);153 i = _model.next (i);
151 }154 }
155
156 update_search_failed ();
152 });157 });
153 });158 });
154 }159 }
155 }160 }
156161
162 private void update_search_failed ()
163 {
164 if (place_view == null)
165 place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View;
166
167 if (entry_results_model.get_n_rows () > 0)
168 {
169 place_view.search_bar.search_fail = false;
170 }
171 else
172 {
173 place_view.search_bar.search_fail = true;
174 }
175 }
176
157 /*177 /*
158 * Public Methods178 * Public Methods
159 */179 */
@@ -168,7 +188,10 @@
168188
169 if (search == "" || search == null)189 if (search == "" || search == null)
170 {190 {
191 if (place_view == null)
192 place_view = ObjectRegistry.get_default ().lookup ("UnityPlacesView")[0] as View;
171 entry_renderer_name = "UnityHomeScreen";193 entry_renderer_name = "UnityHomeScreen";
194 place_view.search_bar.search_fail = false;
172 }195 }
173 else196 else
174 {197 {
@@ -202,6 +225,43 @@
202 {225 {
203226
204 }227 }
228
229 public unowned PlaceEntry? get_entry_for_uri (string uri)
230 {
231 int entry_id = -1;
232
233 unowned Dee.ModelIter iter = entry_results_model.get_first_iter ();
234 while (!entry_results_model.is_last (iter))
235 {
236 if (uri == entry_results_model.get_string (iter, 0))
237 {
238 entry_id = (int) entry_results_model.get_uint (iter, 2);
239 break;
240 }
241
242 iter = entry_results_model.next (iter);
243 }
244
245 if (entry_id >= 0)
246 {
247 unowned PlaceEntry? ent = null;
248
249 foreach (Gee.Map.Entry<PlaceEntry, uint> e in entry_group_map.entries)
250 {
251 PlaceEntry? entry = e.key;
252
253 if (entry != null && entry_id == e.value)
254 {
255 ent = entry;
256 break;
257 }
258 }
259
260 if (ent is PlaceEntry)
261 return ent;
262 }
263
264 return null;
265 }
205 }266 }
206}267}
207
208268
=== modified file 'unity-private/places/places-place-search-bar.vala'
--- unity-private/places/places-place-search-bar.vala 2010-09-16 14:35:22 +0000
+++ unity-private/places/places-place-search-bar.vala 2010-09-22 16:03:41 +0000
@@ -34,6 +34,19 @@
34 public PlaceSearchSectionsBar sections;34 public PlaceSearchSectionsBar sections;
35 public PlaceSearchExtraAction extra_action;35 public PlaceSearchExtraAction extra_action;
3636
37 private bool _search_fail = false;
38 public bool search_fail {
39 get { return _search_fail; }
40 set {
41 if (_search_fail != value)
42 {
43 _search_fail = value;
44 bg.search_empty = _search_fail;
45 bg.update_background ();
46 }
47 }
48 }
49
37 public PlaceSearchBar ()50 public PlaceSearchBar ()
38 {51 {
39 Object (orientation:Ctk.Orientation.HORIZONTAL,52 Object (orientation:Ctk.Orientation.HORIZONTAL,
@@ -83,6 +96,7 @@
8396
84 public void reset ()97 public void reset ()
85 {98 {
99 search_fail = false;
86 entry.reset ();100 entry.reset ();
87 }101 }
88102
@@ -170,9 +184,10 @@
170 active_entry = entry;184 active_entry = entry;
171 bg.entry_position = x;185 bg.entry_position = x;
172 sections.set_active_entry (entry);186 sections.set_active_entry (entry);
173 if (section != 0)187
188 if (!(sections.style == SectionStyle.BREADCRUMB && section ==0))
174 {189 {
175 Idle.add (() => {190 Timeout.add (0, () => {
176 sections.set_active_section (section);191 sections.set_active_section (section);
177 return false;192 return false;
178 });193 });
@@ -224,6 +239,8 @@
224 private Clutter.CairoTexture texture;239 private Clutter.CairoTexture texture;
225 private Ctk.EffectGlow glow;240 private Ctk.EffectGlow glow;
226241
242 public bool search_empty { get; set; }
243
227 public PlaceSearchNavigation navigation { get; construct; }244 public PlaceSearchNavigation navigation { get; construct; }
228 public PlaceSearchEntry search_entry { get; construct; }245 public PlaceSearchEntry search_entry { get; construct; }
229246
@@ -257,6 +274,8 @@
257 glow.set_factor (1.0f);274 glow.set_factor (1.0f);
258 glow.set_margin (5);275 glow.set_margin (5);
259 add_effect (glow);276 add_effect (glow);
277
278 search_empty = false;
260 }279 }
261280
262 private override void allocate (Clutter.ActorBox box,281 private override void allocate (Clutter.ActorBox box,
@@ -407,6 +426,13 @@
407 cr.fill_preserve ();426 cr.fill_preserve ();
408427
409 cr.set_operator (Cairo.Operator.OVER);428 cr.set_operator (Cairo.Operator.OVER);
429
430 if (search_empty)
431 {
432 cr.set_source_rgba (1.0f, 0.0f, 0.0f, 0.3f);
433 cr.fill_preserve ();
434 }
435
410 cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.6f);436 cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.6f);
411 cr.stroke ();437 cr.stroke ();
412438
413439
=== modified file 'unity-private/places/places-place-search-navigation.vala'
--- unity-private/places/places-place-search-navigation.vala 2010-09-21 15:39:09 +0000
+++ unity-private/places/places-place-search-navigation.vala 2010-09-22 16:03:41 +0000
@@ -138,6 +138,9 @@
138138
139 private async void refresh_states ()139 private async void refresh_states ()
140 {140 {
141 if (remote == null)
142 return;
143
141 try {144 try {
142 var states = yield remote.get_state ();145 var states = yield remote.get_state ();
143 back_sensitive = states[0].sensitive;146 back_sensitive = states[0].sensitive;
@@ -150,6 +153,9 @@
150153
151 private async void go_forward ()154 private async void go_forward ()
152 {155 {
156 if (remote == null)
157 return;
158
153 try {159 try {
154 var states = yield remote.go_forward ();160 var states = yield remote.go_forward ();
155 back_sensitive = states[0].sensitive;161 back_sensitive = states[0].sensitive;
@@ -161,6 +167,9 @@
161167
162 private async void go_back ()168 private async void go_back ()
163 {169 {
170 if (remote == null)
171 return;
172
164 try { 173 try {
165 var states = yield remote.go_back ();174 var states = yield remote.go_back ();
166 back_sensitive = states[0].sensitive;175 back_sensitive = states[0].sensitive;
167176
=== modified file 'unity-private/places/places-place.vala'
--- unity-private/places/places-place.vala 2010-09-16 12:42:01 +0000
+++ unity-private/places/places-place.vala 2010-09-22 16:03:41 +0000
@@ -377,9 +377,9 @@
377 return null;377 return null;
378 }378 }
379379
380 name = file.get_string (group, "Name");380 name = file.get_locale_string (group, "Name", null);
381 icon = file.get_string (group, "Icon");381 icon = file.get_locale_string (group, "Icon", null);
382 desc = file.get_string (group, "Description");382 desc = file.get_locale_string (group, "Description", null);
383 } catch (Error e) {383 } catch (Error e) {
384 warning (@"Cannot load entry '$group': %s", e.message);384 warning (@"Cannot load entry '$group': %s", e.message);
385 return null;385 return null;
386386
=== modified file 'unity-private/places/places-view.vala'
--- unity-private/places/places-view.vala 2010-09-14 08:50:05 +0000
+++ unity-private/places/places-view.vala 2010-09-22 16:03:41 +0000
@@ -18,6 +18,7 @@
18 *18 *
19 */19 */
20using Unity;20using Unity;
21using Unity.Testing;
2122
22namespace Unity.Places23namespace Unity.Places
23{24{
@@ -42,6 +43,8 @@
42 public View (Shell shell, PlaceModel model)43 public View (Shell shell, PlaceModel model)
43 {44 {
44 Object (shell:shell, orientation:Ctk.Orientation.VERTICAL, model:model);45 Object (shell:shell, orientation:Ctk.Orientation.VERTICAL, model:model);
46
47 Testing.ObjectRegistry.get_default ().register ("UnityPlacesView", this);
45 }48 }
4649
47 construct50 construct
@@ -49,6 +52,8 @@
49 about_to_show ();52 about_to_show ();
5053
51 shell.get_stage ().captured_event.connect (on_stage_event_captured);54 shell.get_stage ().captured_event.connect (on_stage_event_captured);
55
56
52 }57 }
5358
54 public void about_to_show ()59 public void about_to_show ()
@@ -123,6 +128,8 @@
123128
124 private void update_views (PlaceEntry entry, uint section_id=0)129 private void update_views (PlaceEntry entry, uint section_id=0)
125 {130 {
131 search_bar.set_active_entry_view (entry, 0, section_id);
132
126 /* Create the correct results view */133 /* Create the correct results view */
127 if (renderer is Clutter.Actor)134 if (renderer is Clutter.Actor)
128 {135 {
@@ -148,8 +155,6 @@
148 entry.entry_renderer_hints);155 entry.entry_renderer_hints);
149 renderer.show ();156 renderer.show ();
150 renderer.activated.connect (on_result_activated);157 renderer.activated.connect (on_result_activated);
151
152 search_bar.set_active_entry_view (entry, 0, section_id);
153 }158 }
154159
155 private void on_entry_renderer_info_changed (PlaceEntry entry)160 private void on_entry_renderer_info_changed (PlaceEntry entry)
@@ -183,14 +188,29 @@
183188
184 private void on_result_activated (string uri, string mimetype)189 private void on_result_activated (string uri, string mimetype)
185 {190 {
186 if (active_entry.parent is Place == false)191 ActivationStatus result;
192
193 if (active_entry is PlaceHomeEntry)
194 {
195 var e = (active_entry as PlaceHomeEntry).get_entry_for_uri (uri);
196
197 if (e is PlaceEntry)
198 result = e.parent.activate (uri, mimetype);
199 else
200 {
201 Place.activate_fallback.begin (uri);
202 result = ActivationStatus.ACTIVATED_FALLBACK;
203 }
204 }
205 else if (active_entry == null || active_entry.parent == null)
187 {206 {
188 Place.activate_fallback.begin (uri);207 Place.activate_fallback.begin (uri);
189 global_shell.hide_unity ();208 result = ActivationStatus.ACTIVATED_FALLBACK;
190 return;209 }
191 }210 else
192211 {
193 ActivationStatus result = active_entry.parent.activate (uri, mimetype);212 result = active_entry.parent.activate (uri, mimetype);
213 }
194 214
195 switch (result)215 switch (result)
196 {216 {
197217
=== modified file 'unity-private/unity-utils.c'
--- unity-private/unity-utils.c 2010-08-21 11:26:06 +0000
+++ unity-private/unity-utils.c 2010-09-22 16:03:41 +0000
@@ -240,6 +240,7 @@
240 XChangeProperty (display, window, net_wm_strut_partial,240 XChangeProperty (display, window, net_wm_strut_partial,
241 XA_CARDINAL, 32, PropModeReplace,241 XA_CARDINAL, 32, PropModeReplace,
242 (guchar *) &struts, 12);242 (guchar *) &struts, 12);
243 gdk_flush ();
243 gdk_error_trap_pop ();244 gdk_error_trap_pop ();
244}245}
245246
246247
=== modified file 'unity/theme.vala'
--- unity/theme.vala 2010-07-29 11:48:06 +0000
+++ unity/theme.vala 2010-09-22 16:03:41 +0000
@@ -66,7 +66,7 @@
66 if (theme.has_icon (icon_name))66 if (theme.has_icon (icon_name))
67 {67 {
68 var info = theme.lookup_icon (icon_name,68 var info = theme.lookup_icon (icon_name,
69 48,69 32,
70 0);70 0);
71 if (info != null)71 if (info != null)
72 {72 {