Merge lp:~didrocks/unity-lens-wikipedia/disable-online-search-support into lp:unity-lens-wikipedia

Proposed by Didier Roche-Tolomelli
Status: Merged
Approved by: David Callé
Approved revision: 12
Merged at revision: 12
Proposed branch: lp:~didrocks/unity-lens-wikipedia/disable-online-search-support
Merge into: lp:unity-lens-wikipedia
Diff against target: 33 lines (+14/-2)
1 file modified
src/unity-lens-wikipedia (+14/-2)
To merge this branch: bzr merge lp:~didrocks/unity-lens-wikipedia/disable-online-search-support
Reviewer Review Type Date Requested Status
David Callé Pending
Review via email: mp+126621@code.launchpad.net

Description of the change

Add online search disable support.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/unity-lens-wikipedia'
--- src/unity-lens-wikipedia 2012-06-09 20:20:01 +0000
+++ src/unity-lens-wikipedia 2012-09-27 07:38:22 +0000
@@ -48,15 +48,27 @@
48 locale.setlocale(locale.LC_MESSAGES, '')48 locale.setlocale(locale.LC_MESSAGES, '')
49 loc = locale.getlocale(locale.LC_MESSAGES)[0].split("_")[0]49 loc = locale.getlocale(locale.LC_MESSAGES)[0].split("_")[0]
50 self.wiki = ["http://%s.wikipedia.org" % (loc)]50 self.wiki = ["http://%s.wikipedia.org" % (loc)]
51 self.preferences = Unity.PreferencesManager.get_default()
52 self.preferences.connect("notify::remote-content-search", self._on_preference_changed)
51 self._lens.export ();53 self._lens.export ();
52 self._scope.export ();54 self._scope.export ();
5355
56 def _on_preference_changed (self, *_):
57 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
58
54 def on_search_changed (self, scope, search, search_type, *_):59 def on_search_changed (self, scope, search, search_type, *_):
60 model = search.props.results_model
61 model.clear ()
62
63 # only perform the request if the user has not disabled
64 # online/commercial suggestions. That will hide the category as well.
65 if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
66 search.finished()
67 return
68
55 if search_type is Unity.SearchType.DEFAULT:69 if search_type is Unity.SearchType.DEFAULT:
56 search_string = search.props.search_string.strip ()70 search_string = search.props.search_string.strip ()
57 print "Search changed to \"%s\"" % search_string71 print "Search changed to \"%s\"" % search_string
58 model = search.props.results_model
59 model.clear ()
60 self.update_results_model(model, search_string)72 self.update_results_model(model, search_string)
61 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string("Sorry, there are no articles that match your search."))73 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string("Sorry, there are no articles that match your search."))
62 search.finished ()74 search.finished ()

Subscribers

People subscribed via source and target branches