Merge lp:~stolowski/unity-lens-files/merge-smartscopes into lp:unity-lens-files

Proposed by Paweł Stołowski
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 258
Merged at revision: 254
Proposed branch: lp:~stolowski/unity-lens-files/merge-smartscopes
Merge into: lp:unity-lens-files
Diff against target: 1339 lines (+360/-410)
15 files modified
Makefile.am (+7/-7)
configure.ac (+16/-16)
data/Makefile.am (+2/-2)
data/unity-scope-files-local.service.in (+1/-1)
debian/changelog (+6/-0)
debian/control (+1/-1)
local.scope.in.in (+6/-5)
po/POTFILES.in (+1/-1)
src/Makefile.am (+5/-5)
src/daemon.vala (+293/-289)
src/locate.vala (+1/-1)
src/main.vala (+3/-3)
src/schemas.vala (+1/-20)
src/utils.vala (+15/-57)
tests/Makefile.am (+2/-2)
To merge this branch: bzr merge lp:~stolowski/unity-lens-files/merge-smartscopes
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+164231@code.launchpad.net

Commit message

Merge new scope API changes (100 scopes feature).

Description of the change

Merge new scope API changes (100 scopes feature).
Note: needs libunity 7.0.0 to land (should happen very soon).

To post a comment you must log in.
257. By Paweł Stołowski

Fixed requirement for libunity-dev.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
258. By Paweł Stołowski

