Merge lp:~didrocks/unity-lens-photos/add-disabling-online-support into lp:unity-lens-photos
- add-disabling-online-support
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Callé | Approve | ||
Review via email: mp+126631@code.launchpad.net |
Commit message
Description of the change
Add disabling online search support on the facebook, flickr and picasa scopes
To post a comment you must log in.
- 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
1 | === modified file 'src/facebook_scope.py' | |||
2 | --- src/facebook_scope.py 2012-09-20 22:29:07 +0000 | |||
3 | +++ src/facebook_scope.py 2012-09-27 09:23:28 +0000 | |||
4 | @@ -58,10 +58,14 @@ | |||
5 | 58 | self._authenticating = False | 58 | self._authenticating = False |
6 | 59 | self._get_accounts_for_service ('facebook') | 59 | self._get_accounts_for_service ('facebook') |
7 | 60 | self._scope.connect("search-changed", self.on_search_changed) | 60 | self._scope.connect("search-changed", self.on_search_changed) |
10 | 61 | self._scope.connect("filters-changed", self.on_lens_active) | 61 | self._scope.connect("filters-changed", self.on_lens_active_or_preference_changed) |
11 | 62 | self._scope.connect("notify::active", self.on_lens_active) | 62 | self._scope.connect("notify::active", self.on_lens_active_or_preference_changed) |
12 | 63 | self._scope.connect('preview-uri', self.on_preview_uri) | 63 | self._scope.connect('preview-uri', self.on_preview_uri) |
13 | 64 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) | 64 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) |
14 | 65 | |||
15 | 66 | self.preferences = Unity.PreferencesManager.get_default() | ||
16 | 67 | self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed) | ||
17 | 68 | |||
18 | 65 | self._scope.export () | 69 | self._scope.export () |
19 | 66 | lens.add_local_scope (self._scope) | 70 | lens.add_local_scope (self._scope) |
20 | 67 | 71 | ||
21 | @@ -121,7 +125,7 @@ | |||
22 | 121 | if source_name in self._sources_options: | 125 | if source_name in self._sources_options: |
23 | 122 | self._sources_options.remove(source_name) | 126 | self._sources_options.remove(source_name) |
24 | 123 | self._scope.props.sources.remove_option(source_name) | 127 | self._scope.props.sources.remove_option(source_name) |
26 | 124 | self.on_lens_active () | 128 | self.on_lens_active_or_preference_changed () |
27 | 125 | 129 | ||
28 | 126 | 130 | ||
29 | 127 | def get_account_service(self): | 131 | def get_account_service(self): |
30 | @@ -165,7 +169,7 @@ | |||
31 | 165 | self.enabled = False | 169 | self.enabled = False |
32 | 166 | self._sources_options.remove(source_name) | 170 | self._sources_options.remove(source_name) |
33 | 167 | self._scope.props.sources.remove_option(source_name) | 171 | self._scope.props.sources.remove_option(source_name) |
35 | 168 | self.on_lens_active () | 172 | self.on_lens_active_or_preference_changed () |
36 | 169 | print ('Removed Facebook account') | 173 | print ('Removed Facebook account') |
37 | 170 | 174 | ||
38 | 171 | 175 | ||
39 | @@ -236,7 +240,7 @@ | |||
40 | 236 | ######## | 240 | ######## |
41 | 237 | 241 | ||
42 | 238 | 242 | ||
44 | 239 | def on_lens_active(self, *_): | 243 | def on_lens_active_or_preference_changed(self, *_): |
45 | 240 | """ Update results when the lens is opened """ | 244 | """ Update results when the lens is opened """ |
46 | 241 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) | 245 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) |
47 | 242 | 246 | ||
48 | @@ -283,6 +287,13 @@ | |||
49 | 283 | model = search.props.results_model | 287 | model = search.props.results_model |
50 | 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)) |
51 | 285 | model.clear() | 289 | model.clear() |
52 | 290 | |||
53 | 291 | # only perform the request if the user has not disabled | ||
54 | 292 | # online results. That will hide the category as well. | ||
55 | 293 | if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL: | ||
56 | 294 | search.finished() | ||
57 | 295 | return | ||
58 | 296 | |||
59 | 286 | self._queued_search = (scope, search, search_type, cancellable) | 297 | self._queued_search = (scope, search, search_type, cancellable) |
60 | 287 | if self._authenticating: | 298 | if self._authenticating: |
61 | 288 | print ("authenticating, queuing search") | 299 | print ("authenticating, queuing search") |
62 | 289 | 300 | ||
63 | === modified file 'src/flickr_scope.py' | |||
64 | --- src/flickr_scope.py 2012-09-20 22:29:07 +0000 | |||
65 | +++ src/flickr_scope.py 2012-09-27 09:23:28 +0000 | |||
66 | @@ -59,10 +59,14 @@ | |||
67 | 59 | self._authenticating = False | 59 | self._authenticating = False |
68 | 60 | self._get_accounts_for_service ('flickr') | 60 | self._get_accounts_for_service ('flickr') |
69 | 61 | self._scope.connect("search-changed", self.on_search_changed) | 61 | self._scope.connect("search-changed", self.on_search_changed) |
72 | 62 | self._scope.connect ("filters-changed", self.on_lens_active) | 62 | self._scope.connect ("filters-changed", self.on_lens_active_or_preference_changed) |
73 | 63 | self._scope.connect("notify::active", self.on_lens_active) | 63 | self._scope.connect("notify::active", self.on_lens_active_or_preference_changed) |
74 | 64 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) | 64 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) |
75 | 65 | self._scope.connect('preview-uri', self.on_preview_uri) | 65 | self._scope.connect('preview-uri', self.on_preview_uri) |
76 | 66 | |||
77 | 67 | self.preferences = Unity.PreferencesManager.get_default() | ||
78 | 68 | self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed) | ||
79 | 69 | |||
80 | 66 | self._scope.export () | 70 | self._scope.export () |
81 | 67 | lens.add_local_scope (self._scope) | 71 | lens.add_local_scope (self._scope) |
82 | 68 | 72 | ||
83 | @@ -122,7 +126,7 @@ | |||
84 | 122 | if source_name in self._sources_options: | 126 | if source_name in self._sources_options: |
85 | 123 | self._sources_options.remove(source_name) | 127 | self._sources_options.remove(source_name) |
86 | 124 | self._scope.props.sources.remove_option(source_name) | 128 | self._scope.props.sources.remove_option(source_name) |
88 | 125 | self.on_lens_active () | 129 | self.on_lens_active_or_preference_changed () |
89 | 126 | 130 | ||
90 | 127 | 131 | ||
91 | 128 | def get_account_service(self): | 132 | def get_account_service(self): |
92 | @@ -166,7 +170,7 @@ | |||
93 | 166 | self.enabled = False | 170 | self.enabled = False |
94 | 167 | self._sources_options.remove(source_name) | 171 | self._sources_options.remove(source_name) |
95 | 168 | self._scope.props.sources.remove_option(source_name) | 172 | self._scope.props.sources.remove_option(source_name) |
97 | 169 | self.on_lens_active () | 173 | self.on_lens_active_or_preference_changed () |
98 | 170 | print ('Removed Flickr account') | 174 | print ('Removed Flickr account') |
99 | 171 | 175 | ||
100 | 172 | 176 | ||
101 | @@ -300,7 +304,7 @@ | |||
102 | 300 | # Lens functions | 304 | # Lens functions |
103 | 301 | ######## | 305 | ######## |
104 | 302 | 306 | ||
106 | 303 | def on_lens_active(self, *_): | 307 | def on_lens_active_or_preference_changed(self, *_): |
107 | 304 | """ Update results when the lens is opened """ | 308 | """ Update results when the lens is opened """ |
108 | 305 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) | 309 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) |
109 | 306 | 310 | ||
110 | @@ -348,6 +352,13 @@ | |||
111 | 348 | model = search.props.results_model | 352 | model = search.props.results_model |
112 | 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)) |
113 | 350 | model.clear() | 354 | model.clear() |
114 | 355 | |||
115 | 356 | # only perform the request if the user has not disabled | ||
116 | 357 | # online results. That will hide the category as well. | ||
117 | 358 | if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL: | ||
118 | 359 | search.finished() | ||
119 | 360 | return | ||
120 | 361 | |||
121 | 351 | self._queued_search = (scope, search, search_type, cancellable) | 362 | self._queued_search = (scope, search, search_type, cancellable) |
122 | 352 | if self._authenticating: | 363 | if self._authenticating: |
123 | 353 | print ("authenticating, queuing search") | 364 | print ("authenticating, queuing search") |
124 | 354 | 365 | ||
125 | === modified file 'src/picasa_scope.py' | |||
126 | --- src/picasa_scope.py 2012-09-20 22:29:07 +0000 | |||
127 | +++ src/picasa_scope.py 2012-09-27 09:23:28 +0000 | |||
128 | @@ -57,10 +57,14 @@ | |||
129 | 57 | self._cancellable = [Gio.Cancellable (), Gio.Cancellable ()] | 57 | self._cancellable = [Gio.Cancellable (), Gio.Cancellable ()] |
130 | 58 | self._get_accounts_for_service ('google') | 58 | self._get_accounts_for_service ('google') |
131 | 59 | self._scope.connect("search-changed", self._on_search_changed) | 59 | self._scope.connect("search-changed", self._on_search_changed) |
134 | 60 | self._scope.connect ("filters-changed", self.on_lens_active) | 60 | self._scope.connect ("filters-changed", self.on_lens_active_or_preference_changed) |
135 | 61 | self._scope.connect("notify::active", self.on_lens_active) | 61 | self._scope.connect("notify::active", self.on_lens_active_or_preference_changed) |
136 | 62 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) | 62 | self._scope.props.sources.connect("notify::filtering", self.on_filtering_changed) |
137 | 63 | self._scope.connect('preview-uri', self.on_preview_uri) | 63 | self._scope.connect('preview-uri', self.on_preview_uri) |
138 | 64 | |||
139 | 65 | self.preferences = Unity.PreferencesManager.get_default() | ||
140 | 66 | self.preferences.connect("notify::remote-content-search", self.on_lens_active_or_preference_changed) | ||
141 | 67 | |||
142 | 64 | self._scope.export () | 68 | self._scope.export () |
143 | 65 | lens.add_local_scope (self._scope) | 69 | lens.add_local_scope (self._scope) |
144 | 66 | 70 | ||
145 | @@ -103,7 +107,7 @@ | |||
146 | 103 | if source_name in self._sources_options: | 107 | if source_name in self._sources_options: |
147 | 104 | self._sources_options.remove(source_name) | 108 | self._sources_options.remove(source_name) |
148 | 105 | self._scope.props.sources.remove_option(source_name) | 109 | self._scope.props.sources.remove_option(source_name) |
150 | 106 | self.on_lens_active () | 110 | self.on_lens_active_or_preference_changed () |
151 | 107 | 111 | ||
152 | 108 | 112 | ||
153 | 109 | def get_account_service(self): | 113 | def get_account_service(self): |
154 | @@ -147,7 +151,7 @@ | |||
155 | 147 | self.enabled = False | 151 | self.enabled = False |
156 | 148 | self._sources_options.remove(source_name) | 152 | self._sources_options.remove(source_name) |
157 | 149 | self._scope.props.sources.remove_option(source_name) | 153 | self._scope.props.sources.remove_option(source_name) |
159 | 150 | self.on_lens_active () | 154 | self.on_lens_active_or_preference_changed () |
160 | 151 | print ('Removed Picasa account') | 155 | print ('Removed Picasa account') |
161 | 152 | 156 | ||
162 | 153 | 157 | ||
163 | @@ -155,7 +159,7 @@ | |||
164 | 155 | # Lens functions | 159 | # Lens functions |
165 | 156 | ######## | 160 | ######## |
166 | 157 | 161 | ||
168 | 158 | def on_lens_active(self, *_): | 162 | def on_lens_active_or_preference_changed(self, *_): |
169 | 159 | """ Update results when the lens is opened """ | 163 | """ Update results when the lens is opened """ |
170 | 160 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) | 164 | self._scope.queue_search_changed(Unity.SearchType.DEFAULT) |
171 | 161 | 165 | ||
172 | @@ -202,6 +206,13 @@ | |||
173 | 202 | model = search.props.results_model | 206 | model = search.props.results_model |
174 | 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)) |
175 | 204 | model.clear () | 208 | model.clear () |
176 | 209 | |||
177 | 210 | # only perform the request if the user has not disabled | ||
178 | 211 | # online results. That will hide the category as well. | ||
179 | 212 | if self.preferences.props.remote_content_search != Unity.PreferencesManagerRemoteContent.ALL: | ||
180 | 213 | search.finished() | ||
181 | 214 | return | ||
182 | 215 | |||
183 | 205 | search_string = search.props.search_string | 216 | search_string = search.props.search_string |
184 | 206 | if self._enabled: | 217 | if self._enabled: |
185 | 207 | if search_type == Unity.SearchType.DEFAULT: | 218 | if search_type == Unity.SearchType.DEFAULT: |
186 | 208 | 219 | ||
187 | === modified file 'tests/manual/facebook-photos.txt' | |||
188 | --- tests/manual/facebook-photos.txt 2012-09-21 16:08:09 +0000 | |||
189 | +++ tests/manual/facebook-photos.txt 2012-09-27 09:23:28 +0000 | |||
190 | @@ -12,3 +12,19 @@ | |||
191 | 12 | 12 | ||
192 | 13 | Expected Result: | 13 | Expected Result: |
193 | 14 | The 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. | 14 | The 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. |
194 | 15 | |||
195 | 16 | 'Disable' Online searched | ||
196 | 17 | ---------------------------------------------------- | ||
197 | 18 | Disabling the online searches should not search on Facebook. | ||
198 | 19 | |||
199 | 20 | Setup: | ||
200 | 21 | Internet connectivity. | ||
201 | 22 | |||
202 | 23 | Actions: | ||
203 | 24 | Disable the online search in gnome-control-center or directly in gsettings | ||
204 | 25 | (com.canonical.Unity.Lenses "remote-content-search" to none) | ||
205 | 26 | Perfom a search in the home dash and within the photo lens. | ||
206 | 27 | |||
207 | 28 | Expected Results: | ||
208 | 29 | No result from Facebook in the lens should be displayed. | ||
209 | 30 | |||
210 | 15 | 31 | ||
211 | === modified file 'tests/manual/flickr-photos.txt' | |||
212 | --- tests/manual/flickr-photos.txt 2012-09-21 16:08:09 +0000 | |||
213 | +++ tests/manual/flickr-photos.txt 2012-09-27 09:23:28 +0000 | |||
214 | @@ -12,3 +12,19 @@ | |||
215 | 12 | 12 | ||
216 | 13 | Expected Result: | 13 | Expected Result: |
217 | 14 | The 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. | 14 | The 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. |
218 | 15 | |||
219 | 16 | 'Disable' Online searched | ||
220 | 17 | ---------------------------------------------------- | ||
221 | 18 | Disabling the online searches should not search on Flickr. | ||
222 | 19 | |||
223 | 20 | Setup: | ||
224 | 21 | Internet connectivity. | ||
225 | 22 | |||
226 | 23 | Actions: | ||
227 | 24 | Disable the online search in gnome-control-center or directly in gsettings | ||
228 | 25 | (com.canonical.Unity.Lenses "remote-content-search" to none) | ||
229 | 26 | Perfom a search in the home dash and within the photo lens. | ||
230 | 27 | |||
231 | 28 | Expected Results: | ||
232 | 29 | No result from Flickr in the lens should be displayed. | ||
233 | 30 | |||
234 | 15 | 31 | ||
235 | === modified file 'tests/manual/picasa-photos.txt' | |||
236 | --- tests/manual/picasa-photos.txt 2012-09-21 16:08:09 +0000 | |||
237 | +++ tests/manual/picasa-photos.txt 2012-09-27 09:23:28 +0000 | |||
238 | @@ -12,3 +12,19 @@ | |||
239 | 12 | 12 | ||
240 | 13 | Expected Result: | 13 | Expected Result: |
241 | 14 | The lens should display the 100 most recent Picasa photos, 50 in the Recent category, 50 in the My Photos category. | 14 | The lens should display the 100 most recent Picasa photos, 50 in the Recent category, 50 in the My Photos category. |
242 | 15 | |||
243 | 16 | 'Disable' Online searched | ||
244 | 17 | ---------------------------------------------------- | ||
245 | 18 | Disabling the online searches should not search on Picasa. | ||
246 | 19 | |||
247 | 20 | Setup: | ||
248 | 21 | Internet connectivity. | ||
249 | 22 | |||
250 | 23 | Actions: | ||
251 | 24 | Disable the online search in gnome-control-center or directly in gsettings | ||
252 | 25 | (com.canonical.Unity.Lenses "remote-content-search" to none) | ||
253 | 26 | Perfom a search in the home dash and within the photo lens. | ||
254 | 27 | |||
255 | 28 | Expected Results: | ||
256 | 29 | No result from Picasa in the lens should be displayed. | ||
257 | 30 |
Looks good overall, but this needs to be fixed :
facebook_ scope.py: 61 connect( "filters- changed" , self.on_ lens_active) connect( "filters- changed" , self.on_ lens_active_ or_preference_ changed)
- self._scope.
+ self._scope.