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