Merge lp:~lore-mattei/onehundredscopes/flickr-precise into lp:~davidc3/onehundredscopes/flickr

Proposed by Lorenzo Mattei on 2012-03-02
Status: Merged
Merged at revision: 11
Proposed branch: lp:~lore-mattei/onehundredscopes/flickr-precise
Merge into: lp:~davidc3/onehundredscopes/flickr
Diff against target: 63 lines (+18/-6)
1 file modified
src/unity-scope-flickr (+18/-6)
To merge this branch: bzr merge lp:~lore-mattei/onehundredscopes/flickr-precise
Reviewer Review Type Date Requested Status
David Callé 2012-03-02 Pending
Review via email: mp+95604@code.launchpad.net
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
1=== modified file 'src/unity-scope-flickr'
2--- src/unity-scope-flickr 2012-02-29 14:52:49 +0000
3+++ src/unity-scope-flickr 2012-03-02 16:12:22 +0000
4@@ -44,9 +44,11 @@
5 self.scope = Unity.Scope.new ("/net/launchpad/scope/image/flickr")
6 self.scope.search_in_global = False
7 self.scope.connect ("search-changed", self.on_search_changed)
8- self.scope.connect ("filters-changed", self.on_search_changed)
9+ self.scope.connect ("filters-changed", self.on_filtering_changed)
10 self.scope.connect ("activate-uri", self.on_activate_uri);
11 self.scope.connect("notify::active", self.on_lens_active)
12+ self.scope.props.sources.connect("notify::filtering",
13+ self.on_filtering_changed)
14 self.scope.export()
15
16 def on_activate_uri (self, scope, uri):
17@@ -55,8 +57,7 @@
18 search = uri.split('__')[1]
19 results = self.scope.props.results_model
20 results.remove(results.get_iter_at_row(results.get_n_rows()-1))
21- # Here, we can safely assume that the user has a valid session token
22- self.update_results_model (search, results, page, True)
23+ self.update_results_model (search, results, page, has_token)
24 return Unity.ActivationResponse(handled=Unity.HandledType.SHOW_DASH, goto_uri="")
25 elif uri.startswith("connect"):
26 self.flickr_connect()
27@@ -72,7 +73,11 @@
28 (token, frob) = flickr.get_token_part_one(perms='write')
29 global clicked
30 clicked = True
31-
32+
33+ def on_filtering_changed(self, *_):
34+ """Run another search when a filter change is notified."""
35+ self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
36+
37 def on_lens_active(self, *_):
38 """ Run a search when the lens is opened """
39 if self.scope.props.active:
40@@ -91,14 +96,21 @@
41 if clicked:
42 flickr.get_token_part_two((token, frob))
43 if search_type is Unity.SearchType.DEFAULT:
44- self.update_results_model(search_string, model, '1', has_token)
45+ if search_string == '':
46+ print "Global view without search string : hide"
47+ else:
48+ self.update_results_model(search_string, model, '1', has_token)
49 if search:
50 search.finished()
51
52 def update_results_model(self, search, model, page, has_token):
53 i = ''
54 counter = 0
55- cat = 2
56+ cat = 0
57+ if len(search) > 0:
58+ cat = 2
59+ else:
60+ cat = 0
61 if not has_token:
62 model.append ("connect", "goa-panel", cat,"text/html", "Authorize with Flickr", '', '')
63 else:

Subscribers

People subscribed via source and target branches

to all changes: