Merge lp:~didrocks/unity-lens-shopping/add-conditional-activation into lp:unity-lens-shopping

Proposed by Didier Roche
Status: Merged
Approved by: Michal Hruby
Approved revision: 28
Merged at revision: 23
Proposed branch: lp:~didrocks/unity-lens-shopping/add-conditional-activation
Merge into: lp:unity-lens-shopping
Diff against target: 76 lines (+33/-1)
3 files modified
configure.ac (+1/-1)
src/scope.vala (+16/-0)
tests/manual-tests/shopping-lens-tests.txt (+16/-0)
To merge this branch: bzr merge lp:~didrocks/unity-lens-shopping/add-conditional-activation
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+126385@code.launchpad.net

Commit message

add conditional search activation to the shopping lens (LP: #1054746).

Description of the change

add conditional search activation to the shopping lens (LP: #1054746).

Manual test (like the rest of the lens) added

To post a comment you must log in.
23. By Didier Roche

just invoke the singleton once

24. By Didier Roche

bump the libunity build-dep

25. By Didier Roche

fix typo

26. By Didier Roche

comply to latest API

27. By Didier Roche

listen to property change to retrigger a search and remove a message

28. By Didier Roche

simplify the flow

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

Great! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-09-25 18:34:26 +0000
3+++ configure.ac 2012-09-26 15:26:32 +0000
4@@ -64,7 +64,7 @@
5 gee-1.0
6 libsoup-gnome-2.4
7 json-glib-1.0
8- unity >= 5.93.0)
9+ unity >= 6.7)
10
11 AC_SUBST(LENS_DAEMON_CFLAGS)
12 AC_SUBST(LENS_DAEMON_LIBS)
13
14=== modified file 'src/scope.vala'
15--- src/scope.vala 2012-09-26 11:10:59 +0000
16+++ src/scope.vala 2012-09-26 15:26:32 +0000
17@@ -30,6 +30,8 @@
18 private Soup.Session session;
19 private PreviewPlayerHandler player;
20
21+ private PreferencesManager preferences = PreferencesManager.get_default ();
22+
23 public ShoppingScope ()
24 {
25 Object (dbus_path: "/com/canonical/unity/scope/shopping");
26@@ -73,12 +75,26 @@
27 global_results_details_map = new HashTable<string, string> (str_hash,
28 str_equal);
29 global_results_model.set_data ("details-map", global_results_details_map);
30+
31+ preferences.notify["remote-content-search"].connect ((obj, pspec) => { queue_search_changed (SearchType.GLOBAL); });
32 }
33
34 private async void update_search_async (LensSearch search,
35 SearchType search_type,
36 Cancellable cancellable)
37 {
38+
39+ /**
40+ * only perform the request if the user has not disabled
41+ * online/commercial suggestions. That will hide the category as well.
42+ */
43+ if (preferences.remote_content_search != Unity.PreferencesManager.RemoteContent.ALL)
44+ {
45+ search.results_model.clear ();
46+ search.finished ();
47+ return;
48+ }
49+
50 if (search_type == SearchType.GLOBAL)
51 yield perform_global_search (search, cancellable);
52 else
53
54=== modified file 'tests/manual-tests/shopping-lens-tests.txt'
55--- tests/manual-tests/shopping-lens-tests.txt 2012-09-18 12:22:25 +0000
56+++ tests/manual-tests/shopping-lens-tests.txt 2012-09-26 15:26:32 +0000
57@@ -69,3 +69,19 @@
58
59 Expected Results:
60 Web site for selected item is opened in web browser, with an option to complete purchase.
61+
62+'Disable' Shopping Lens Search
63+----------------------------------------------------
64+Disabling the shopping lens should not show any result.
65+
66+Setup:
67+Internet connectivity.
68+
69+Actions:
70+Disable the online/commercial search in gnome-control-center or directly in gsettings
71+(com.canonical.Unity.Lenses "remote-content-search" to none)
72+Perfom a search in the home dash
73+
74+Expected Results:
75+No "More suggestions" category should appear. If the lens is run manually,
76+a "Unity shopping lens online search disabled." message should appear.

Subscribers

People subscribed via source and target branches

to all changes: