Merge lp:~mhr3/libunity/wait-for-model-sync into lp:libunity

Proposed by Michal Hruby on 2013-06-21
Status: Merged
Approved by: Paweł Stołowski on 2013-06-21
Approved revision: 238
Merged at revision: 238
Proposed branch: lp:~mhr3/libunity/wait-for-model-sync
Merge into: lp:libunity
Diff against target: 91 lines (+37/-0)
5 files modified
debian/libunity9.symbols (+2/-0)
src/unity-aggregator-scope-private.vala (+6/-0)
src/unity-deprecated-scope-impl.vala (+1/-0)
src/unity-scope-dbus-impl.vala (+6/-0)
src/unity-utils.vala (+22/-0)
To merge this branch: bzr merge lp:~mhr3/libunity/wait-for-model-sync
Reviewer Review Type Date Requested Status
Paweł Stołowski 2013-06-21 Approve on 2013-06-21
PS Jenkins bot (community) continuous-integration Approve on 2013-06-21
Review via email: mp+170852@code.launchpad.net

Commit message

Wait for model synchronization before returning a name in open_channel

Description of the change

Wait for model synchronization before returning a name in open_channel

To post a comment you must log in.
238. By Michal Hruby on 2013-06-21

Update symbols file

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Paweł Stołowski (stolowski) wrote :

Looks good, and the problem with missing icons seems to be gone! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libunity9.symbols'
2--- debian/libunity9.symbols 2013-06-19 04:28:55 +0000
3+++ debian/libunity9.symbols 2013-06-21 15:36:29 +0000
4@@ -434,6 +434,8 @@
5 unity_internal_utils_value_set_async_once@Base 7.0.0daily13.05.31ubuntu.unity.next
6 unity_internal_utils_value_take_async_mutex@Base 7.0.0daily13.05.31ubuntu.unity.next
7 unity_internal_utils_value_take_async_once@Base 7.0.0daily13.05.31ubuntu.unity.next
8+ unity_internal_utils_wait_for_model_synchronization@Base 0replaceme
9+ unity_internal_utils_wait_for_model_synchronization_finish@Base 0replaceme
10 unity_launcher_entry_dbus_impl_construct@Base 3.4.6
11 unity_launcher_entry_dbus_impl_get_type@Base 3.4.6
12 unity_launcher_entry_dbus_impl_new@Base 3.4.6
13
14=== modified file 'src/unity-aggregator-scope-private.vala'
15--- src/unity-aggregator-scope-private.vala 2013-05-10 14:36:55 +0000
16+++ src/unity-aggregator-scope-private.vala 2013-06-21 15:36:29 +0000
17@@ -1798,6 +1798,12 @@
18 filters_model,
19 flags | ChannelFlags.NO_FILTERING);
20
21+ if (channel.results_model is Dee.SharedModel)
22+ {
23+ var sm = channel.results_model as Dee.SharedModel;
24+ yield Internal.Utils.wait_for_model_synchronization (sm);
25+ }
26+
27 _channels[channel.id] = channel;
28 _scopes.register_channel (channel.id, channel.results_model, merge_strategy);
29
30
31=== modified file 'src/unity-deprecated-scope-impl.vala'
32--- src/unity-deprecated-scope-impl.vala 2013-06-10 17:56:20 +0000
33+++ src/unity-deprecated-scope-impl.vala 2013-06-21 15:36:29 +0000
34@@ -636,6 +636,7 @@
35 // force AUTOMATIC flushing for the deprecated scopes as they don't
36 // expect the ResultSet to have a separate flush() method
37 sm.flush_mode = Dee.SharedModelFlushMode.AUTOMATIC;
38+ yield Internal.Utils.wait_for_model_synchronization (sm);
39 }
40
41 _channels[channel.id] = channel;
42
43=== modified file 'src/unity-scope-dbus-impl.vala'
44--- src/unity-scope-dbus-impl.vala 2013-06-18 14:41:20 +0000
45+++ src/unity-scope-dbus-impl.vala 2013-06-21 15:36:29 +0000
46@@ -699,6 +699,12 @@
47 filters_model,
48 flags);
49
50+ if (channel.results_model is Dee.SharedModel)
51+ {
52+ var sm = channel.results_model as Dee.SharedModel;
53+ yield Internal.Utils.wait_for_model_synchronization (sm);
54+ }
55+
56 _channels[channel.id] = channel;
57
58 out_hints = new HashTable<string, Variant> (str_hash, str_equal);
59
60=== modified file 'src/unity-utils.vala'
61--- src/unity-utils.vala 2013-04-30 16:21:16 +0000
62+++ src/unity-utils.vala 2013-06-21 15:36:29 +0000
63@@ -242,6 +242,28 @@
64 }
65 }
66
67+ internal static async void wait_for_model_synchronization (Dee.SharedModel model)
68+ {
69+ if (model.is_synchronized ()) return;
70+
71+ var sig_id = model.notify["synchronized"].connect (() =>
72+ {
73+ if (model.is_synchronized ())
74+ {
75+ wait_for_model_synchronization.callback ();
76+ }
77+ });
78+
79+ if (sig_id == 0)
80+ {
81+ critical ("Internal error, unable to wait for synchronization");
82+ return;
83+ }
84+
85+ yield;
86+ SignalHandler.disconnect (model, sig_id);
87+ }
88+
89 internal static Variant hash_table_to_asv (HashTable<string, Variant> hash)
90 {
91 var b = new VariantBuilder (new VariantType ("a{sv}"));

Subscribers

People subscribed via source and target branches