Merge lp:~unity-team/unity-lens-friends/libunity7-compatible into lp:unity-lens-friends

Proposed by James Henstridge
Status: Merged
Approved by: Ken VanDine
Approved revision: 61
Merged at revision: 55
Proposed branch: lp:~unity-team/unity-lens-friends/libunity7-compatible
Merge into: lp:unity-lens-friends
Diff against target: 580 lines (+125/-149)
11 files modified
configure.ac (+6/-6)
data/Makefile.am (+7/-7)
data/social.scope.in.in (+7/-6)
data/unity-lens-friends.service.in (+1/-1)
debian/changelog (+23/-0)
debian/control (+8/-5)
debian/rules (+3/-3)
po/POTFILES.in (+1/-1)
src/Makefile.am (+2/-1)
src/daemon.vala (+65/-116)
src/main.vala (+2/-3)
To merge this branch: bzr merge lp:~unity-team/unity-lens-friends/libunity7-compatible
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+163668@code.launchpad.net

Commit message

Merge libunity7-compatible branch to trunk.

Description of the change

Merge the libunity7-compatible branch to trunk. We are in the process of integrating libunity7/smart-scopes into Saucy, so further development should be against the new API.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) :
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 2013-01-15 17:25:52 +0000
3+++ configure.ac 2013-05-14 09:34:26 +0000
4@@ -25,8 +25,8 @@
5 ######################################################
6 # intltool rule for generating translated .lens file
7 ######################################################
8-INTLTOOL_LENS_RULE='%.lens: %.lens.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
9-AC_SUBST(INTLTOOL_LENS_RULE)
10+INTLTOOL_SCOPE_RULE='%.scope: %.scope.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
11+AC_SUBST(INTLTOOL_SCOPE_RULE)
12
13 DEE_REQUIRED=1.0.0
14 UNITY_REQUIRED=6.7
15@@ -44,18 +44,18 @@
16 AC_SUBST(BASE_LIBS)
17
18 if test "x$with_localinstall" = "xyes"; then
19- LENSESDIR="${datadir}/unity/lenses"
20+ SCOPESDIR="${datadir}/unity/scopes"
21 else
22- LENSESDIR=`$PKG_CONFIG --variable=lensesdir unity`
23+ SCOPESDIR=`$PKG_CONFIG --variable=scopesdir unity`
24 fi
25-AC_SUBST(LENSESDIR)
26+AC_SUBST(SCOPESDIR)
27
28
29 AC_CONFIG_FILES([
30 Makefile
31 src/Makefile
32 data/Makefile
33- data/friends.lens.in
34+ data/social.scope.in
35 data/icons/Makefile
36 data/icons/hicolor/Makefile
37 data/icons/hicolor/scalable/places/Makefile
38
39=== modified file 'data/Makefile.am'
40--- data/Makefile.am 2012-10-26 23:23:06 +0000
41+++ data/Makefile.am 2013-05-14 09:34:26 +0000
42@@ -8,19 +8,19 @@
43 %.service: %.service.in
44 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
45
46-lens_in_files = friends.lens.in
47-lensdir = $(LENSESDIR)/friends
48-lens_DATA = $(lens_in_files:.lens.in=.lens)
49+scope_in_files = social.scope.in
50+scopedir = $(SCOPESDIR)
51+scope_DATA = $(scope_in_files:.scope.in=.scope)
52
53-@INTLTOOL_LENS_RULE@
54+@INTLTOOL_SCOPE_RULE@
55
56 defaultdir = $(datadir)/friends/unity
57
58 EXTRA_DIST = \
59- $(lens_DATA) \
60- $(lens_in_files) \
61+ $(scope_DATA) \
62+ $(scope_in_files) \
63 $(service_in_files)
64
65 CLEANFILES = \
66 $(dbus_services_DATA) \
67- $(lens_DATA)
68+ $(scope_DATA)
69
70=== renamed file 'data/friends.lens.in.in' => 'data/social.scope.in.in'
71--- data/friends.lens.in.in 2012-10-17 04:41:32 +0000
72+++ data/social.scope.in.in 2013-05-14 09:34:26 +0000
73@@ -1,14 +1,15 @@
74-[Lens]
75-DBusName=com.canonical.Unity.Lens.Friends
76-DBusPath=/com/canonical/unity/lens/friends
77-Icon=/usr/share/unity/6/lens-nav-gwibber.svg
78+[Scope]
79+DBusName=com.canonical.Unity.Scope.Friends
80+DBusPath=/com/canonical/unity/scope/friends
81+Icon=@prefix@/share/unity/icons/lens-nav-gwibber.svg
82 _Name=Social
83-_Description=Social Network
84+_Description=This is an Ubuntu search plugin that enables information from Online accounts to be searched and displayed in the Dash underneath the Social header. If you do not wish to search this content source, you can disable this search plugin.
85 _SearchHint=Enter name or content you would like to search for
86 Shortcut=g
87+Type=social
88
89 #
90 # Make translation work with Ubuntu's special handling of keyfiles
91 #
92 [Desktop Entry]
93-X-Ubuntu-Gettext-Domain=friends
94+X-Ubuntu-Gettext-Domain=unity-lens-friends
95
96=== modified file 'data/unity-lens-friends.service.in'
97--- data/unity-lens-friends.service.in 2012-10-17 20:13:50 +0000
98+++ data/unity-lens-friends.service.in 2013-05-14 09:34:26 +0000
99@@ -1,3 +1,3 @@
100 [D-BUS Service]
101-Name=com.canonical.Unity.Lens.Friends
102+Name=com.canonical.Unity.Scope.Friends
103 Exec=@libexecdir@/unity-lens-friends
104
105=== modified file 'debian/changelog'
106--- debian/changelog 2013-04-12 16:39:54 +0000
107+++ debian/changelog 2013-05-14 09:34:26 +0000
108@@ -1,3 +1,17 @@
109+unity-lens-friends (0.1.2daily13.05.07ubuntu.unity.experimental.certified-0ubuntu1) raring; urgency=low
110+
111+ [ Michal Hruby ]
112+ * Bump version
113+
114+ [ Ken VanDine ]
115+ * [FFe] Provide an API for access data from Friends (LP: #1156941)
116+
117+ [ Ubuntu daily release ]
118+ * Automatic snapshot from revision 60 (ubuntu-unity/experimental-
119+ certified)
120+
121+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 07 May 2013 07:22:42 +0000
122+
123 unity-lens-friends (0.1.1bzr13.04.12-0ubuntu1) raring; urgency=low
124
125 [ Sebastien Bacher ]
126@@ -11,6 +25,15 @@
127
128 unity-lens-friends (0.1.1bzr13.03.26-0ubuntu1) raring; urgency=low
129
130+ [ James Henstridge ]
131+ * Require new libunity.
132+
133+ [ Didier Roche ]
134+ * Some packaging fixes
135+ * transition from gwibber lens to the friends one
136+ * Automatic snapshot from revision 43 (bootstrap)
137+
138+ [ Ken VanDine ]
139 * strip links from content, the lens can't render them
140
141 -- Ken VanDine <ken.vandine@canonical.com> Tue, 26 Mar 2013 13:53:53 -0400
142
143=== modified file 'debian/control'
144--- debian/control 2013-04-12 15:12:28 +0000
145+++ debian/control 2013-05-14 09:34:26 +0000
146@@ -1,6 +1,6 @@
147 Source: unity-lens-friends
148 Section: misc
149-Priority: extra
150+Priority: optional
151 Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
152 Build-Depends: autotools-dev,
153 debhelper (>= 9),
154@@ -10,7 +10,7 @@
155 libaccounts-glib-dev,
156 libdee-dev (>= 1.0.0),
157 libfriends-dev (>= 0.1),
158- libunity-dev,
159+ libunity-dev (>= 6.91),
160 valac-0.18,
161 Standards-Version: 3.9.4
162 Homepage: https://launchpad.net/unity-lens-friends
163@@ -23,6 +23,9 @@
164 Depends: ${shlibs:Depends},
165 ${misc:Depends},
166 friends (>= 0.1.3),
167-Description: Friends Lens for unity
168- This package contains the "friends" lens which can be used
169- in Unity to view streams from Friends.
170+Conflicts: unity-lens-gwibber,
171+Provides: unity-lens-gwibber,
172+Replaces: unity-lens-gwibber,
173+Description: Friends scope for unity
174+ This package contains the "friends" scope which allows Unity
175+ to search for view streams from Friends.
176
177=== modified file 'debian/rules'
178--- debian/rules 2013-04-12 15:12:28 +0000
179+++ debian/rules 2013-05-14 09:34:26 +0000
180@@ -3,11 +3,11 @@
181 # Uncomment this to turn on verbose mode.
182 #export DH_VERBOSE=1
183
184+%:
185+ dh $@ --with autoreconf,translations
186+
187 override_dh_autoreconf:
188 NOCONFIGURE=1 dh_autoreconf ./autogen.sh
189
190 override_dh_install:
191 dh_install --fail-missing
192-
193-%:
194- dh $@ --with autoreconf,translations
195
196=== modified file 'po/POTFILES.in'
197--- po/POTFILES.in 2012-10-17 20:13:50 +0000
198+++ po/POTFILES.in 2013-05-14 09:34:26 +0000
199@@ -2,4 +2,4 @@
200
201 src/daemon.vala
202 src/main.vala
203-[type: gettext/ini] data/friends.lens.in.in
204+[type: gettext/ini] data/social.scope.in.in
205
206=== modified file 'src/Makefile.am'
207--- src/Makefile.am 2013-02-25 15:09:57 +0000
208+++ src/Makefile.am 2013-05-14 09:34:26 +0000
209@@ -26,7 +26,8 @@
210 --pkg unity \
211 --pkg gio-2.0 \
212 --pkg accounts \
213- --basedir=.
214+ --basedir=. \
215+ $(MAINTAINER_VALAFLAGS)
216
217 unity_lens_friends_LDADD = \
218 $(BASE_LIBS) \
219
220=== modified file 'src/daemon.vala'
221--- src/daemon.vala 2013-03-27 00:34:30 +0000
222+++ src/daemon.vala 2013-05-14 09:34:26 +0000
223@@ -25,7 +25,7 @@
224 namespace UnityFriends {
225
226 /* DBus name for the place. Must match out .place file */
227- const string BUS_NAME = "com.canonical.Unity.Lens.Friends";
228+ const string BUS_NAME = "com.canonical.Unity.Scope.Friends";
229 const string ICON_PATH = Config.DATADIR + "/icons/unity-icon-theme/places/svg/";
230 const string STRIP_LINKS = """</?a[^>]*>""";
231
232@@ -35,8 +35,7 @@
233 */
234 public class Daemon : GLib.Object
235 {
236- private Unity.Lens lens;
237- private Unity.Scope scope;
238+ private Unity.DeprecatedScope scope;
239 private Unity.PreferencesManager preferences = Unity.PreferencesManager.get_default ();
240 private unowned Dee.ResourceManager resources;
241 private Dee.Model? _model = null;
242@@ -53,16 +52,18 @@
243 private Ag.Manager _account_manager;
244 private bool _has_accounts = false;
245 private HashMap<string,Variant> featureMap;
246+ private Variant empty_asv;
247
248 construct
249 {
250- lens = new Unity.Lens("/com/canonical/unity/lens/friends", "friends");
251- lens.search_in_global = false;
252- lens.search_hint = _("Enter name or content you would like to search for");
253- lens.visible = false;
254+ empty_asv = new Variant.array (VariantType.VARDICT.element (), {});
255+ scope = new Unity.DeprecatedScope("/com/canonical/unity/scope/friends", "friends.scope");
256+ scope.search_in_global = false;
257+ scope.search_hint = _("Enter name or content you would like to search for");
258+ scope.visible = false;
259 try
260 {
261- lens.export ();
262+ scope.export ();
263 } catch (GLib.IOError e)
264 {
265 warning ("failed to export lens: %s", e.message);
266@@ -84,7 +85,7 @@
267 }
268 else if (accts.length () == 0)
269 {
270- lens.visible = false;
271+ scope.visible = false;
272 _has_accounts = false;
273 }
274 else
275@@ -98,58 +99,24 @@
276 void setup ()
277 {
278 setup_friends ();
279- scope = new Unity.Scope ("/com/canonical/unity/scope/friends");
280- scope.search_in_global = false;
281+
282+ scope.visible = true;
283 scope.preview_uri.connect (preview);
284
285- lens.visible = true;
286-
287- lens.add_local_scope (scope);
288-
289 /* Listen for filter changes */
290- scope.notify["active"].connect (() =>
291- {
292- if (scope.active)
293- {
294- scope.queue_search_changed (SearchType.DEFAULT);
295- }
296- });
297-
298 scope.generate_search_key.connect ((lens_search) =>
299 {
300 return lens_search.search_string.strip ();
301 });
302- scope.search_changed.connect ((lens_search, search_type, cancellable) =>
303- {
304- if (search_type == SearchType.DEFAULT)
305- update_scope_search.begin (lens_search, cancellable);
306- else
307- update_global_search.begin (lens_search, cancellable);
308- });
309-
310- lens.notify["active"].connect ((obj, pspec) => {
311- if (lens.active && scope.active)
312- {
313- if (_stream_iter_first != _model.get_first_iter () || _stream_iter_last != _model.get_last_iter ())
314- {
315- if (scope.active)
316- {
317- scope.queue_search_changed (SearchType.DEFAULT);
318- }
319- }
320- }
321- });
322-
323- scope.filters_changed.connect (() =>
324- {
325- scope.queue_search_changed (SearchType.DEFAULT);
326+ scope.search_changed.connect ((search, search_type, cancellable) =>
327+ {
328+ dispatch_search.begin (search, search_type, cancellable);
329 });
330
331 preferences.notify["remote-content-search"].connect ((obj, pspec) =>
332 {
333 scope.queue_search_changed (SearchType.DEFAULT);
334 });
335-
336 }
337
338 private void map_account_features ()
339@@ -238,7 +205,7 @@
340
341 private void populate_filters ()
342 {
343- var filters = new GLib.List<Unity.Filter> ();
344+ var filters = new Unity.FilterSet ();
345
346 /* Stream filter */
347 {
348@@ -254,21 +221,21 @@
349 filter.add_option ("public", _("Public"));
350 */
351
352- filters.append (filter);
353+ filters.add (filter);
354 }
355
356 /* Account filter */
357 {
358 var filter = create_account_filter ();
359- filters.append (filter);
360+ filters.add (filter);
361 }
362
363- lens.filters = filters;
364+ scope.filters = filters;
365
366 _account_manager.account_created.connect ((id) => {
367 debug ("ACCOUNT ADDED");
368 var _acct = _account_manager.get_account ((Ag.AccountId)id);
369- var filter = scope.get_filter ("account_id") as CheckOptionFilter;
370+ var filter = scope.filters.get_filter_by_id ("account_id") as CheckOptionFilter;
371 create_account_filter_option (filter, _acct);
372 map_account_features ();
373 });
374@@ -310,49 +277,49 @@
375
376 private void populate_categories ()
377 {
378- var categories = new GLib.List<Unity.Category> ();
379+ var categories = new Unity.CategorySet ();
380 Icon icon;
381
382 var icon_dir = File.new_for_path ("/usr/share/unity-lens-friends/ui/icons/hicolor/scalable/places/");
383
384 icon = new FileIcon (icon_dir.get_child ("group-messages.svg"));
385- var cat = new Unity.Category (_("Messages"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
386- categories.append (cat);
387+ var cat = new Unity.Category ("messages", _("Messages"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
388+ categories.add (cat);
389
390 icon = new FileIcon (icon_dir.get_child ("group-replies.svg"));
391- cat = new Unity.Category (_("Mentions"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
392- categories.append (cat);
393+ cat = new Unity.Category ("mentions", _("Mentions"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
394+ categories.add (cat);
395
396 icon = new FileIcon (icon_dir.get_child ("group-images.svg"));
397- cat = new Unity.Category (_("Images"), icon, Unity.CategoryRenderer.FLOW);
398- categories.append (cat);
399+ cat = new Unity.Category ("images", _("Images"), icon, Unity.CategoryRenderer.FLOW);
400+ categories.add (cat);
401
402 icon = new FileIcon (icon_dir.get_child ("group-videos.svg"));
403- cat = new Unity.Category (_("Videos"), icon, Unity.CategoryRenderer.FLOW);
404- categories.append (cat);
405+ cat = new Unity.Category ("videos", _("Videos"), icon, Unity.CategoryRenderer.FLOW);
406+ categories.add (cat);
407
408 icon = new FileIcon (icon_dir.get_child ("group-links.svg"));
409- cat = new Unity.Category (_("Links"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
410- categories.append (cat);
411+ cat = new Unity.Category ("links", _("Links"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
412+ categories.add (cat);
413
414 icon = new FileIcon (icon_dir.get_child ("group-private.svg"));
415- cat = new Unity.Category (_("Private"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
416- categories.append (cat);
417+ cat = new Unity.Category ("private", _("Private"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
418+ categories.add (cat);
419
420 icon = new FileIcon (icon_dir.get_child ("group-public.svg"));
421- cat = new Unity.Category (_("Public"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
422- categories.append (cat);
423+ cat = new Unity.Category ("public", _("Public"), icon, Unity.CategoryRenderer.HORIZONTAL_TILE);
424+ categories.add (cat);
425
426- lens.categories = categories;
427+ scope.categories = categories;
428 }
429
430
431- private bool is_empty_search (LensSearch search)
432+ private bool is_empty_search (DeprecatedScopeSearch search)
433 {
434 return search.search_string.strip () == "";
435 }
436
437- private async void update_global_search (LensSearch search, Cancellable cancellable)
438+ private async void dispatch_search (DeprecatedScopeSearch search, SearchType search_type, GLib.Cancellable cancellable)
439 {
440 /**
441 * only perform the request if the user has not disabled
442@@ -365,51 +332,29 @@
443 return;
444 }
445
446- var results_model = scope.global_results_model;
447-
448 // FIXME: no results for home screen of the dash?
449- if (is_empty_search (search))
450- {
451- search.finished ();
452- return;
453- }
454-
455- update_results_model (results_model, search.search_string, null);
456-
457- search.finished ();
458- }
459-
460- private async void update_scope_search (LensSearch search, Cancellable cancellable)
461- {
462- /**
463- * only perform the request if the user has not disabled
464- * online/commercial suggestions. That will hide the category as well.
465- */
466- if (preferences.remote_content_search != Unity.PreferencesManager.RemoteContent.ALL)
467- {
468- search.results_model.clear ();
469- search.finished ();
470- return;
471- }
472-
473- var results_model = search.results_model;
474-
475- update_results_model (results_model, search.search_string, null);
476- debug ("%u results", results_model.get_n_rows ());
477- search.finished ();
478- }
479-
480+ if (search_type == SearchType.GLOBAL && is_empty_search (search))
481+ {
482+ search.finished ();
483+ return;
484+ }
485+
486+ update_results_model (search, null);
487+ debug ("%u results", search.results_model.get_n_rows ());
488+ search.finished ();
489+ }
490
491 /* Generic method to update a results model. We do it like this to minimize
492 * code dup between updating the global- and the entry results model */
493- private void update_results_model (Dee.Model results_model,
494- string? search, Categories? category)
495+ private void update_results_model (DeprecatedScopeSearch search,
496+ Categories? category)
497 {
498 debug ("%u TOTAL ROWS", _model.get_n_rows ());
499 unowned Dee.ModelIter iter, end;
500
501+ var results_model = search.results_model;
502 var stream_ids = new Gee.ArrayList<string> ();
503- var filter = scope.get_filter("stream") as CheckOptionFilter;
504+ var filter = search.get_filter("stream") as CheckOptionFilter;
505 if (filter.filtering)
506 {
507 foreach (Unity.FilterOption option in filter.options)
508@@ -422,7 +367,7 @@
509 }
510
511 var account_ids = new Gee.ArrayList<string> ();
512- filter = scope.get_filter ("account_id") as CheckOptionFilter;
513+ filter = search.get_filter ("account_id") as CheckOptionFilter;
514 if (filter.filtering)
515 {
516 foreach (Unity.FilterOption option in filter.options)
517@@ -447,7 +392,7 @@
518
519 var term_list = Object.new (typeof (Dee.TermList)) as Dee.TermList;
520 // search only the folded terms, FIXME: is that a good idea?
521- _analyzer.tokenize (_ascii_filter.apply (search), term_list);
522+ _analyzer.tokenize (_ascii_filter.apply (search.search_string), term_list);
523
524 var matches = new Sequence<Dee.ModelIter> ();
525 for (uint i = 0; i < term_list.num_terms (); i++)
526@@ -556,7 +501,8 @@
527 case "private": group = Categories.PRIVATE; break;
528 case "public": group = Categories.PUBLIC; break;
529 }
530-
531+
532+ string uri = model.get_string (iter, StreamModelColumn.URL);
533 string _icon_uri = model.get_string (iter, StreamModelColumn.ICON_URI);
534 if (stream_id == "images")
535 _img_uri = model.get_string (iter, StreamModelColumn.LINK_PICTURE);
536@@ -569,12 +515,15 @@
537 else
538 _img_uri = get_avatar_path (_icon_uri);
539
540- results_model.append (model.get_string (iter, StreamModelColumn.URL),
541- _img_uri,
542- group,
543- "text/html",
544- GLib.Markup.escape_text (_model.get_string(iter, StreamModelColumn.SENDER)),
545- sanitize_message (_model.get_string(iter, StreamModelColumn.MESSAGE)));
546+ results_model.append (uri,
547+ _img_uri,
548+ group,
549+ ResultType.PERSONAL,
550+ "text/html",
551+ GLib.Markup.escape_text (_model.get_string(iter, StreamModelColumn.SENDER)),
552+ sanitize_message (_model.get_string(iter, StreamModelColumn.MESSAGE)),
553+ uri,
554+ empty_asv);
555 }
556
557 private string get_avatar_path (string uri)
558
559=== modified file 'src/main.vala'
560--- src/main.vala 2012-10-30 18:21:51 +0000
561+++ src/main.vala 2013-05-14 09:34:26 +0000
562@@ -67,7 +67,7 @@
563 * making it race against GDBus' worker thread to export our
564 * objects on the bus before/after owning our name and receiving
565 * method calls on our objects (which may not yet be up!)*/
566- if (dbus_name_has_owner ("com.canonical.Unity.Lens.Friends"))
567+ if (dbus_name_has_owner (BUS_NAME))
568 {
569 print ("Another instance of the Unity Friends Daemon " +
570 "already appears to be running.\nBailing out.\n");
571@@ -79,8 +79,7 @@
572 daemon = new Daemon ();
573
574 /* Use GApplication directly for single instance app functionality */
575- app = new Application ("com.canonical.Unity.Lens.Friends",
576- ApplicationFlags.IS_SERVICE);
577+ app = new Application (BUS_NAME, ApplicationFlags.IS_SERVICE);
578 try {
579 app.register ();
580 } catch (Error e) {

Subscribers

People subscribed via source and target branches

to all changes: