Merge lp:~stolowski/unity-scope-home/fix-cancellables into lp:unity-scope-home

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 167
Merged at revision: 167
Proposed branch: lp:~stolowski/unity-scope-home/fix-cancellables
Merge into: lp:unity-scope-home
Diff against target: 40 lines (+2/-12)
1 file modified
src/scope.vala (+2/-12)
To merge this branch: bzr merge lp:~stolowski/unity-scope-home/fix-cancellables
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michal Hruby (community) Approve
Review via email: mp+186843@code.launchpad.net

Commit message

Don't maintain own instances of cancellables. Use cancellable from search context.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks good, fewer objects == better :)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scope.vala'
2--- src/scope.vala 2013-09-19 13:57:34 +0000
3+++ src/scope.vala 2013-09-20 16:44:16 +0000
4@@ -47,7 +47,6 @@
5 private SmartScopes.ChannelIdMap channel_id_map = new SmartScopes.ChannelIdMap ();
6 private uint metrics_timer;
7 private int remote_scopes_retry_count = 0;
8- private HashTable<string, GLib.Cancellable?> search_cancel = new HashTable<string, GLib.Cancellable?> (str_hash, str_equal);
9 private RemoteScopeRegistry remote_scope_registry;
10 private uint category_reorder_time_ms = 0; // minimum time after which category reordering can happen (in milliseconds)
11 private uint flush_delay_ms = 0; //minimum time after which results will be shown in the dash (in milliseconds)
12@@ -605,18 +604,10 @@
13
14 init_sss_client ();
15
16+ GLib.Cancellable cancellable = scope_search.search_context.cancellable.get_gcancellable();
17+
18 CategoryManager.instance ().observe (scope_search.channel_id, scope_search.results_model);
19
20- GLib.Cancellable? prev_search = search_cancel.lookup (scope_search.channel_id);
21- if (prev_search != null)
22- {
23- debug ("Cancelling previous search query for channel: %s", scope_search.channel_id);
24- prev_search.cancel ();
25- }
26-
27- GLib.Cancellable cancellable = new GLib.Cancellable ();
28- search_cancel.insert (scope_search.channel_id, cancellable);
29-
30 bool wait_for_sss_query = false;
31 bool wait_for_push = false;
32 bool wait_for_search = false;
33@@ -1142,7 +1133,6 @@
34 }
35
36 debug ("All search activities finished");
37- search_cancel.remove (scope_search.channel_id);
38 }
39
40 public override int category_index_for_scope_id (string scope_id)

Subscribers

People subscribed via source and target branches

to all changes: