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
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2011-10-03 11:59:04 +0000
3+++ src/daemon.vala 2011-10-05 10:53:26 +0000
4@@ -343,7 +343,8 @@
5 scope.freeze_notify ();
6
7 var model = scope.results_model;
8- model.clear ();
9+ /* We'll clear the model once we finish waiting for the dbus-call
10+ * to finish, to prevent flicker. */
11
12 debug ("Searching for: %s", search.search_string);
13
14@@ -356,30 +357,15 @@
15 bool has_search = !Utils.search_is_invalid (search);
16
17 Timer timer = new Timer ();
18- Set<string> installed_uris = new HashSet<string> ();
19- Set<string> available_uris = new HashSet<string> ();
20- var appresults = appsearcher.search (pkg_search_string, 0,
21- Unity.Package.SearchType.PREFIX,
22- has_search ?
23- Unity.Package.Sort.BY_RELEVANCY :
24- Unity.Package.Sort.BY_NAME);
25- add_pkg_search_result (appresults, installed_uris, available_uris, model,
26- Category.INSTALLED);
27-
28- timer.stop ();
29- debug ("Entry search listed %i Installed apps in %fms for query: %s",
30- appresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
31-
32- /* We force a flush of the shared model's revision queue here because
33- * generally the search for Installed apps is orders of magnitude faster
34- * than the search for Most Popular and Available apps.
35- * So we can update the UI quicker */
36- (model as Dee.SharedModel).flush_revision_queue ();
37-
38+
39 var zg_search_string = prepare_zg_search_string (search, type_id);
40
41+ /* Even though the Installed apps search is super fast, we wait here
42+ * for the Most Popular search to finish, because otherwise we'll update
43+ * the Installed category too soon and this will cause flicker
44+ * in the Dash. (lp:868192) */
45+
46 try {
47- timer.start ();
48 debug ("SEARCH_STRING: %s", zg_search_string);
49 var results = yield zg_index.search (zg_search_string,
50 new Zeitgeist.TimeRange.anytime(),
51@@ -389,6 +375,7 @@
52 Zeitgeist.ResultType.MOST_POPULAR_SUBJECTS,
53 null);
54
55+ model.clear ();
56 append_events_with_category (results, model, Category.MOST_USED);
57
58 timer.stop ();
59@@ -399,8 +386,24 @@
60 } catch (GLib.Error e) {
61 warning ("Error performing search '%s': %s",
62 search.search_string, e.message);
63+ model.clear ();
64 }
65+
66+ timer.start ();
67+ Set<string> installed_uris = new HashSet<string> ();
68+ Set<string> available_uris = new HashSet<string> ();
69+ var appresults = appsearcher.search (pkg_search_string, 0,
70+ Unity.Package.SearchType.PREFIX,
71+ has_search ?
72+ Unity.Package.Sort.BY_RELEVANCY :
73+ Unity.Package.Sort.BY_NAME);
74+ add_pkg_search_result (appresults, installed_uris, available_uris, model,
75+ Category.INSTALLED);
76
77+ timer.stop ();
78+ debug ("Entry search listed %i Installed apps in %fms for query: %s",
79+ appresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
80+
81 /* We force a flush of the shared model's revision queue here because
82 * generally the search for Most Used apps has a small result set,
83 * while the one for Available apps may be huge. The huge result set
84@@ -623,6 +626,13 @@
85 string desktop_id = Path.get_basename (pkginfo.desktop_file);
86 string full_path;
87
88+ /* S-C uses "app_name:desktop_id.desktop", get rid of the prefix */
89+ int colon_pos = desktop_id.index_of (":");
90+ if (colon_pos > 0)
91+ {
92+ desktop_id = desktop_id[colon_pos+1:desktop_id.length];
93+ }
94+
95 AppInfo? app = appmanager.lookup (desktop_id);
96 full_path = appmanager.get_path (desktop_id);
97
98@@ -791,17 +801,24 @@
99 }
100
101 /* Assert that we indeed have a known application as actor */
102- AppInfo? app = Utils.get_app_info_for_actor (app_uri);
103-
104+ string desktop_id = Utils.get_desktop_id_for_actor (app_uri);
105+ string full_path;
106+
107+ var appmanager = AppInfoManager.get_instance ();
108+ AppInfo? app = appmanager.lookup (desktop_id);
109+
110 if (app == null)
111 continue;
112
113 if (!app.should_show ())
114- continue;
115-
116+ continue;
117+
118+ full_path = appmanager.get_path (desktop_id);
119+ string full_uri = full_path != null ? "file://" + full_path : app_uri;
120+
121 results.append (app_uri, app.get_icon().to_string(), category_id,
122 "application/x-desktop", app.get_display_name (),
123- app.get_description (), app_uri);
124+ app.get_description (), full_uri);
125 }
126 }
127
128
129=== modified file 'src/utils.vala'
130--- src/utils.vala 2011-09-07 18:59:14 +0000
131+++ src/utils.vala 2011-10-05 10:53:26 +0000
132@@ -57,13 +57,12 @@
133 public string get_desktop_id_for_actor (string actor)
134 {
135 if (actor.has_prefix("application://"))
136- return actor.substring(14).dup();
137+ return actor.substring(14);
138 else if (actor.has_prefix("app://"))
139- return actor.substring(6).dup();
140+ return actor.substring(6);
141 else if (actor.has_prefix("/"))
142 {
143- var f = File.new_for_path (actor);
144- return f.get_basename ();
145+ return Path.get_basename (actor);
146 }
147
148 /* At this point we assume that @actor is already the basename of the

Subscribers

People subscribed via source and target branches