Merge lp:~didrocks/unity-lens-photos/add-disabling-online-support into lp:unity-lens-photos

Proposed by Didier Roche-Tolomelli
Status: Merged
Approved by: David Callé
Approved revision: 90
Merged at revision: 86
Proposed branch: lp:~didrocks/unity-lens-photos/add-disabling-online-support
Merge into: lp:unity-lens-photos
Diff against target: 257 lines (+96/-15)
6 files modified
src/facebook_scope.py (+16/-5)
src/flickr_scope.py (+16/-5)
src/picasa_scope.py (+16/-5)
tests/manual/facebook-photos.txt (+16/-0)
tests/manual/flickr-photos.txt (+16/-0)
tests/manual/picasa-photos.txt (+16/-0)
To merge this branch: bzr merge lp:~didrocks/unity-lens-photos/add-disabling-online-support
Reviewer Review Type Date Requested Status
David Callé Approve
Review via email: mp+126631@code.launchpad.net

Description of the change

Add disabling online search support on the facebook, flickr and picasa scopes

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

Looks good overall, but this needs to be fixed :

facebook_scope.py:61
- self._scope.connect("filters-changed", self.on_lens_active)
+ self._scope.connect("filters-changed", self.on_lens_active_or_preference_changed)

review: Needs Fixing
90. By Didier Roche-Tolomelli

fix missing rename

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

fixed and pushed, please rereview :)

Revision history for this message
David Callé (davidc3) wrote :

