Merge lp:~ken-vandine/gwibber/libdee_libunity_port into lp:gwibber

Proposed by Ken VanDine
Status: Merged
Merged at revision: 1236
Proposed branch: lp:~ken-vandine/gwibber/libdee_libunity_port
Merge into: lp:gwibber
Diff against target: 236 lines (+43/-70)
4 files modified
configure.ac (+2/-2)
lens/src/daemon.vala (+26/-57)
libgwibber-gtk/stream-view.vala (+7/-6)
libgwibber/streams.vala (+8/-5)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/libdee_libunity_port
Reviewer Review Type Date Requested Status
Michael Terry (community) Approve
Review via email: mp+88454@code.launchpad.net

Description of the change

Ported to latest libunity and libdee

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Seems fine. I'm not a dee expert, but nothing seems egregiously wrong and tests work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-01-05 19:33:08 +0000
3+++ configure.ac 2012-01-13 08:24:36 +0000
4@@ -126,11 +126,11 @@
5 GLIB_REQUIRED=2.26
6 GTK_REQUIRED=3.2
7 GDK_REQUIRED=3.2
8-DEE_REQUIRED=0.5.19
9+DEE_REQUIRED=1.0.0
10 DBUSMENU_REQUIRED=0.4
11 INDICATE_REQUIRED=0.5
12 LIBNOTIFY_REQUIRED=0.7
13-UNITY_REQUIRED=4.0.0
14+UNITY_REQUIRED=4.99.99
15 PKG_CHECK_MODULES(BASE,
16 glib-2.0 >= $GLIB_REQUIRED
17 gobject-2.0 >= $GLIB_REQUIRED
18
19=== modified file 'lens/src/daemon.vala'
20--- lens/src/daemon.vala 2011-10-25 18:52:53 +0000
21+++ lens/src/daemon.vala 2012-01-13 08:24:36 +0000
22@@ -41,11 +41,9 @@
23 private Gwibber.Utils utils;
24 private Dee.Model? _model;
25 private Dee.Model? _streams_model;
26- private Dee.Filter *_sort_filter;
27+ private Dee.Filter _sort_filter;
28 /* Keep track of the previous search, so we can determine when to
29 * filter down the result set instead of rebuilding it */
30- private LensSearch? previous_search;
31- private bool is_dirty;
32 private unowned Dee.ModelIter _stream_iter_first = null;
33 private unowned Dee.ModelIter _stream_iter_last = null;
34
35@@ -69,39 +67,38 @@
36 lens.add_local_scope (scope);
37
38 /* Listen for filter changes */
39- scope.filters_changed.connect (() => {
40- if (scope.active_search != null)
41+ scope.notify["active"].connect(() =>
42+ {
43+ if (scope.active)
44 {
45- is_dirty = true;
46- scope.notify_property ("active-search");
47+ scope.queue_search_changed (SearchType.DEFAULT);
48 }
49 });
50
51+ scope.search_changed.connect ((lens_search, search_type, cancellable) =>
52+ {
53+ if (search_type == SearchType.DEFAULT)
54+ update_scope_search.begin (lens_search, cancellable);
55+ else
56+ update_global_search.begin (lens_search, cancellable);
57+ });
58+
59 lens.notify["active"].connect ((obj, pspec) => {
60- if (lens.active && scope.active_search != null)
61+ if (lens.active && scope.active)
62 {
63 if (_stream_iter_first != _model.get_first_iter () || _stream_iter_last != _model.get_last_iter ())
64 {
65- is_dirty = true;
66- scope.notify_property ("active-search");
67+ if (scope.active)
68+ {
69+ scope.queue_search_changed (SearchType.DEFAULT);
70+ }
71 }
72 }
73 });
74
75- /* Listen for changes to the lens entry search */
76- scope.notify["active-search"].connect ((obj, pspec) => {
77- var search = scope.active_search;
78- is_dirty = false;
79- update_search (search);
80- previous_search = search;
81- });
82-
83- scope.notify["active-global-search"].connect ((obj, pspec) => {
84- var search = scope.active_global_search;
85- if (search_is_invalid (search))
86- return;
87- update_global_search (search);
88- previous_search = search;
89+ scope.filters_changed.connect (() =>
90+ {
91+ scope.queue_search_changed (SearchType.DEFAULT);
92 });
93
94 try
95@@ -114,8 +111,8 @@
96
97 _streams_model = streams_service.stream_model;
98 Intl.setlocale(LocaleCategory.COLLATE, "C");
99- _sort_filter = new Dee.Filter.collator_desc(StreamModelColumn.TIMESTAMP);
100- _model = new Dee.FilterModel (_sort_filter, _streams_model);
101+ _sort_filter = Dee.Filter.new_collator_desc (StreamModelColumn.TIMESTAMP);
102+ _model = new Dee.FilterModel (_streams_model, _sort_filter);
103 }
104
105 private void populate_filters ()
106@@ -245,7 +242,7 @@
107 }
108
109
110- private void update_global_search (LensSearch search)
111+ private async void update_global_search (LensSearch search, Cancellable cancellable)
112 {
113 var results_model = scope.global_results_model;
114
115@@ -254,49 +251,21 @@
116 return;
117 }
118
119- /* Prevent concurrent searches and concurrent updates of our models,
120- * by preventing any notify signals from propagating to us.
121- * Important: Remeber to thaw the notifys again! */
122- scope.freeze_notify ();
123-
124 var search_string = prepare_search_string (search);
125
126 update_results_model (results_model, search_string, null);
127
128- /* Allow new searches once we enter an idle again.
129- * We don't do it directly from here as that could mean we start
130- * changing the model even before we had flushed out current changes
131- */
132- Idle.add (() => {
133- scope.thaw_notify ();
134- return false;
135- });
136-
137 search.finished ();
138 }
139
140- private void update_search (LensSearch search)
141+ private async void update_scope_search (LensSearch search, Cancellable cancellable)
142 {
143- var results_model = scope.results_model;
144-
145- /* Prevent concurrent searches and concurrent updates of our models,
146- * by preventing any notify signals from propagating to us.
147- * Important: Remeber to thaw the notifys again! */
148- scope.freeze_notify ();
149+ var results_model = search.results_model;
150
151 var search_string = prepare_search_string (search);
152
153 update_results_model (results_model, search_string, null);
154
155- /* Allow new searches once we enter an idle again.
156- * We don't do it directly from here as that could mean we start
157- * changing the model even before we had flushed out current changes
158- */
159- Idle.add (() => {
160- scope.thaw_notify ();
161- return false;
162- });
163-
164 search.finished ();
165 }
166
167
168=== modified file 'libgwibber-gtk/stream-view.vala'
169--- libgwibber-gtk/stream-view.vala 2011-10-22 02:32:35 +0000
170+++ libgwibber-gtk/stream-view.vala 2012-01-13 08:24:36 +0000
171@@ -55,8 +55,7 @@
172
173 private Dee.Model? _model = null;
174 private Dee.Model? _stream_filter_model = null;
175- private Dee.Filter *stream_filter;
176- private Dee.Filter *sort_filter;
177+ private Dee.Filter sort_filter;
178 private int _position = 0;
179 private string _stream = "home";
180 private int _sort_order = 1;
181@@ -94,11 +93,13 @@
182 get { return _stream_filter_model; }
183 set {
184 if (sort_order == 0)
185- sort_filter = new Dee.Filter.collator(StreamModelColumn.TIMESTAMP);
186+ sort_filter = Dee.Filter.new_collator (StreamModelColumn.TIMESTAMP);
187 else
188- sort_filter = new Dee.Filter.collator_desc(StreamModelColumn.TIMESTAMP);
189- _stream_filter_model = new Dee.FilterModel (sort_filter, model);
190-
191+ sort_filter = Dee.Filter.new_collator_desc (StreamModelColumn.TIMESTAMP);
192+ Timer timer = new Timer();
193+ _stream_filter_model = new Dee.FilterModel (model, sort_filter);
194+ debug ("Applied sorting filter in %fms", timer.elapsed()*1000);
195+
196 refresh ();
197 Idle.add (() => {
198 adjustment.set_upper ((double)(_stream_filter_model.get_n_rows ()));
199
200=== modified file 'libgwibber/streams.vala'
201--- libgwibber/streams.vala 2011-12-08 22:04:59 +0000
202+++ libgwibber/streams.vala 2012-01-13 08:24:36 +0000
203@@ -167,17 +167,17 @@
204 if (stream == "home") {
205 return model;
206 } else {
207- stream_filter = new Dee.Filter.for_key_column (StreamModelColumn.STREAM, stream);
208+ stream_filter = Dee.Filter.new_for_key_column (StreamModelColumn.STREAM, stream);
209 }
210- var filtered_model = new Dee.FilterModel (stream_filter, model);
211+ var filtered_model = new Dee.FilterModel (model, stream_filter);
212 return filtered_model;
213 }
214
215 public Dee.Model? transient_filter_model (Dee.Model model, string transient)
216 {
217 Dee.Filter transient_filter;
218- transient_filter = new Dee.Filter.for_key_column (StreamModelColumn.TRANSIENT, transient);
219- var filtered_model = new Dee.FilterModel (transient_filter, model);
220+ transient_filter = Dee.Filter.new_for_key_column (StreamModelColumn.TRANSIENT, transient);
221+ var filtered_model = new Dee.FilterModel (model, transient_filter);
222 return filtered_model;
223 }
224
225@@ -198,7 +198,10 @@
226 {
227 debug ("Getting non-transient model");
228 Dee.SequenceModel? model = resources.load ("gwibber.stream_model") as Dee.SequenceModel;
229- debug ("stream_model from resources has %u rows", model.get_n_rows ());
230+ if (model is Dee.Model)
231+ debug ("stream_model from resources has %u rows", model.get_n_rows ());
232+ else
233+ debug ("stream_model from resources isn't valid");
234 if (!(model is Dee.SequenceModel))
235 {
236 debug ("Didn't get model from resource manager, creating a new one");