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
=== modified file 'src/unity-scope-flickr'
--- src/unity-scope-flickr 2012-02-29 14:52:49 +0000
+++ src/unity-scope-flickr 2012-03-02 16:12:22 +0000
@@ -44,9 +44,11 @@
44 self.scope = Unity.Scope.new ("/net/launchpad/scope/image/flickr")44 self.scope = Unity.Scope.new ("/net/launchpad/scope/image/flickr")
45 self.scope.search_in_global = False45 self.scope.search_in_global = False
46 self.scope.connect ("search-changed", self.on_search_changed)46 self.scope.connect ("search-changed", self.on_search_changed)
47 self.scope.connect ("filters-changed", self.on_search_changed)47 self.scope.connect ("filters-changed", self.on_filtering_changed)
48 self.scope.connect ("activate-uri", self.on_activate_uri);48 self.scope.connect ("activate-uri", self.on_activate_uri);
49 self.scope.connect("notify::active", self.on_lens_active)49 self.scope.connect("notify::active", self.on_lens_active)
50 self.scope.props.sources.connect("notify::filtering",
51 self.on_filtering_changed)
50 self.scope.export()52 self.scope.export()
5153
52 def on_activate_uri (self, scope, uri):54 def on_activate_uri (self, scope, uri):
@@ -55,8 +57,7 @@
55 search = uri.split('__')[1]57 search = uri.split('__')[1]
56 results = self.scope.props.results_model58 results = self.scope.props.results_model
57 results.remove(results.get_iter_at_row(results.get_n_rows()-1))59 results.remove(results.get_iter_at_row(results.get_n_rows()-1))
58 # Here, we can safely assume that the user has a valid session token60 self.update_results_model (search, results, page, has_token)
59 self.update_results_model (search, results, page, True)
60 return Unity.ActivationResponse(handled=Unity.HandledType.SHOW_DASH, goto_uri="")61 return Unity.ActivationResponse(handled=Unity.HandledType.SHOW_DASH, goto_uri="")
61 elif uri.startswith("connect"):62 elif uri.startswith("connect"):
62 self.flickr_connect()63 self.flickr_connect()
@@ -72,7 +73,11 @@
72 (token, frob) = flickr.get_token_part_one(perms='write')73 (token, frob) = flickr.get_token_part_one(perms='write')
73 global clicked74 global clicked
74 clicked = True75 clicked = True
75 76
77 def on_filtering_changed(self, *_):
78 """Run another search when a filter change is notified."""
79 self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
80
76 def on_lens_active(self, *_):81 def on_lens_active(self, *_):
77 """ Run a search when the lens is opened """82 """ Run a search when the lens is opened """
78 if self.scope.props.active:83 if self.scope.props.active:
@@ -91,14 +96,21 @@
91 if clicked:96 if clicked:
92 flickr.get_token_part_two((token, frob))97 flickr.get_token_part_two((token, frob))
93 if search_type is Unity.SearchType.DEFAULT:98 if search_type is Unity.SearchType.DEFAULT:
94 self.update_results_model(search_string, model, '1', has_token)99 if search_string == '':
100 print "Global view without search string : hide"
101 else:
102 self.update_results_model(search_string, model, '1', has_token)
95 if search:103 if search:
96 search.finished()104 search.finished()
97105
98 def update_results_model(self, search, model, page, has_token):106 def update_results_model(self, search, model, page, has_token):
99 i = ''107 i = ''
100 counter = 0108 counter = 0
101 cat = 2109 cat = 0
110 if len(search) > 0:
111 cat = 2
112 else:
113 cat = 0
102 if not has_token:114 if not has_token:
103 model.append ("connect", "goa-panel", cat,"text/html", "Authorize with Flickr", '', '')115 model.append ("connect", "goa-panel", cat,"text/html", "Authorize with Flickr", '', '')
104 else:116 else:

Subscribers

People subscribed via source and target branches

to all changes: