Merge lp:~mhr3/unity-lens-applications/fix-annoyances into lp:unity-lens-applications

Proposed by Michal Hruby
Status: Merged
Merged at revision: 245
Proposed branch: lp:~mhr3/unity-lens-applications/fix-annoyances
Merge into: lp:unity-lens-applications
Diff against target: 148 lines (+47/-31)
2 files modified
src/daemon.vala (+44/-27)
src/utils.vala (+3/-4)
To merge this branch: bzr merge lp:~mhr3/unity-lens-applications/fix-annoyances
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+78229@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Functionally: All linked bugs confirmed fixed, and no regression detected.

Code wise: Everything looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2011-10-03 11:59:04 +0000
+++ src/daemon.vala 2011-10-05 10:53:26 +0000
@@ -343,7 +343,8 @@
343 scope.freeze_notify ();343 scope.freeze_notify ();
344344
345 var model = scope.results_model;345 var model = scope.results_model;
346 model.clear ();346 /* We'll clear the model once we finish waiting for the dbus-call
347 * to finish, to prevent flicker. */
347348
348 debug ("Searching for: %s", search.search_string);349 debug ("Searching for: %s", search.search_string);
349 350
@@ -356,30 +357,15 @@
356 bool has_search = !Utils.search_is_invalid (search);357 bool has_search = !Utils.search_is_invalid (search);
357 358
358 Timer timer = new Timer ();359 Timer timer = new Timer ();
359 Set<string> installed_uris = new HashSet<string> ();360
360 Set<string> available_uris = new HashSet<string> ();
361 var appresults = appsearcher.search (pkg_search_string, 0,
362 Unity.Package.SearchType.PREFIX,
363 has_search ?
364 Unity.Package.Sort.BY_RELEVANCY :
365 Unity.Package.Sort.BY_NAME);
366 add_pkg_search_result (appresults, installed_uris, available_uris, model,
367 Category.INSTALLED);
368
369 timer.stop ();
370 debug ("Entry search listed %i Installed apps in %fms for query: %s",
371 appresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
372
373 /* We force a flush of the shared model's revision queue here because
374 * generally the search for Installed apps is orders of magnitude faster
375 * than the search for Most Popular and Available apps.
376 * So we can update the UI quicker */
377 (model as Dee.SharedModel).flush_revision_queue ();
378
379 var zg_search_string = prepare_zg_search_string (search, type_id);361 var zg_search_string = prepare_zg_search_string (search, type_id);
380362
363 /* Even though the Installed apps search is super fast, we wait here
364 * for the Most Popular search to finish, because otherwise we'll update
365 * the Installed category too soon and this will cause flicker
366 * in the Dash. (lp:868192) */
367
381 try {368 try {
382 timer.start ();
383 debug ("SEARCH_STRING: %s", zg_search_string);369 debug ("SEARCH_STRING: %s", zg_search_string);
384 var results = yield zg_index.search (zg_search_string,370 var results = yield zg_index.search (zg_search_string,
385 new Zeitgeist.TimeRange.anytime(),371 new Zeitgeist.TimeRange.anytime(),
@@ -389,6 +375,7 @@
389 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,375 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,
390 null);376 null);
391377
378 model.clear ();
392 append_events_with_category (results, model, Category.MOST_USED);379 append_events_with_category (results, model, Category.MOST_USED);
393 380
394 timer.stop ();381 timer.stop ();
@@ -399,8 +386,24 @@
399 } catch (GLib.Error e) {386 } catch (GLib.Error e) {
400 warning ("Error performing search '%s': %s",387 warning ("Error performing search '%s': %s",
401 search.search_string, e.message);388 search.search_string, e.message);
389 model.clear ();
402 }390 }
391
392 timer.start ();
393 Set<string> installed_uris = new HashSet<string> ();
394 Set<string> available_uris = new HashSet<string> ();
395 var appresults = appsearcher.search (pkg_search_string, 0,
396 Unity.Package.SearchType.PREFIX,
397 has_search ?
398 Unity.Package.Sort.BY_RELEVANCY :
399 Unity.Package.Sort.BY_NAME);
400 add_pkg_search_result (appresults, installed_uris, available_uris, model,
401 Category.INSTALLED);
403 402
403 timer.stop ();
404 debug ("Entry search listed %i Installed apps in %fms for query: %s",
405 appresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
406
404 /* We force a flush of the shared model's revision queue here because407 /* We force a flush of the shared model's revision queue here because
405 * generally the search for Most Used apps has a small result set,408 * generally the search for Most Used apps has a small result set,
406 * while the one for Available apps may be huge. The huge result set409 * while the one for Available apps may be huge. The huge result set
@@ -623,6 +626,13 @@
623 string desktop_id = Path.get_basename (pkginfo.desktop_file);626 string desktop_id = Path.get_basename (pkginfo.desktop_file);
624 string full_path;627 string full_path;
625628
629 /* S-C uses "app_name:desktop_id.desktop", get rid of the prefix */
630 int colon_pos = desktop_id.index_of (":");
631 if (colon_pos > 0)
632 {
633 desktop_id = desktop_id[colon_pos+1:desktop_id.length];
634 }
635
626 AppInfo? app = appmanager.lookup (desktop_id);636 AppInfo? app = appmanager.lookup (desktop_id);
627 full_path = appmanager.get_path (desktop_id);637 full_path = appmanager.get_path (desktop_id);
628 638
@@ -791,17 +801,24 @@
791 }801 }
792 802
793 /* Assert that we indeed have a known application as actor */803 /* Assert that we indeed have a known application as actor */
794 AppInfo? app = Utils.get_app_info_for_actor (app_uri);804 string desktop_id = Utils.get_desktop_id_for_actor (app_uri);
795 805 string full_path;
806
807 var appmanager = AppInfoManager.get_instance ();
808 AppInfo? app = appmanager.lookup (desktop_id);
809
796 if (app == null)810 if (app == null)
797 continue;811 continue;
798 812
799 if (!app.should_show ())813 if (!app.should_show ())
800 continue; 814 continue;
801 815
816 full_path = appmanager.get_path (desktop_id);
817 string full_uri = full_path != null ? "file://" + full_path : app_uri;
818
802 results.append (app_uri, app.get_icon().to_string(), category_id,819 results.append (app_uri, app.get_icon().to_string(), category_id,
803 "application/x-desktop", app.get_display_name (),820 "application/x-desktop", app.get_display_name (),
804 app.get_description (), app_uri);821 app.get_description (), full_uri);
805 }822 }
806 }823 }
807 824
808825
=== modified file 'src/utils.vala'
--- src/utils.vala 2011-09-07 18:59:14 +0000
+++ src/utils.vala 2011-10-05 10:53:26 +0000
@@ -57,13 +57,12 @@
57 public string get_desktop_id_for_actor (string actor)57 public string get_desktop_id_for_actor (string actor)
58 {58 {
59 if (actor.has_prefix("application://"))59 if (actor.has_prefix("application://"))
60 return actor.substring(14).dup();60 return actor.substring(14);
61 else if (actor.has_prefix("app://"))61 else if (actor.has_prefix("app://"))
62 return actor.substring(6).dup();62 return actor.substring(6);
63 else if (actor.has_prefix("/"))63 else if (actor.has_prefix("/"))
64 {64 {
65 var f = File.new_for_path (actor);65 return Path.get_basename (actor);
66 return f.get_basename ();
67 }66 }
68 67
69 /* At this point we assume that @actor is already the basename of the68 /* At this point we assume that @actor is already the basename of the

Subscribers

People subscribed via source and target branches