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
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2013-06-12 20:42:34 +0000
+++ src/daemon.vala 2013-06-14 08:28:25 +0000
@@ -505,6 +505,18 @@
505 return app == null;505 return app == null;
506 }506 }
507507
508 private bool is_phablet_ui (DeprecatedScopeSearch search)
509 {
510 // XXX: this will need changing when the hint is finalised.
511 unowned Variant? v = search.hints["form-factor"];
512 if (v != null)
513 {
514 string form_factor = v.get_string();
515 return form_factor == "phone" || form_factor == "tablet";
516 }
517 return false;
518 }
519
508 private async void update_scope_search (DeprecatedScopeSearch search,520 private async void update_scope_search (DeprecatedScopeSearch search,
509 GLib.Cancellable cancellable)521 GLib.Cancellable cancellable)
510 {522 {
@@ -521,6 +533,7 @@
521533
522 bool has_filter = (type_filter != null && type_filter.filtering);534 bool has_filter = (type_filter != null && type_filter.filtering);
523 bool has_search = !Utils.is_search_empty (search_string);535 bool has_search = !Utils.is_search_empty (search_string);
536 bool running_on_phablet = is_phablet_ui (search);
524537
525 Timer timer = new Timer ();538 Timer timer = new Timer ();
526539
@@ -543,7 +556,8 @@
543 {556 {
544 if (has_search) resort_pkg_search_results (appresults);557 if (has_search) resort_pkg_search_results (appresults);
545 add_pkg_search_result (appresults, installed_uris, available_uris,558 add_pkg_search_result (appresults, installed_uris, available_uris,
546 transaction, Category.INSTALLED);559 transaction, Category.INSTALLED,
560 0, running_on_phablet);
547 }561 }
548562
549 timer.stop ();563 timer.stop ();
@@ -605,7 +619,8 @@
605 Unity.Package.SearchType.PREFIX,619 Unity.Package.SearchType.PREFIX,
606 Unity.Package.Sort.BY_RELEVANCY);620 Unity.Package.Sort.BY_RELEVANCY);
607 add_pkg_search_result (pkgresults, installed_uris, available_uris,621 add_pkg_search_result (pkgresults, installed_uris, available_uris,
608 model, Category.AVAILABLE);622 model, Category.AVAILABLE,
623 0, running_on_phablet);
609 timer.stop ();624 timer.stop ();
610 debug ("Entry search listed %i Available apps in %fms for query: %s",625 debug ("Entry search listed %i Available apps in %fms for query: %s",
611 pkgresults.num_hits, timer.elapsed ()*1000, pkg_search_string);626 pkgresults.num_hits, timer.elapsed ()*1000, pkg_search_string);
@@ -617,7 +632,7 @@
617632
618 var pkgresults = pkgsearcher.get_apps (filter_query, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY, filter_cb);633 var pkgresults = pkgsearcher.get_apps (filter_query, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY, filter_cb);
619 purchase_info.from_pkgresults (pkgresults);634 purchase_info.from_pkgresults (pkgresults);
620 add_pkg_search_result (pkgresults, installed_uris, available_uris, model, Category.AVAILABLE, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY);635 add_pkg_search_result (pkgresults, installed_uris, available_uris, model, Category.AVAILABLE, MAX_APP_FOR_DOWNLOAD_FOR_EMPTY_QUERY, running_on_phablet);
621 timer.stop ();636 timer.stop ();
622 debug ("Entry search listed %i Available apps in %fms",637 debug ("Entry search listed %i Available apps in %fms",
623 pkgresults.num_hits, timer.elapsed ()*1000);638 pkgresults.num_hits, timer.elapsed ()*1000);
@@ -679,6 +694,7 @@
679 return;694 return;
680 }695 }
681696
697 bool running_on_phablet = is_phablet_ui (search);
682 var model = search.results_model;698 var model = search.results_model;
683699
684 model.clear ();700 model.clear ();
@@ -692,7 +708,7 @@
692 Unity.Package.Sort.BY_RELEVANCY);708 Unity.Package.Sort.BY_RELEVANCY);
693 resort_pkg_search_results (appresults);709 resort_pkg_search_results (appresults);
694 add_pkg_search_result (appresults, installed_uris, available_uris, model,710 add_pkg_search_result (appresults, installed_uris, available_uris, model,
695 Category.APPLICATIONS);711 Category.APPLICATIONS, 0, running_on_phablet);
696712
697 timer.stop ();713 timer.stop ();
698 debug ("Global search listed %i Installed apps in %fms for query: %s",714 debug ("Global search listed %i Installed apps in %fms for query: %s",
@@ -933,7 +949,8 @@
933 Set<string> available_uris,949 Set<string> available_uris,
934 Dee.Model model,950 Dee.Model model,
935 Category category,951 Category category,
936 uint max_add=0)952 uint max_add,
953 bool running_on_phablet)
937 {954 {
938 var appmanager = AppInfoManager.get_default();955 var appmanager = AppInfoManager.get_default();
939 uint n_added = 0;956 uint n_added = 0;
@@ -950,6 +967,30 @@
950 AppInfo? app = appmanager.lookup (desktop_id);967 AppInfo? app = appmanager.lookup (desktop_id);
951 full_path = appmanager.get_path (desktop_id);968 full_path = appmanager.get_path (desktop_id);
952969
970 if (running_on_phablet)
971 {
972 // XXX: This filtering should be pushed down to the Xapian
973 // index and query builder logic.
974 bool x_ubuntu_touch = false;
975 if (full_path != null)
976 {
977 GLib.KeyFile key_file = new GLib.KeyFile();
978 key_file.load_from_file(full_path, GLib.KeyFileFlags.NONE);
979 try {
980 x_ubuntu_touch = key_file.get_boolean("Desktop Entry", "X-Ubuntu-Touch");
981 }
982 catch (GLib.KeyFileError e)
983 {
984 x_ubuntu_touch = false;
985 }
986 }
987
988 if (!x_ubuntu_touch)
989 {
990 continue;
991 }
992 }
993
953 /* De-dupe by 'application://foo.desktop' URI. Also note that we need994 /* De-dupe by 'application://foo.desktop' URI. Also note that we need
954 * to de-dupe before we chuck out NoDisplay app infos, otherwise they'd995 * to de-dupe before we chuck out NoDisplay app infos, otherwise they'd
955 * show up from alternate sources */996 * show up from alternate sources */

Subscribers

People subscribed via source and target branches