Added changelog entry for 7.1.0.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Looks good, but it's late, soo... Anyway, approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2012-03-23 14:06:10 +0000
3+++ Makefile.am 2013-05-16 21:24:24 +0000
4@@ -1,16 +1,16 @@
5 SUBDIRS = src data po tests
6
7 #
8-# Install the files.lens file
9+# Install the local.scope file
10 #
11-lens_in_files = files.lens.in
12-lensdir = $(LENSESDIR)/files
13-lens_DATA = $(lens_in_files:.lens.in=.lens)
14+scope_in_files = local.scope.in
15+scopedir = $(SCOPESDIR)/files
16+scope_DATA = $(scope_in_files:.scope.in=.scope)
17
18 icondir = $(datadir)/unity/themes
19 icon_DATA = files.png
20
21-@INTLTOOL_LENS_RULE@
22+@INTLTOOL_SCOPE_RULE@
23
24 DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
25
26@@ -32,12 +32,12 @@
27 EXTRA_DIST = \
28 autogen.sh \
29 files.png \
30- $(lens_in_files) \
31+ $(scope_in_files) \
32 AUTHORS \
33 COPYING \
34 MAINTAINERS \
35 README
36
37 CLEANFILES = \
38- $(lens_DATA)
39+ $(scope_DATA)
40
41
42=== modified file 'configure.ac'
43--- configure.ac 2013-02-27 13:19:01 +0000
44+++ configure.ac 2013-05-16 21:24:24 +0000
45@@ -1,4 +1,4 @@
46-AC_INIT(unity-lens-files, 7.0, https://launchpad.net/unity-lens-files)
47+AC_INIT(unity-lens-files, 7.1, https://launchpad.net/unity-lens-files)
48 AC_COPYRIGHT([Copyright 2010-2012 Canonical])
49
50 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
51@@ -46,16 +46,16 @@
52 AC_DEFINE_UNQUOTED(PREFIXDIR, "${PREFIX}",[Prefix directory])
53
54 ######################################################
55-# intltool rule for generating translated .lens file
56+# intltool rule for generating translated .scope file
57 ######################################################
58-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 $< [$]@'
59-AC_SUBST(INTLTOOL_LENS_RULE)
60+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 $< [$]@'
61+AC_SUBST(INTLTOOL_SCOPE_RULE)
62
63 #####################################################
64 # Check for module and library dependancies
65 #####################################################
66 GLIB_REQUIRED=2.27
67-PKG_CHECK_MODULES(LENS_DAEMON,
68+PKG_CHECK_MODULES(SCOPE_DAEMON,
69 glib-2.0 >= $GLIB_REQUIRED
70 gobject-2.0 >= $GLIB_REQUIRED
71 gio-2.0 >= $GLIB_REQUIRED
72@@ -63,11 +63,11 @@
73 gee-1.0
74 dee-1.0 >= 0.5.16
75 zeitgeist-1.0 >= 0.3.17
76- unity >= 5.93.0)
77-
78-
79-AC_SUBST(LENS_DAEMON_CFLAGS)
80-AC_SUBST(LENS_DAEMON_LIBS)
81+ unity >= 7.0.0)
82+
83+
84+AC_SUBST(SCOPE_DAEMON_CFLAGS)
85+AC_SUBST(SCOPE_DAEMON_LIBS)
86
87 #####################################################
88 # local install for distcheck and stand-alone running
89@@ -107,21 +107,21 @@
90 GLIB_GSETTINGS
91
92 #####################################################
93-# Look for correct Lenses dir
94+# Look for correct Scopes dir
95 #####################################################
96 if test "x$with_localinstall" = "xyes"; then
97- LENSESDIR="${datadir}/unity/lenses"
98+ SCOPESDIR="${datadir}/unity/scopes"
99 else
100- LENSESDIR=`$PKG_CONFIG --variable=lensesdir unity`
101+ SCOPESDIR=`$PKG_CONFIG --variable=scopesdir unity`
102 fi
103-AC_SUBST(LENSESDIR)
104+AC_SUBST(SCOPESDIR)
105
106 #####################################################
107 # Create the Makefiles
108 #####################################################
109 AC_CONFIG_FILES([
110 Makefile
111- files.lens.in
112+ local.scope.in
113 data/Makefile
114 data/com.canonical.Unity.FilesLens.gschema.xml.in
115 src/Makefile
116@@ -146,5 +146,5 @@
117 Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS
118 Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS
119
120- Lenses Directory: ${LENSESDIR}
121+ Scopes Directory: ${SCOPESDIR}
122 ])
123
124=== modified file 'data/Makefile.am'
125--- data/Makefile.am 2012-11-08 22:50:09 +0000
126+++ data/Makefile.am 2013-05-16 21:24:24 +0000
127@@ -1,5 +1,5 @@
128 dbus_servicesdir = $(DBUSSERVICEDIR)
129-service_in_files = unity-lens-files.service.in
130+service_in_files = unity-scope-files-local.service.in
131 dbus_services_DATA = $(service_in_files:.service.in=.service)
132
133 %.service: %.service.in
134@@ -19,6 +19,6 @@
135 $(service_in_files)
136
137 CLEANFILES = \
138- unity-lens-files.service \
139+ unity-scope-files-local.service \
140 $(gsettings_SCHEMAS)
141
142
143=== renamed file 'data/unity-lens-files.service.in' => 'data/unity-scope-files-local.service.in'
144--- data/unity-lens-files.service.in 2012-11-08 22:50:09 +0000
145+++ data/unity-scope-files-local.service.in 2013-05-16 21:24:24 +0000
146@@ -1,3 +1,3 @@
147 [D-BUS Service]
148-Name=com.canonical.Unity.Lens.Files
149+Name=com.canonical.Unity.Scope.LocalFiles
150 Exec=@pkglibexecdir@/unity-files-daemon
151
152=== modified file 'debian/changelog'
153--- debian/changelog 2013-05-01 21:58:04 +0000
154+++ debian/changelog 2013-05-16 21:24:24 +0000
155@@ -1,3 +1,9 @@
156+unity-lens-files (7.1.0-0ubuntu1) UNRELEASED; urgency=low
157+
158+ * New upstream release.
159+
160+ -- Pawel Stolowski <pawel.stolowski@ubuntu.com> Thu, 16 May 2013 23:21:20 +0200
161+
162 unity-lens-files (7.0~daily13.05.01.1ubuntu.unity.next-0ubuntu1) raring; urgency=low
163
164 * Automatic snapshot from revision 252 (ubuntu-unity/next)
165
166=== modified file 'debian/control'
167--- debian/control 2013-04-12 12:25:57 +0000
168+++ debian/control 2013-05-16 21:24:24 +0000
169@@ -10,7 +10,7 @@
170 libgee-dev,
171 libdee-dev (>= 0.5.16),
172 libzeitgeist-dev (>= 0.3.17),
173- libunity-dev (>= 6.5.2),
174+ libunity-dev (>= 7.0.0),
175 zeitgeist-core (>= 0.5.0-0ubuntu2),
176 dh-autoreconf,
177 dh-translations,
178
179=== renamed file 'files.lens.in.in' => 'local.scope.in.in'
180--- files.lens.in.in 2012-07-05 11:34:20 +0000
181+++ local.scope.in.in 2013-05-16 21:24:24 +0000
182@@ -1,9 +1,10 @@
183-[Lens]
184-DBusName=com.canonical.Unity.Lens.Files
185-DBusPath=/com/canonical/unity/lens/files
186-Icon=@prefix@/share/unity/6/lens-nav-file.svg
187+[Scope]
188+DBusName=com.canonical.Unity.Scope.LocalFiles
189+DBusPath=/com/canonical/unity/scope/files
190+Icon=@prefix@/share/unity/icons/lens-nav-file.svg
191 _Name=Files & Folders
192-_Description=Find documents, downloads, and other files
193+Type=files
194+_Description=This is an Ubuntu search plugin that enables local files to be searched and displayed in the Dash underneath the Files & Folders header. If you do not wish to search this content source, you can disable this search plugin.
195 _SearchHint=Search Files & Folders
196 Shortcut=f
197
198
199=== modified file 'po/POTFILES.in'
200--- po/POTFILES.in 2011-08-11 08:52:55 +0000
201+++ po/POTFILES.in 2013-05-16 21:24:24 +0000
202@@ -2,5 +2,5 @@
203 src/daemon.vala
204 src/utils.vala
205 src/main.vala
206-[type: gettext/ini]files.lens.in.in
207+[type: gettext/ini]local.scope.in.in
208
209
210=== modified file 'src/Makefile.am'
211--- src/Makefile.am 2012-11-08 22:50:09 +0000
212+++ src/Makefile.am 2013-05-16 21:24:24 +0000
213@@ -8,18 +8,18 @@
214 pkglibexec_PROGRAMS = \
215 unity-files-daemon
216
217+AM_CFLAGS = -w
218+
219 unity_files_daemon_CPPFLAGS = \
220 -DDATADIR=\"$(DATADIR)\" \
221 -DPKGDATADIR=\"$(PKGDATADIR)\" \
222 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
223 -DG_LOG_DOMAIN=\"unity-files-daemon\" \
224- $(LENS_DAEMON_CFLAGS) \
225+ $(SCOPE_DAEMON_CFLAGS) \
226 $(MAINTAINER_CFLAGS) \
227 -I$(srcdir) \
228 -g
229
230-# Note that we require the GLIB_2_22 flag for Valac because libzeitgeist
231-# expects us to use g_ptr_array_unref instead of g_ptr_array_free.
232 unity_files_daemon_VALAFLAGS = \
233 -C \
234 --pkg dee-1.0 \
235@@ -28,11 +28,11 @@
236 --pkg gee-1.0 \
237 --pkg gio-2.0 \
238 --pkg gio-unix-2.0 \
239- --define=GLIB_2_22 \
240+ --target-glib=2.26 \
241 $(MAINTAINER_VALAFLAGS)
242
243 unity_files_daemon_LDADD = \
244- $(LENS_DAEMON_LIBS) \
245+ $(SCOPE_DAEMON_LIBS) \
246 $(NULL)
247
248 unity_files_daemon_VALASOURCES = \
249
250=== modified file 'src/daemon.vala'
251--- src/daemon.vala 2013-02-20 13:19:41 +0000
252+++ src/daemon.vala 2013-05-16 21:24:24 +0000
253@@ -37,8 +37,7 @@
254 private Devices devices;
255 private UrlChecker urls;
256
257- private Unity.Lens lens;
258- private Unity.Scope scope;
259+ private Unity.DeprecatedScope scope;
260
261 /* For each section we have a set of Zeitgeist.Event templates that
262 * we use to query Zeitgeist */
263@@ -49,32 +48,30 @@
264 private const string USE_LOCATE_KEY = "use-locate";
265 public bool use_locate { get; set; default = true; }
266
267- private Settings lens_settings;
268+ private Settings scope_settings;
269+ private Variant empty_asv;
270
271 construct
272 {
273+ empty_asv = new Variant.array (VariantType.VARDICT.element (), {});
274 prepare_type_templates ();
275
276 if (SCHEMA_NAME in Settings.list_schemas ())
277 {
278- lens_settings = new Settings (SCHEMA_NAME);
279- lens_settings.bind (USE_LOCATE_KEY, this, USE_LOCATE_KEY,
280+ scope_settings = new Settings (SCHEMA_NAME);
281+ scope_settings.bind (USE_LOCATE_KEY, this, USE_LOCATE_KEY,
282 SettingsBindFlags.GET);
283 }
284
285- scope = new Unity.Scope ("/com/canonical/unity/scope/files");
286+ scope = new Unity.DeprecatedScope ("/com/canonical/unity/scope/files",
287+ "files-local.scope");
288 scope.search_in_global = true;
289- scope.provides_personal_content = true;
290+ scope.search_hint = _("Search Files & Folders");
291 scope.activate_uri.connect (activate);
292 scope.preview_uri.connect (preview);
293
294- lens = new Unity.Lens("/com/canonical/unity/lens/files", "files");
295- lens.search_in_global = true;
296- lens.search_hint = _("Search Files & Folders");
297- lens.visible = true;
298 populate_categories ();
299 populate_filters ();
300- lens.add_local_scope (scope);
301
302 /* Bring up Zeitgeist interfaces */
303 log = new Zeitgeist.Log ();
304@@ -103,53 +100,48 @@
305 scope.queue_search_changed (SearchType.GLOBAL);
306 });
307
308- /* Listen for filter changes */
309- scope.filters_changed.connect (() => {
310- scope.queue_search_changed (SearchType.DEFAULT);
311- });
312-
313- scope.generate_search_key.connect ((lens_search) => {
314- return lens_search.search_string.strip ();
315- });
316-
317- /* Listen for changes to the lens entry search */
318- scope.search_changed.connect ((lens_search, search_type, cancellable) =>
319+ scope.generate_search_key.connect ((search) => {
320+ return search.search_string.strip ();
321+ });
322+
323+ /* Listen for changes to the search */
324+ scope.search_changed.connect ((search, search_type, cancellable) =>
325 {
326- dispatch_search.begin (lens_search, search_type, cancellable);
327+ dispatch_search.begin (search, search_type, cancellable);
328 });
329
330- lens.export ();
331+ scope.export ();
332 }
333
334- private async void dispatch_search (LensSearch lens_search,
335+ private async void dispatch_search (DeprecatedScopeSearch scope_search,
336 SearchType search_type,
337- Cancellable cancellable)
338+ GLib.Cancellable cancellable)
339 {
340 if (search_type == SearchType.GLOBAL)
341 {
342- yield update_global_search_async (lens_search, cancellable);
343+ yield update_global_search_async (scope_search, cancellable);
344 }
345 else
346 {
347- yield update_search_async (lens_search, cancellable);
348+ yield update_search_async (scope_search, cancellable);
349 }
350
351 // make sure we don't forget to emit finished (if we didn't get cancelled)
352 if (!cancellable.is_cancelled ())
353 {
354- if (lens_search.results_model.get_n_rows () == 0)
355+ if (scope_search.results_model.get_n_rows () == 0)
356 {
357- lens_search.set_reply_hint ("no-results-hint",
358+ scope_search.set_reply_hint ("no-results-hint",
359 _("Sorry, there are no files or folders that match your search."));
360 }
361
362- lens_search.finished ();
363 }
364+ scope_search.finished ();
365 }
366
367 private void populate_filters ()
368 {
369- var filters = new GLib.List<Unity.Filter> ();
370+ var filters = new Unity.FilterSet ();
371
372 /* Last modified */
373 {
374@@ -159,7 +151,7 @@
375 filter.add_option ("last-30-days", _("Last 30 days"));
376 filter.add_option ("last-year", _("Last year"));
377
378- filters.append (filter);
379+ filters.add (filter);
380 }
381
382 /* Type filter */
383@@ -175,7 +167,7 @@
384 filter.add_option ("presentations", _("Presentations"));
385 filter.add_option ("other", _("Other"));
386
387- filters.append (filter);
388+ filters.add (filter);
389 }
390
391 /* Size filter */
392@@ -190,38 +182,34 @@
393 filter.add_option ("1GB", _("1GB"));
394 filter.add_option (">1GB", _(">1GB"));
395
396- filters.append (filter);
397+ filters.add (filter);
398 }
399
400- lens.filters = filters;
401+ scope.filters = filters;
402 }
403
404 private void populate_categories ()
405 {
406- var categories = new GLib.List<Unity.Category> ();
407+ var categories = new Unity.CategorySet ();
408 var icon_dir = File.new_for_path (ICON_PATH);
409
410- var cat = new Unity.Category (_("Recent"),
411- new FileIcon (icon_dir.get_child ("group-recent.svg")));
412- categories.append (cat);
413+ var cat = new Unity.Category ("global", _("Files & Folders"),
414+ new FileIcon (icon_dir.get_child ("group-folders.svg")));
415+ categories.add (cat);
416
417- cat = new Unity.Category (_("Recent Files"),
418+ cat = new Unity.Category ("recent", _("Recent"),
419 new FileIcon (icon_dir.get_child ("group-recent.svg")));
420- categories.append (cat);
421+ categories.add (cat);
422
423- cat = new Unity.Category (_("Downloads"),
424+ cat = new Unity.Category ("downloads", _("Downloads"),
425 new FileIcon (icon_dir.get_child ("group-downloads.svg")));
426- categories.append (cat);
427-
428- cat = new Unity.Category (_("Folders"),
429- new FileIcon (icon_dir.get_child ("group-folders.svg")));
430- categories.append (cat);
431-
432- cat = new Unity.Category (_("Files & Folders"),
433- new FileIcon (icon_dir.get_child ("group-folders.svg")));
434- categories.append (cat);
435-
436- lens.categories = categories;
437+ categories.add (cat);
438+
439+ cat = new Unity.Category ("folders", _("Folders"),
440+ new FileIcon (icon_dir.get_child ("group-folders.svg")));
441+ categories.add (cat);
442+
443+ scope.categories = categories;
444 }
445
446 private void init_templates (HashTable<string, Event> templates,
447@@ -374,14 +362,14 @@
448 return templates;
449 }
450
451- private bool is_search_empty (LensSearch search)
452+ private bool is_search_empty (DeprecatedScopeSearch search)
453 {
454 if (search.search_string == null) return true;
455
456 return search.search_string.strip () == "";
457 }
458
459- private string prepare_search_string (LensSearch search)
460+ private string prepare_search_string (DeprecatedScopeSearch search)
461 {
462 var s = search.search_string;
463
464@@ -401,8 +389,8 @@
465 return s;
466 }
467
468- private async void update_global_search_async (LensSearch search,
469- Cancellable cancellable)
470+ private async void update_global_search_async (DeprecatedScopeSearch search,
471+ GLib.Cancellable cancellable)
472 {
473 var has_search = !is_search_empty (search);
474 var results_model = search.results_model;
475@@ -416,7 +404,7 @@
476 /* Get results ranked by recency */
477 var results = yield run_zg_query (search,
478 new Zeitgeist.TimeRange.anytime (),
479- ResultType.MOST_RECENT_CURRENT_URI,
480+ Zeitgeist.ResultType.MOST_RECENT_CURRENT_URI,
481 null,
482 20,
483 cancellable);
484@@ -431,12 +419,12 @@
485 {
486 results_model.append (checked_url, urls.get_icon_for_type(url_type),
487 Categories.FILES_AND_FOLDERS,
488+ ResultType.PERSONAL,
489 "text/html", search.search_string,
490- checked_url, checked_url);
491+ checked_url, checked_url, empty_asv);
492 }
493
494- var category_id = has_search ?
495- Categories.FILES_AND_FOLDERS : Categories.RECENT_FILES;
496+ var category_id = Categories.FILES_AND_FOLDERS;
497
498 Set<string>? bookmark_uris = null;
499 if (has_search)
500@@ -456,10 +444,10 @@
501 }
502
503 var result_flags = has_search ? ResultFlags.EXTRACT_ORIGINS : 0;
504- Unity.FilesLens.append_events_sorted (search.search_string,
505- results, results_model,
506- 0, int64.MAX, result_flags,
507- bookmark_uris, category_id);
508+ append_events_sorted (search.search_string,
509+ results, results_model,
510+ 0, int64.MAX, result_flags,
511+ bookmark_uris, category_id);
512
513 if (has_search)
514 {
515@@ -478,21 +466,21 @@
516 {
517 results = yield run_zg_query (search,
518 new Zeitgeist.TimeRange.anytime (),
519- ResultType.MOST_RECENT_CURRENT_URI,
520+ Zeitgeist.ResultType.MOST_RECENT_CURRENT_URI,
521 null,
522 40,
523 cancellable,
524 true);
525
526- Unity.FilesLens.append_events_sorted (search.search_string,
527- results, results_model,
528- 0, int64.MAX, ResultFlags.NONE,
529- null, Categories.DOWNLOADS);
530+ append_events_sorted (search.search_string,
531+ results, results_model,
532+ 0, int64.MAX, ResultFlags.NONE,
533+ null, Categories.DOWNLOADS);
534 }
535
536 if (has_search && use_locate)
537 {
538- yield perform_locate (500, search.search_string,
539+ yield perform_locate (search, 500, search.search_string,
540 search.results_model, cancellable,
541 Categories.FILES_AND_FOLDERS,
542 Categories.FILES_AND_FOLDERS);
543@@ -506,16 +494,16 @@
544 }
545 }
546
547- private async void update_search_async (LensSearch search,
548- Cancellable cancellable)
549+ private async void update_search_async (DeprecatedScopeSearch search,
550+ GLib.Cancellable cancellable)
551 {
552 var results_model = search.results_model;
553 var txn = new Dee.Transaction (results_model);
554 var has_search = !is_search_empty (search);
555
556- var filter = scope.get_filter ("type") as OptionsFilter;
557+ var filter = search.get_filter ("type") as OptionsFilter;
558
559- var active_filters = get_current_types ();
560+ var active_filters = get_current_types (search);
561 bool only_folders = active_filters != null &&
562 active_filters.length == 1 && active_filters[0] == "folders";
563 uint timer_id = 0;
564@@ -523,12 +511,12 @@
565 try
566 {
567 /* Get results ranked by recency */
568- ResultSet? results = null;
569+ Zeitgeist.ResultSet? results = null;
570 if (!only_folders)
571 {
572 results = yield run_zg_query (search,
573- get_current_timerange (),
574- ResultType.MOST_RECENT_CURRENT_URI,
575+ get_current_timerange (search),
576+ Zeitgeist.ResultType.MOST_RECENT_CURRENT_URI,
577 filter,
578 50,
579 cancellable);
580@@ -543,37 +531,37 @@
581 if (checked_url != null)
582 {
583 txn.append (checked_url, urls.get_icon_for_type(url_type),
584- Categories.RECENT,
585+ Categories.RECENT, ResultType.PERSONAL,
586 "text/html", search.search_string,
587- checked_url, checked_url);
588+ checked_url, checked_url, empty_asv);
589 }
590
591 /* apply filters to results found by zeitgeist */
592 int64 min_size, max_size;
593- get_current_size_limits (out min_size, out max_size);
594+ get_current_size_limits (search, out min_size, out max_size);
595
596 if (results != null)
597 {
598- Unity.FilesLens.append_events_sorted (search.search_string,
599- results, txn,
600- min_size, max_size,
601- ResultFlags.SKIP_FOLDERS);
602+ append_events_sorted (search.search_string,
603+ results, txn,
604+ min_size, max_size,
605+ ResultFlags.SKIP_FOLDERS);
606 }
607
608 /* get recently downloaded files */
609 results = yield run_zg_query (search,
610- get_current_timerange (),
611- ResultType.MOST_RECENT_CURRENT_URI,
612+ get_current_timerange (search),
613+ Zeitgeist.ResultType.MOST_RECENT_CURRENT_URI,
614 filter,
615 50,
616 cancellable,
617 true);
618
619- Unity.FilesLens.append_events_sorted (search.search_string,
620- results, txn,
621- min_size, max_size,
622- ResultFlags.NONE,
623- null, Categories.DOWNLOADS);
624+ append_events_sorted (search.search_string,
625+ results, txn,
626+ min_size, max_size,
627+ ResultFlags.NONE,
628+ null, Categories.DOWNLOADS);
629
630 /* commit if the origin query is taking too long, if we committed right
631 * away, we'd cause flicker */
632@@ -595,8 +583,8 @@
633 if (filter == null ||
634 !filter.filtering || filter.get_option ("folders").active)
635 {
636- results = yield run_zg_query (search, get_current_timerange (),
637- ResultType.MOST_RECENT_ORIGIN,
638+ results = yield run_zg_query (search, get_current_timerange (search),
639+ Zeitgeist.ResultType.MOST_RECENT_ORIGIN,
640 null, 50, cancellable);
641
642 if (!txn.is_committed ()) txn.commit ();
643@@ -618,11 +606,11 @@
644 bookmark_uris.add (bookmark_obj.dnd_uri);
645 }
646
647- Unity.FilesLens.append_events_sorted (search.search_string,
648- results, results_model,
649- min_size, max_size,
650- ResultFlags.USE_ORIGIN,
651- bookmark_uris);
652+ append_events_sorted (search.search_string,
653+ results, results_model,
654+ min_size, max_size,
655+ ResultFlags.USE_ORIGIN,
656+ bookmark_uris);
657
658 GLib.List<Device> matching_devices;
659
660@@ -642,7 +630,7 @@
661
662 if (has_search && use_locate)
663 {
664- yield perform_locate (500, search.search_string,
665+ yield perform_locate (search, 500, search.search_string,
666 search.results_model, cancellable);
667 }
668
669@@ -658,10 +646,10 @@
670 }
671 }
672
673- private string[]? get_current_types ()
674+ private string[]? get_current_types (DeprecatedScopeSearch search)
675 {
676 /* returns null if the filter is disabled / all options selected */
677- var filter = scope.get_filter ("type") as CheckOptionFilter;
678+ var filter = search.get_filter ("type") as CheckOptionFilter;
679
680 if (filter == null || !filter.filtering) return null;
681 string[] types = {};
682@@ -679,9 +667,9 @@
683 return types;
684 }
685
686- private TimeRange get_current_timerange ()
687+ private TimeRange get_current_timerange (DeprecatedScopeSearch search)
688 {
689- var filter = scope.get_filter ("modified") as RadioOptionFilter;
690+ var filter = search.get_filter ("modified") as RadioOptionFilter;
691 Unity.FilterOption? option = filter.get_active_option ();
692
693 string date = option == null ? "all" : option.id;
694@@ -696,9 +684,9 @@
695 return new TimeRange.anytime ();
696 }
697
698- private void get_current_size_limits (out int64 min_size, out int64 max_size)
699+ private void get_current_size_limits (DeprecatedScopeSearch search, out int64 min_size, out int64 max_size)
700 {
701- var filter = scope.get_filter ("size") as MultiRangeFilter;
702+ var filter = search.get_filter ("size") as MultiRangeFilter;
703 Unity.FilterOption? min_opt = filter.get_first_active ();
704 Unity.FilterOption? max_opt = filter.get_last_active ();
705
706@@ -766,16 +754,16 @@
707 }
708 }
709
710- private async ResultSet? run_zg_query (LensSearch search,
711- TimeRange time_range,
712- ResultType result_type,
713- OptionsFilter? filters,
714- uint num_results,
715- Cancellable cancellable,
716- bool downloads_only = false)
717- throws Error
718+ private async Zeitgeist.ResultSet? run_zg_query (
719+ DeprecatedScopeSearch search,
720+ TimeRange time_range,
721+ Zeitgeist.ResultType result_type,
722+ OptionsFilter? filters,
723+ uint num_results,
724+ GLib.Cancellable cancellable,
725+ bool downloads_only = false) throws Error
726 {
727- ResultSet results;
728+ Zeitgeist.ResultSet results;
729 var timer = new Timer ();
730 var templates = create_template (filters, downloads_only);
731 if (templates == null) return null;
732@@ -824,8 +812,9 @@
733 foreach (var bookmark in bookmarks)
734 {
735 results_model.append (bookmark.uri, bookmark.icon, category,
736- bookmark.mimetype, bookmark.display_name,
737- bookmark.dnd_uri);
738+ ResultType.PERSONAL,
739+ bookmark.mimetype, bookmark.display_name, "",
740+ bookmark.dnd_uri, empty_asv);
741 }
742 }
743
744@@ -836,22 +825,36 @@
745 foreach (var device in devices)
746 {
747 results_model.append (device.uri, device.icon_name, category,
748- "", device.display_name,
749- device.dnd_uri);
750+ ResultType.PERSONAL, "", device.display_name, "",
751+ device.dnd_uri, empty_asv);
752 }
753 }
754
755- private async void perform_locate (uint timeout,
756+ private async void perform_locate (DeprecatedScopeSearch search,
757+ uint timeout,
758 string query,
759 Dee.Model results_model,
760- Cancellable cancellable,
761+ GLib.Cancellable cancellable,
762 int files_category = Categories.RECENT,
763 int dirs_category = Categories.FOLDERS)
764 throws Error
765 {
766+ cancellable.set_error_if_cancelled (); // throws IOError
767 /* Wait a while before starting the locate search */
768- Timeout.add_full (Priority.LOW, timeout, perform_locate.callback);
769+ uint timer_src_id = Timeout.add_full (Priority.LOW, timeout,
770+ perform_locate.callback);
771+ var canc_id = cancellable.connect (() =>
772+ {
773+ if (timer_src_id != 0) Source.remove (timer_src_id);
774+ timer_src_id = 0;
775+ // can't invoke directly, the disconnect call would deadlock
776+ Idle.add_full (Priority.DEFAULT, perform_locate.callback);
777+ });
778 yield;
779+
780+ cancellable.disconnect (canc_id);
781+ if (timer_src_id != 0) Source.remove (timer_src_id);
782+
783 cancellable.set_error_if_cancelled (); // throws IOError
784
785 var results = yield Locate.locate (query, cancellable);
786@@ -867,10 +870,10 @@
787 model_iter = results_model.next (model_iter);
788 }
789
790- var timerange = get_current_timerange ();
791+ var timerange = get_current_timerange (search);
792 int64 min_size, max_size;
793- get_current_size_limits (out min_size, out max_size);
794- var types = get_current_types ();
795+ get_current_size_limits (search, out min_size, out max_size);
796+ var types = get_current_types (search);
797
798 foreach (var info in results)
799 {
800@@ -898,8 +901,9 @@
801 uint category_id = mimetype == "inode/directory" ?
802 dirs_category : files_category;
803
804- results_model.append (uri, icon_hint, category_id,
805- mimetype, info.get_display_name (), uri);
806+ results_model.append (uri, icon_hint, category_id, ResultType.PERSONAL,
807+ mimetype, info.get_display_name (), "", uri,
808+ empty_asv);
809 }
810 }
811
812@@ -1184,180 +1188,180 @@
813 scope.queue_search_changed (SearchType.DEFAULT);
814 scope.queue_search_changed (SearchType.GLOBAL);
815 }
816- }
817-
818- private const string ATTRS_TYPE_HIDDEN = FileAttribute.STANDARD_TYPE +
819- "," + FileAttribute.STANDARD_IS_HIDDEN;
820- private const string ATTRS_TYPE_SIZE_HIDDEN = FileAttribute.STANDARD_TYPE +
821- "," + FileAttribute.STANDARD_SIZE +
822- "," + FileAttribute.STANDARD_IS_HIDDEN;
823-
824- [Flags]
825- public enum ResultFlags
826- {
827- NONE = 0,
828- USE_ORIGIN,
829- EXTRACT_ORIGINS,
830- SKIP_FOLDERS,
831- }
832-
833- /* Appends a set of Zeitgeist.Events to our Dee.Model assuming that
834- * these events are already sorted with descending timestamps */
835- public void append_events_sorted (string search_string,
836- Zeitgeist.ResultSet? events,
837- Dee.Model results,
838- int64 min_size, int64 max_size,
839- ResultFlags flags,
840- Gee.Set<string>? excluded_uris = null,
841- int category_override = -1)
842- {
843- if (events == null) return;
844- uint category_id;
845- Set<string>? extracted_directories = null;
846-
847- if (ResultFlags.EXTRACT_ORIGINS in flags)
848- {
849- var folded_search = search_string.casefold ();
850- var origins = new HashSet<string> ();
851- // loop through all found events, take a look at origin field, add it
852- // to result set if it matches our search
853- // NOTE: using separate zg query with MOST_RECENT_ORIGINS grouping
854- // is more likely to find relevant directories, but is much slower
855- // than this kind of "approximation"
856+
857+ private const string ATTRS_TYPE_HIDDEN = FileAttribute.STANDARD_TYPE +
858+ "," + FileAttribute.STANDARD_IS_HIDDEN;
859+ private const string ATTRS_TYPE_SIZE_HIDDEN = FileAttribute.STANDARD_TYPE +
860+ "," + FileAttribute.STANDARD_SIZE +
861+ "," + FileAttribute.STANDARD_IS_HIDDEN;
862+
863+ [Flags]
864+ public enum ResultFlags
865+ {
866+ NONE = 0,
867+ USE_ORIGIN,
868+ EXTRACT_ORIGINS,
869+ SKIP_FOLDERS,
870+ }
871+
872+ /* Appends a set of Zeitgeist.Events to our Dee.Model assuming that
873+ * these events are already sorted with descending timestamps */
874+ public void append_events_sorted (string search_string,
875+ Zeitgeist.ResultSet? events,
876+ Dee.Model results,
877+ int64 min_size, int64 max_size,
878+ ResultFlags flags,
879+ Gee.Set<string>? excluded_uris = null,
880+ int category_override = -1)
881+ {
882+ if (events == null) return;
883+ uint category_id;
884+ Set<string>? extracted_directories = null;
885+
886+ if (ResultFlags.EXTRACT_ORIGINS in flags)
887+ {
888+ var folded_search = search_string.casefold ();
889+ var origins = new HashSet<string> ();
890+ // loop through all found events, take a look at origin field, add it
891+ // to result set if it matches our search
892+ // NOTE: using separate zg query with MOST_RECENT_ORIGINS grouping
893+ // is more likely to find relevant directories, but is much slower
894+ // than this kind of "approximation"
895+ foreach (var ev in events)
896+ {
897+ if (ev.num_subjects () > 0)
898+ {
899+ string origin = ev.get_subject (0).get_origin ();
900+ if (origin == null || origin == "") continue;
901+ var f = File.new_for_uri (origin);
902+ origin = f.get_uri ();
903+ if (excluded_uris != null && origin in excluded_uris) continue;
904+ if (!(origin in origins) && f.is_native () && f.query_exists ())
905+ {
906+ string? path = f.get_path ();
907+ if (path != null && path.contains ("/."))
908+ continue;
909+
910+ var display_name = Path.get_basename (f.get_parse_name ());
911+ if (display_name.casefold ().has_prefix (folded_search))
912+ {
913+ string mimetype = "inode/directory";
914+ string icon = Utils.get_icon_for_uri (origin, mimetype);
915+ if (category_override >= 0)
916+ category_id = category_override;
917+ else
918+ category_id = Categories.FOLDERS;
919+ results.append (origin, icon, category_id, ResultType.PERSONAL,
920+ mimetype, display_name, "", origin, empty_asv);
921+ }
922+ else
923+ {
924+ if (extracted_directories == null)
925+ {
926+ extracted_directories = new HashSet<string> ();
927+ }
928+ extracted_directories.add (origin);
929+ }
930+ origins.add (origin);
931+ }
932+ }
933+ }
934+ // we need this because of way ResultSet works with foreach
935+ if (events.size () > 0) events.seek (0);
936+ }
937 foreach (var ev in events)
938 {
939 if (ev.num_subjects () > 0)
940 {
941- string origin = ev.get_subject (0).get_origin ();
942- if (origin == null || origin == "") continue;
943- var f = File.new_for_uri (origin);
944- origin = f.get_uri ();
945- if (excluded_uris != null && origin in excluded_uris) continue;
946- if (!(origin in origins) && f.is_native () && f.query_exists ())
947- {
948- string? path = f.get_path ();
949- if (path != null && path.contains ("/."))
950- continue;
951-
952- var display_name = Path.get_basename (f.get_parse_name ());
953- if (display_name.casefold ().has_prefix (folded_search))
954- {
955- string mimetype = "inode/directory";
956- string icon = Utils.get_icon_for_uri (origin, mimetype);
957- if (category_override >= 0)
958- category_id = category_override;
959- else
960- category_id = Categories.FOLDERS;
961- results.append (origin, icon, category_id, mimetype,
962- display_name, "", origin);
963- }
964- else
965- {
966- if (extracted_directories == null)
967+ // FIXME: We only use the first subject...
968+ Zeitgeist.Subject su = ev.get_subject (0);
969+
970+ string uri;
971+ string display_name;
972+ string mimetype;
973+
974+ if (ResultFlags.USE_ORIGIN in flags)
975+ {
976+ uri = su.get_origin ();
977+ display_name = "";
978+ mimetype = "inode/directory";
979+ }
980+ else
981+ {
982+ uri = su.get_current_uri ();
983+ display_name = su.get_text ();
984+ mimetype = su.get_mimetype ();
985+ mimetype = su.get_mimetype () != null ?
986+ su.get_mimetype () : "application/octet-stream";
987+ }
988+ if (uri == null) continue;
989+ File file = File.new_for_uri (uri);
990+ if (excluded_uris != null && file.get_uri () in excluded_uris) continue;
991+
992+ if (display_name == null || display_name == "")
993+ {
994+ display_name = Path.get_basename (file.get_parse_name ());
995+ }
996+
997+ bool check_size = min_size > 0 || max_size < int64.MAX;
998+ /* Don't check existence on non-native files as http:// and
999+ * friends are *very* expensive to query */
1000+ FileType file_type = FileType.UNKNOWN;
1001+ if (file.is_native ())
1002+ {
1003+ // hidden files should be ignored
1004+ try
1005+ {
1006+ FileInfo info = file.query_info (check_size ?
1007+ ATTRS_TYPE_SIZE_HIDDEN : ATTRS_TYPE_HIDDEN, 0, null);
1008+ string? path = file.get_path ();
1009+ if (path != null && path.contains ("/."))
1010+ continue;
1011+ if (check_size &&
1012+ (info.get_size () < min_size || info.get_size () > max_size))
1013 {
1014- extracted_directories = new HashSet<string> ();
1015+ continue;
1016 }
1017- extracted_directories.add (origin);
1018+ file_type = info.get_file_type ();
1019 }
1020- origins.add (origin);
1021- }
1022- }
1023- }
1024- // we need this because of way ResultSet works with foreach
1025- if (events.size () > 0) events.seek (0);
1026- }
1027- foreach (var ev in events)
1028- {
1029- if (ev.num_subjects () > 0)
1030- {
1031- // FIXME: We only use the first subject...
1032- Zeitgeist.Subject su = ev.get_subject (0);
1033-
1034- string uri;
1035- string display_name;
1036- string mimetype;
1037-
1038- if (ResultFlags.USE_ORIGIN in flags)
1039- {
1040- uri = su.get_origin ();
1041- display_name = "";
1042- mimetype = "inode/directory";
1043- }
1044- else
1045- {
1046- uri = su.get_current_uri ();
1047- display_name = su.get_text ();
1048- mimetype = su.get_mimetype ();
1049- mimetype = su.get_mimetype () != null ?
1050- su.get_mimetype () : "application/octet-stream";
1051- }
1052- if (uri == null) continue;
1053- File file = File.new_for_uri (uri);
1054- if (excluded_uris != null && file.get_uri () in excluded_uris) continue;
1055-
1056- if (display_name == null || display_name == "")
1057- {
1058- display_name = Path.get_basename (file.get_parse_name ());
1059- }
1060-
1061- bool check_size = min_size > 0 || max_size < int64.MAX;
1062- /* Don't check existence on non-native files as http:// and
1063- * friends are *very* expensive to query */
1064- FileType file_type = FileType.UNKNOWN;
1065- if (file.is_native ())
1066- {
1067- // hidden files should be ignored
1068- try
1069- {
1070- FileInfo info = file.query_info (check_size ?
1071- ATTRS_TYPE_SIZE_HIDDEN : ATTRS_TYPE_HIDDEN, 0, null);
1072- string? path = file.get_path ();
1073- if (path != null && path.contains ("/."))
1074- continue;
1075- if (check_size &&
1076- (info.get_size () < min_size || info.get_size () > max_size))
1077+ catch (GLib.Error e)
1078 {
1079+ // as error occurred file must be missing therefore ignoring it
1080 continue;
1081 }
1082- file_type = info.get_file_type ();
1083- }
1084- catch (GLib.Error e)
1085- {
1086- // as error occurred file must be missing therefore ignoring it
1087- continue;
1088- }
1089+ }
1090+ string icon = Utils.get_icon_for_uri (uri, mimetype);
1091+ string comment = file.get_parse_name ();
1092+
1093+ var is_dir = file_type == FileType.DIRECTORY;
1094+ if (is_dir && ResultFlags.SKIP_FOLDERS in flags) continue;
1095+
1096+ if (category_override >= 0)
1097+ category_id = category_override;
1098+ else
1099+ category_id = is_dir ? Categories.FOLDERS : Categories.RECENT;
1100+
1101+ results.append (uri, icon, category_id, ResultType.PERSONAL, mimetype,
1102+ display_name, comment, uri, empty_asv);
1103+
1104 }
1105- string icon = Utils.get_icon_for_uri (uri, mimetype);
1106- string comment = file.get_parse_name ();
1107-
1108- var is_dir = file_type == FileType.DIRECTORY;
1109- if (is_dir && ResultFlags.SKIP_FOLDERS in flags) continue;
1110-
1111- if (category_override >= 0)
1112- category_id = category_override;
1113- else
1114- category_id = is_dir ? Categories.FOLDERS : Categories.RECENT;
1115-
1116- results.append (uri, icon, category_id, mimetype,
1117- display_name, comment, uri);
1118-
1119 }
1120- }
1121
1122- if (extracted_directories != null)
1123- {
1124- foreach (var dir_uri in extracted_directories)
1125+ if (extracted_directories != null)
1126 {
1127- var f = File.new_for_uri (dir_uri);
1128- var display_name = Path.get_basename (f.get_parse_name ());
1129- string mimetype = "inode/directory";
1130- string icon = Utils.get_icon_for_uri (dir_uri, mimetype);
1131- if (category_override >= 0)
1132- category_id = category_override;
1133- else
1134- category_id = Categories.FOLDERS;
1135- results.append (dir_uri, icon, category_id, mimetype,
1136- display_name, "", dir_uri);
1137+ foreach (var dir_uri in extracted_directories)
1138+ {
1139+ var f = File.new_for_uri (dir_uri);
1140+ var display_name = Path.get_basename (f.get_parse_name ());
1141+ string mimetype = "inode/directory";
1142+ string icon = Utils.get_icon_for_uri (dir_uri, mimetype);
1143+ if (category_override >= 0)
1144+ category_id = category_override;
1145+ else
1146+ category_id = Categories.FOLDERS;
1147+ results.append (dir_uri, icon, category_id, ResultType.PERSONAL,
1148+ mimetype, display_name, "", dir_uri, empty_asv);
1149+ }
1150 }
1151 }
1152 }
1153
1154=== modified file 'src/locate.vala'
1155--- src/locate.vala 2012-08-10 13:05:07 +0000
1156+++ src/locate.vala 2013-05-16 21:24:24 +0000
1157@@ -39,7 +39,7 @@
1158 private BlacklistTracker blacklist_tracker;
1159
1160 public async GLib.SList<FileInfo> locate (string input_query,
1161- Cancellable cancellable) throws Error
1162+ GLib.Cancellable cancellable) throws Error
1163 {
1164 if (blacklist_tracker == null) blacklist_tracker = new BlacklistTracker ();
1165 var result = new GLib.SList<FileInfo> ();
1166
1167=== modified file 'src/main.vala'
1168--- src/main.vala 2011-09-29 13:25:10 +0000
1169+++ src/main.vala 2013-05-16 21:24:24 +0000
1170@@ -22,6 +22,7 @@
1171
1172 namespace Unity.FilesLens {
1173
1174+ static const string DBUS_NAME = "com.canonical.Unity.Scope.LocalFiles";
1175 static Application? app = null;
1176 static Daemon? daemon = null;
1177
1178@@ -71,7 +72,7 @@
1179 * making it race against GDBus' worker thread to export our
1180 * objects on the bus before/after owning our name and receiving
1181 * method calls on our objects (which may not yet be up!)*/
1182- if (dbus_name_has_owner ("com.canonical.Unity.Lens.Files"))
1183+ if (dbus_name_has_owner (DBUS_NAME))
1184 {
1185 print ("Another instance of the Unity Files Daemon " +
1186 "already appears to be running.\nBailing out.\n");
1187@@ -83,8 +84,7 @@
1188 daemon = new Daemon ();
1189
1190 /* Use GApplication directly for single instance app functionality */
1191- app = new Application ("com.canonical.Unity.Lens.Files",
1192- ApplicationFlags.IS_SERVICE);
1193+ app = new Application (DBUS_NAME, ApplicationFlags.IS_SERVICE);
1194 try {
1195 app.register ();
1196 } catch (Error e) {
1197
1198=== modified file 'src/schemas.vala'
1199--- src/schemas.vala 2012-01-18 13:08:40 +0000
1200+++ src/schemas.vala 2013-05-16 21:24:24 +0000
1201@@ -19,30 +19,11 @@
1202
1203 namespace Unity.FilesLens {
1204
1205- public enum ResultsColumn
1206- {
1207- URI = 0,
1208- ICON_HINT,
1209- GROUP_ID,
1210- MIMETYPE,
1211- DISPLAY_NAME,
1212- COMMENT
1213- }
1214-
1215- public enum CategoriesColumn
1216- {
1217- RENDERER = 0,
1218- DISPLAY_NAME,
1219- ICON_HINT
1220- }
1221-
1222 public enum Categories
1223 {
1224+ FILES_AND_FOLDERS,
1225 RECENT,
1226- RECENT_FILES,
1227 DOWNLOADS,
1228 FOLDERS,
1229- FILES_AND_FOLDERS,
1230-
1231 }
1232 }
1233
1234=== modified file 'src/utils.vala'
1235--- src/utils.vala 2012-08-22 18:53:25 +0000
1236+++ src/utils.vala 2013-05-16 21:24:24 +0000
1237@@ -378,65 +378,23 @@
1238 }
1239 }
1240
1241- /* Run through @filter_set and remove any row from the result set's model
1242- * in which URI is not in @valid_uris */
1243- public void apply_uri_filter (Set<string> valid_uris,
1244- Dee.ResultSet filter_set)
1245- {
1246- var model = filter_set.get_model ();
1247- uint n_removed = 0;
1248- string uri;
1249-
1250- /* Anything in filter_set that is not in the event_uris set, is removed
1251- * from the results_model */
1252- foreach (var row in filter_set)
1253+ /* Extract a hash set of all subject uris in a Zeitgeist.ResultSet */
1254+ public Set<string> get_uri_set (Zeitgeist.ResultSet results)
1255 {
1256- uri = model.get_string (row, ResultsColumn.URI);
1257- if (!(uri in valid_uris))
1258+ Set<string> uris = new HashSet<string> ();
1259+
1260+ foreach (var ev in results)
1261 {
1262- model.remove (row);
1263- n_removed++;
1264- //debug (" - %s", uri);
1265+ for (int i = 0; i < ev.num_subjects(); i++)
1266+ uris.add (ev.get_subject (i).get_uri ());
1267 }
1268- }
1269-
1270- if (n_removed > 0)
1271- debug ("Removed %u rows from result set", n_removed);
1272- }
1273-
1274- /* Returns true iff new_search is a query that simply restricts the
1275- * result set of old_query */
1276- public bool check_is_filter_search (LensSearch new_search, LensSearch? old_search)
1277- {
1278- bool is_filter_search = false;
1279- if (old_search != null)
1280- {
1281- string previous_search_string = old_search.search_string;
1282- if (previous_search_string != null && previous_search_string != "")
1283- is_filter_search = new_search.search_string.has_prefix (
1284- previous_search_string);
1285- }
1286-
1287- return is_filter_search;
1288- }
1289-
1290- /* Extract a hash set of all subject uris in a Zeitgeist.ResultSet */
1291- public Set<string> get_uri_set (Zeitgeist.ResultSet results)
1292- {
1293- Set<string> uris = new HashSet<string> ();
1294-
1295- foreach (var ev in results)
1296- {
1297- for (int i = 0; i < ev.num_subjects(); i++)
1298- uris.add (ev.get_subject (i).get_uri ());
1299- }
1300-
1301- return uris;
1302- }
1303-
1304- public string normalize_string (string input)
1305- {
1306- return input.normalize (-1, NormalizeMode.ALL_COMPOSE).casefold ();
1307- }
1308+
1309+ return uris;
1310+ }
1311+
1312+ public string normalize_string (string input)
1313+ {
1314+ return input.normalize (-1, NormalizeMode.ALL_COMPOSE).casefold ();
1315+ }
1316
1317 } /* namespace */
1318
1319=== modified file 'tests/Makefile.am'
1320--- tests/Makefile.am 2012-03-20 09:40:56 +0000
1321+++ tests/Makefile.am 2013-05-16 21:24:24 +0000
1322@@ -4,7 +4,7 @@
1323
1324 AM_CPPFLAGS = \
1325 -w \
1326- $(LENS_DAEMON_CFLAGS) \
1327+ $(SCOPE_DAEMON_CFLAGS) \
1328 $(NULL)
1329
1330 AM_VALAFLAGS = \
1331@@ -13,7 +13,7 @@
1332 $(NULL)
1333
1334 test_libs = \
1335- $(LENS_DAEMON_LIBS) \
1336+ $(SCOPE_DAEMON_LIBS) \
1337 $(NULL)
1338
1339 test_url_checker_LDADD = $(test_libs)

Subscribers

People subscribed via source and target branches