Merge lp:~didrocks/unity-lens-video/add-disabling-remote-search into lp:unity-lens-video/remote-videos-scope-trunk

Proposed by Didier Roche-Tolomelli
Status: Merged
Approved by: Michal Hruby
Approved revision: 59
Merged at revision: 61
Proposed branch: lp:~didrocks/unity-lens-video/add-disabling-remote-search
Merge into: lp:unity-lens-video/remote-videos-scope-trunk
Diff against target: 52 lines (+14/-5)
1 file modified
src/unity-scope-video-remote (+14/-5)
To merge this branch: bzr merge lp:~didrocks/unity-lens-video/add-disabling-remote-search
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
David Callé Approve
Review via email: mp+126441@code.launchpad.net

Commit message

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

Description of the change

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

To post a comment you must log in.
Revision history for this message
David Callé (davidc3) wrote :

Effective way to disable search and results. Looks and works fine.

Revision history for this message
David Callé (davidc3) :
review: Approve
59. By Didier Roche-Tolomelli

listen to preference change and pend a new search once done. Remove an info message

Revision history for this message
Michal Hruby (mhr3) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-scope-video-remote'
2--- src/unity-scope-video-remote 2012-09-25 10:40:35 +0000
3+++ src/unity-scope-video-remote 2012-09-26 13:13:21 +0000
4@@ -83,9 +83,9 @@
5 self.scope.search_in_global = False
6 self.scope.connect("search-changed", self.on_search_changed)
7 self.scope.connect("notify::active", self.on_lens_active)
8- self.scope.connect("filters-changed", self.on_filtering_changed)
9+ self.scope.connect("filters-changed", self.on_filtering_or_preference_changed)
10 self.scope.props.sources.connect("notify::filtering",
11- self.on_filtering_changed)
12+ self.on_filtering_or_preference_changed)
13 self.scope.connect ("activate-uri", self.on_activate_uri)
14 self.scope.connect('preview-uri', self.on_preview_uri)
15 self.session = Soup.SessionAsync()
16@@ -93,6 +93,8 @@
17 self.session.add_feature_by_type(SoupGNOME.ProxyResolverGNOME)
18 self.query_list_of_sources()
19 self.update_recommendations()
20+ self.preferences = Unity.PreferencesManager.get_default()
21+ self.preferences.connect("notify::remote-content-search", self.on_filtering_or_preference_changed)
22 self.scope.export()
23
24 def update_recommendations(self):
25@@ -147,8 +149,8 @@
26 dt = RETRY_INTERVAL
27 GLib.timeout_add_seconds(dt, self.query_list_of_sources)
28
29- def on_filtering_changed(self, *_):
30- """Run another search when a filter change is notified."""
31+ def on_filtering_or_preference_changed(self, *_):
32+ """Run another search when a filter or preference change is notified."""
33 self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
34
35 def on_lens_active(self, *_):
36@@ -182,8 +184,15 @@
37 # note search_string is a utf-8 encoded string, now:
38 print "Remote scope search changed to %r" % search_string
39 model = search.props.results_model
40+ # Clear results details map
41 model.clear()
42- # Clear results details map
43+
44+ # only perform the request if the user has not disabled
45+ # online/commercial suggestions. That will hide the category as well.
46+ if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
47+ search.finished()
48+ return
49+
50 # Create a list of activated sources
51 sources = [source for source in self.sources_list
52 if self.source_activated(source)]

Subscribers

People subscribed via source and target branches