Merge lp:~jamesh/unity-lens-applications/libunity7-phablet into lp:unity-lens-applications

Proposed by James Henstridge
Status: Merged
Approved by: Michal Hruby
Approved revision: 346
Merged at revision: 344
Proposed branch: lp:~jamesh/unity-lens-applications/libunity7-phablet
Merge into: lp:unity-lens-applications
Diff against target: 117 lines (+46/-5)
1 file modified
src/daemon.vala (+46/-5)
To merge this branch: bzr merge lp:~jamesh/unity-lens-applications/libunity7-phablet
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Needs Fixing
Review via email: mp+169116@code.launchpad.net

Commit message

Merge the phablet branch into trunk, making the removal of non-touch apps conditional on using the phablet API.

Description of the change

Merge the phablet branch changes into the trunk branch.

I have made the removal of non-touch apps conditional on a search.hints["phablet"] == true, so behaviour should not change the results for the desktop.

The phablet UI will need to provide this hint to have the search results filtered (and if we change the hint, this scope will need updating).

This is just a straight port of the changes in the branch as a first step: filtering the results should eventually be handled within the search index.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

The changelog entries should be dropped, IMO.

Can we go for form_factor == "phone" || form_factor == "tablet" or similar? This way we could support more flexibility later.

Let's go for a string hint of "form_factor" with values "desktop" (default), "phone", "tablet" for now.

review: Needs Fixing
Revision history for this message
Michal Hruby (mhr3) wrote :

128 + key_file.load_from_file(full_path, GLib.KeyFileFlags.NONE);
129 + try {
130 + x_ubuntu_touch = key_file.get_boolean("Desktop Entry", "X-Ubuntu-Touch");

Would be also nice to be able to cache this somehow. Couldn't we just use OnlyShowIn=Ubuntu;UbuntuTouch?

review: Needs Information
Revision history for this message
Michal Hruby (mhr3) wrote :

Or maybe a special Category?

Revision history for this message
Michal Hruby (mhr3) wrote :

> Or maybe a special Category?

FWIW bzoltan is investigating this possibility.

Revision history for this message
Michal Hruby (mhr3) wrote :

Ok, we agreed with bzoltan, Saviq and tvoss to use `Category=X-Ubuntu-Touch;` instead (of course there may be more categories defined, as per desktop file spec).

343. By James Henstridge

Switch hint to "form-factor".

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
344. By James Henstridge

Bump version to allow upgrades from Phablet installs, and remove extra
changelog entries as requested.

Revision history for this message
James Henstridge (jamesh) wrote :

I've updated the search hint as requested by Saviq. Do you want the code refactored to do category based filtering, or is it okay to leave that for a second merge proposal?

This branch is really just a merge of the existing phablet branch changes plus the search hint changes.

345. By James Henstridge

Remove version bump completely, after discussing with Saviq on IRC.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

No apps have the Categories defined yet, so let's leave it as is for now.

Other than the version bump we discussed, seems good to go. Will report back after I've tested the whole stack on devices.

346. By James Henstridge

Add a comment noting that the X-Ubuntu-Touch changes need to be fixed
when we move over to identifying the apps by category.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

LGTM

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 2013-06-12 20:42:34 +0000
3+++ src/daemon.vala 2013-06-14 08:28:25 +0000
4@@ -505,6 +505,18 @@
5 return app == null;
6 }
7
8+ private bool is_phablet_ui (DeprecatedScopeSearch search)
9+ {
10+ // XXX: this will need changing when the hint is finalised.
11+ unowned Variant? v = search.hints["form-factor"];
12+ if (v != null)
13+ {
14+ string form_factor = v.get_string();
15+ return form_factor == "phone" || form_factor == "tablet";
16+ }
17+ return false;
18+ }
19+
20 private async void update_scope_search (DeprecatedScopeSearch search,
21 GLib.Cancellable cancellable)
22 {
23@@ -521,6 +533,7 @@
24
25 bool has_filter = (type_filter != null && type_filter.filtering);
26 bool has_search = !Utils.is_search_empty (search_string);
27+ bool running_on_phablet = is_phablet_ui (search);
28
29 Timer timer = new Timer ();
30
31@@ -543,7 +556,8 @@
32 {
33 if (has_search) resort_pkg_search_results (appresults);
34 add_pkg_search_result (appresults, installed_uris, available_uris,
35- transaction, Category.INSTALLED);
36+ transaction, Category.INSTALLED,
37+ 0, running_on_phablet);
38 }
39
40 timer.stop ();
41@@ -605,7 +619,8 @@
42 Unity.Package.SearchType.PREFIX,
43 Unity.Package.Sort.BY_RELEVANCY);
44 add_pkg_search_result (pkgresults, installed_uris, available_uris,
45- model, Category.AVAILABLE);
46+ model, Category.AVAILABLE,
47+ 0, running_on_phablet);
48 timer.stop ();
49 debug ("Entry search listed %i Available apps in %fms for query: %s",
50 pkgresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
51@@ -617,7 +632,7 @@
52
53 var pkgresults = pkgsearcher.get_apps (filter_query, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY, filter_cb);
54 purchase_info.from_pkgresults (pkgresults);
55- add_pkg_search_result (pkgresults, installed_uris, available_uris, model, Category.AVAILABLE, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY);
56+ add_pkg_search_result (pkgresults, installed_uris, available_uris, model, Category.AVAILABLE, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY, running_on_phablet);
57 timer.stop ();
58 debug ("Entry search listed %i Available apps in %fms",
59 pkgresults.num_hits, timer.elapsed ()*1000);
60@@ -679,6 +694,7 @@
61 return;
62 }
63
64+ bool running_on_phablet = is_phablet_ui (search);
65 var model = search.results_model;
66
67 model.clear ();
68@@ -692,7 +708,7 @@
69 Unity.Package.Sort.BY_RELEVANCY);
70 resort_pkg_search_results (appresults);
71 add_pkg_search_result (appresults, installed_uris, available_uris, model,
72- Category.APPLICATIONS);
73+ Category.APPLICATIONS, 0, running_on_phablet);
74
75 timer.stop ();
76 debug ("Global search listed %i Installed apps in %fms for query: %s",
77@@ -933,7 +949,8 @@
78 Set<string> available_uris,
79 Dee.Model model,
80 Category category,
81- uint max_add=0)
82+ uint max_add,
83+ bool running_on_phablet)
84 {
85 var appmanager = AppInfoManager.get_default();
86 uint n_added = 0;
87@@ -950,6 +967,30 @@
88 AppInfo? app = appmanager.lookup (desktop_id);
89 full_path = appmanager.get_path (desktop_id);
90
91+ if (running_on_phablet)
92+ {
93+ // XXX: This filtering should be pushed down to the Xapian
94+ // index and query builder logic.
95+ bool x_ubuntu_touch = false;
96+ if (full_path != null)
97+ {
98+ GLib.KeyFile key_file = new GLib.KeyFile();
99+ key_file.load_from_file(full_path, GLib.KeyFileFlags.NONE);
100+ try {
101+ x_ubuntu_touch = key_file.get_boolean("Desktop Entry", "X-Ubuntu-Touch");
102+ }
103+ catch (GLib.KeyFileError e)
104+ {
105+ x_ubuntu_touch = false;
106+ }
107+ }
108+
109+ if (!x_ubuntu_touch)
110+ {
111+ continue;
112+ }
113+ }
114+
115 /* De-dupe by 'application://foo.desktop' URI. Also note that we need
116 * to de-dupe before we chuck out NoDisplay app infos, otherwise they'd
117 * show up from alternate sources */

Subscribers

People subscribed via source and target branches