Thanks Didier! I like the fact that you don't hide remote sources in the Sources filter when the setting is changed. Makes up for the OA integration vs No remote possible confusion :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/facebook_scope.py'
--- src/facebook_scope.py 2012-09-20 22:29:07 +0000
+++ src/facebook_scope.py 2012-09-27 09:23:28 +0000
@@ -58,10 +58,14 @@
58 self._authenticating = False58 self._authenticating = False
59 self._get_accounts_for_service ('facebook')59 self._get_accounts_for_service ('facebook')
60 self._scope.connect("search-changed", self.on_search_changed)60 self._scope.connect("search-changed", self.on_search_changed)
61 self._scope.connect("filters-changed", self.on_lens_active)61 self._scope.connect("filters-changed", self.on_lens_active_or_preference_changed)
62 self._scope.connect("notify::active", self.on_lens_active)62 self._scope.connect("notify::active", self.on_lens_active_or_preference_changed)
63 self._scope.connect('preview-uri', self.on_preview_uri)63 self._scope.connect('preview-uri', self.on_preview_uri)
64 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)64 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)
65
66 self.preferences = Unity.PreferencesManager.get_default()
67 self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed)
68
65 self._scope.export ()69 self._scope.export ()
66 lens.add_local_scope (self._scope)70 lens.add_local_scope (self._scope)
6771
@@ -121,7 +125,7 @@
121 if source_name in self._sources_options:125 if source_name in self._sources_options:
122 self._sources_options.remove(source_name)126 self._sources_options.remove(source_name)
123 self._scope.props.sources.remove_option(source_name)127 self._scope.props.sources.remove_option(source_name)
124 self.on_lens_active ()128 self.on_lens_active_or_preference_changed ()
125129
126130
127 def get_account_service(self):131 def get_account_service(self):
@@ -165,7 +169,7 @@
165 self.enabled = False169 self.enabled = False
166 self._sources_options.remove(source_name)170 self._sources_options.remove(source_name)
167 self._scope.props.sources.remove_option(source_name)171 self._scope.props.sources.remove_option(source_name)
168 self.on_lens_active ()172 self.on_lens_active_or_preference_changed ()
169 print ('Removed Facebook account')173 print ('Removed Facebook account')
170174
171175
@@ -236,7 +240,7 @@
236########240########
237241
238242
239 def on_lens_active(self, *_):243 def on_lens_active_or_preference_changed(self, *_):
240 """ Update results when the lens is opened """244 """ Update results when the lens is opened """
241 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)245 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
242246
@@ -283,6 +287,13 @@
283 model = search.props.results_model287 model = search.props.results_model
284 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))288 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))
285 model.clear()289 model.clear()
290
291 # only perform the request if the user has not disabled
292 # online results. That will hide the category as well.
293 if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
294 search.finished()
295 return
296
286 self._queued_search = (scope, search, search_type, cancellable)297 self._queued_search = (scope, search, search_type, cancellable)
287 if self._authenticating:298 if self._authenticating:
288 print ("authenticating, queuing search")299 print ("authenticating, queuing search")
289300
=== modified file 'src/flickr_scope.py'
--- src/flickr_scope.py 2012-09-20 22:29:07 +0000
+++ src/flickr_scope.py 2012-09-27 09:23:28 +0000
@@ -59,10 +59,14 @@
59 self._authenticating = False59 self._authenticating = False
60 self._get_accounts_for_service ('flickr')60 self._get_accounts_for_service ('flickr')
61 self._scope.connect("search-changed", self.on_search_changed)61 self._scope.connect("search-changed", self.on_search_changed)
62 self._scope.connect ("filters-changed", self.on_lens_active)62 self._scope.connect ("filters-changed", self.on_lens_active_or_preference_changed)
63 self._scope.connect("notify::active", self.on_lens_active)63 self._scope.connect("notify::active", self.on_lens_active_or_preference_changed)
64 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)64 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)
65 self._scope.connect('preview-uri', self.on_preview_uri)65 self._scope.connect('preview-uri', self.on_preview_uri)
66
67 self.preferences = Unity.PreferencesManager.get_default()
68 self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed)
69
66 self._scope.export ()70 self._scope.export ()
67 lens.add_local_scope (self._scope)71 lens.add_local_scope (self._scope)
6872
@@ -122,7 +126,7 @@
122 if source_name in self._sources_options:126 if source_name in self._sources_options:
123 self._sources_options.remove(source_name)127 self._sources_options.remove(source_name)
124 self._scope.props.sources.remove_option(source_name)128 self._scope.props.sources.remove_option(source_name)
125 self.on_lens_active ()129 self.on_lens_active_or_preference_changed ()
126130
127131
128 def get_account_service(self):132 def get_account_service(self):
@@ -166,7 +170,7 @@
166 self.enabled = False170 self.enabled = False
167 self._sources_options.remove(source_name)171 self._sources_options.remove(source_name)
168 self._scope.props.sources.remove_option(source_name)172 self._scope.props.sources.remove_option(source_name)
169 self.on_lens_active ()173 self.on_lens_active_or_preference_changed ()
170 print ('Removed Flickr account')174 print ('Removed Flickr account')
171175
172176
@@ -300,7 +304,7 @@
300# Lens functions304# Lens functions
301########305########
302306
303 def on_lens_active(self, *_):307 def on_lens_active_or_preference_changed(self, *_):
304 """ Update results when the lens is opened """308 """ Update results when the lens is opened """
305 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)309 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
306310
@@ -348,6 +352,13 @@
348 model = search.props.results_model352 model = search.props.results_model
349 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))353 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))
350 model.clear()354 model.clear()
355
356 # only perform the request if the user has not disabled
357 # online results. That will hide the category as well.
358 if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
359 search.finished()
360 return
361
351 self._queued_search = (scope, search, search_type, cancellable)362 self._queued_search = (scope, search, search_type, cancellable)
352 if self._authenticating:363 if self._authenticating:
353 print ("authenticating, queuing search")364 print ("authenticating, queuing search")
354365
=== modified file 'src/picasa_scope.py'
--- src/picasa_scope.py 2012-09-20 22:29:07 +0000
+++ src/picasa_scope.py 2012-09-27 09:23:28 +0000
@@ -57,10 +57,14 @@
57 self._cancellable = [Gio.Cancellable (), Gio.Cancellable ()]57 self._cancellable = [Gio.Cancellable (), Gio.Cancellable ()]
58 self._get_accounts_for_service ('google')58 self._get_accounts_for_service ('google')
59 self._scope.connect("search-changed", self._on_search_changed)59 self._scope.connect("search-changed", self._on_search_changed)
60 self._scope.connect ("filters-changed", self.on_lens_active)60 self._scope.connect ("filters-changed", self.on_lens_active_or_preference_changed)
61 self._scope.connect("notify::active", self.on_lens_active)61 self._scope.connect("notify::active", self.on_lens_active_or_preference_changed)
62 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)62 self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed)
63 self._scope.connect('preview-uri', self.on_preview_uri)63 self._scope.connect('preview-uri', self.on_preview_uri)
64
65 self.preferences = Unity.PreferencesManager.get_default()
66 self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed)
67
64 self._scope.export ()68 self._scope.export ()
65 lens.add_local_scope (self._scope)69 lens.add_local_scope (self._scope)
6670
@@ -103,7 +107,7 @@
103 if source_name in self._sources_options:107 if source_name in self._sources_options:
104 self._sources_options.remove(source_name)108 self._sources_options.remove(source_name)
105 self._scope.props.sources.remove_option(source_name)109 self._scope.props.sources.remove_option(source_name)
106 self.on_lens_active ()110 self.on_lens_active_or_preference_changed ()
107111
108112
109 def get_account_service(self):113 def get_account_service(self):
@@ -147,7 +151,7 @@
147 self.enabled = False151 self.enabled = False
148 self._sources_options.remove(source_name)152 self._sources_options.remove(source_name)
149 self._scope.props.sources.remove_option(source_name)153 self._scope.props.sources.remove_option(source_name)
150 self.on_lens_active ()154 self.on_lens_active_or_preference_changed ()
151 print ('Removed Picasa account')155 print ('Removed Picasa account')
152156
153157
@@ -155,7 +159,7 @@
155# Lens functions159# Lens functions
156########160########
157161
158 def on_lens_active(self, *_):162 def on_lens_active_or_preference_changed(self, *_):
159 """ Update results when the lens is opened """163 """ Update results when the lens is opened """
160 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)164 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
161165
@@ -202,6 +206,13 @@
202 model = search.props.results_model206 model = search.props.results_model
203 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))207 search.set_reply_hint ("no-results-hint", GLib.Variant.new_string(NO_RESULTS_HINT))
204 model.clear ()208 model.clear ()
209
210 # only perform the request if the user has not disabled
211 # online results. That will hide the category as well.
212 if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL:
213 search.finished()
214 return
215
205 search_string = search.props.search_string216 search_string = search.props.search_string
206 if self._enabled:217 if self._enabled:
207 if search_type == Unity.SearchType.DEFAULT:218 if search_type == Unity.SearchType.DEFAULT:
208219
=== modified file 'tests/manual/facebook-photos.txt'
--- tests/manual/facebook-photos.txt 2012-09-21 16:08:09 +0000
+++ tests/manual/facebook-photos.txt 2012-09-27 09:23:28 +0000
@@ -12,3 +12,19 @@
1212
13Expected Result:13Expected Result:
14The lens should display the most recent Facebook photos and Facebook friends photos in the Recent category, less recent Facebook photos in the My Photos category and less recent Facebook friends photos in the Friends Photos category.14The lens should display the most recent Facebook photos and Facebook friends photos in the Recent category, less recent Facebook photos in the My Photos category and less recent Facebook friends photos in the Friends Photos category.
15
16'Disable' Online searched
17----------------------------------------------------
18Disabling the online searches should not search on Facebook.
19
20Setup:
21Internet connectivity.
22
23Actions:
24Disable the online search in gnome-control-center or directly in gsettings
25(com.canonical.Unity.Lenses "remote-content-search" to none)
26Perfom a search in the home dash and within the photo lens.
27
28Expected Results:
29No result from Facebook in the lens should be displayed.
30
1531
=== modified file 'tests/manual/flickr-photos.txt'
--- tests/manual/flickr-photos.txt 2012-09-21 16:08:09 +0000
+++ tests/manual/flickr-photos.txt 2012-09-27 09:23:28 +0000
@@ -12,3 +12,19 @@
1212
13Expected Result:13Expected Result:
14The lens should display the most recent Flickr photos and Flickr contacts photos in the Recent category, less recent Flickr photos in the My Photos category and less recent Flickr contacts photos in the Friends Photos category.14The lens should display the most recent Flickr photos and Flickr contacts photos in the Recent category, less recent Flickr photos in the My Photos category and less recent Flickr contacts photos in the Friends Photos category.
15
16'Disable' Online searched
17----------------------------------------------------
18Disabling the online searches should not search on Flickr.
19
20Setup:
21Internet connectivity.
22
23Actions:
24Disable the online search in gnome-control-center or directly in gsettings
25(com.canonical.Unity.Lenses "remote-content-search" to none)
26Perfom a search in the home dash and within the photo lens.
27
28Expected Results:
29No result from Flickr in the lens should be displayed.
30
1531
=== modified file 'tests/manual/picasa-photos.txt'
--- tests/manual/picasa-photos.txt 2012-09-21 16:08:09 +0000
+++ tests/manual/picasa-photos.txt 2012-09-27 09:23:28 +0000
@@ -12,3 +12,19 @@
1212
13Expected Result:13Expected Result:
14The lens should display the 100 most recent Picasa photos, 50 in the Recent category, 50 in the My Photos category.14The lens should display the 100 most recent Picasa photos, 50 in the Recent category, 50 in the My Photos category.
15
16'Disable' Online searched
17----------------------------------------------------
18Disabling the online searches should not search on Picasa.
19
20Setup:
21Internet connectivity.
22
23Actions:
24Disable the online search in gnome-control-center or directly in gsettings
25(com.canonical.Unity.Lenses "remote-content-search" to none)
26Perfom a search in the home dash and within the photo lens.
27
28Expected Results:
29No result from Picasa in the lens should be displayed.
30

Subscribers

People subscribed via source and target branches