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

Proposed by Didier Roche-Tolomelli
Status: Merged
Approved by: Michal Hruby
Approved revision: 114
Merged at revision: 110
Proposed branch: lp:~didrocks/unity-lens-music/add-conditional-activation
Merge into: lp:unity-lens-music
Diff against target: 71 lines (+30/-1)
3 files modified
configure.ac (+1/-1)
src/musicstore-scope.vala (+14/-0)
tests/manual/activation-remote-scope.txt (+15/-0)
To merge this branch: bzr merge lp:~didrocks/unity-lens-music/add-conditional-activation
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+126395@code.launchpad.net

Commit message

add conditional search activation to the remote scope (LP: #1054746)

Description of the change

add conditional search activation to the music remote scope (LP: #1054746)

Add manual test as for the rest of the lens.

To post a comment you must log in.
113. By Didier Roche-Tolomelli

comply to latest API

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

Looking good, two things though:

37 + message ("Unity shopping lens online search disabled.");

Drop the msg, it's not necessary, and would only cause console spam since it's logged with every search.

21 + private PreferencesManager preferences = PreferencesManager.get_default ();

The scope should listen to changes on the remote_content_search property and call queue_search_changed() to make the setting take effect immediately.

review: Needs Fixing
114. By Didier Roche-Tolomelli

listen to remote change and remove message

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

Looking good.

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-19 06:25:55 +0000
3+++ configure.ac 2012-09-26 12:58:22 +0000
4@@ -64,7 +64,7 @@
5 sqlite3 >= 3.7.7
6 gee-1.0
7 json-glib-1.0
8- unity >= 4.99.0
9+ unity >= 6.7
10 tdb >= 1.2.6)
11
12 PKG_CHECK_MODULES(PREVIEW_PLAYER,
13
14=== modified file 'src/musicstore-scope.vala'
15--- src/musicstore-scope.vala 2012-09-14 16:02:22 +0000
16+++ src/musicstore-scope.vala 2012-09-26 12:58:22 +0000
17@@ -26,6 +26,7 @@
18 private MusicStoreCollection collection;
19 private PreviewPlayer preview_player;
20 private Unity.MusicPreview? music_preview;
21+ private PreferencesManager preferences = PreferencesManager.get_default ();
22
23 public MusicStoreScopeProxy ()
24 {
25@@ -41,6 +42,8 @@
26
27 collection = new MusicStoreCollection ();
28
29+ preferences.notify["remote-content-search"].connect((obj, pspec) => { scope.queue_search_changed(SearchType.DEFAULT); });
30+
31 try {
32 scope.export ();
33 } catch (GLib.IOError e) {
34@@ -189,6 +192,17 @@
35 {
36 if (is_search_empty (search))
37 return;
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 try {
51 debug ("model has %u rows before search", search.results_model.get_n_rows ());
52
53=== added file 'tests/manual/activation-remote-scope.txt'
54--- tests/manual/activation-remote-scope.txt 1970-01-01 00:00:00 +0000
55+++ tests/manual/activation-remote-scope.txt 2012-09-26 12:58:22 +0000
56@@ -0,0 +1,15 @@
57+'Disable' Music store Search
58+----------------------------------------------------
59+Disabling the music store scope should not show any remote fetched result.
60+
61+Setup:
62+Internet connectivity.
63+
64+Actions:
65+1. Disable the online/commercial search in gnome-control-center or directly in gsettings
66+(com.canonical.Unity.Lenses "remote-content-search" to none)
67+2 Perfom a search in the music lens
68+
69+Expected Results:
70+No "More suggestions" category should appear.
71+

Subscribers

People subscribed via source and target branches