Merge lp:~stolowski/unity-lens-applications/unity-lens-applications.formatting-fixes into lp:unity-lens-applications

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 315
Merged at revision: 291
Proposed branch: lp:~stolowski/unity-lens-applications/unity-lens-applications.formatting-fixes
Merge into: lp:unity-lens-applications
Prerequisite: lp:~stolowski/unity-lens-applications/unity-lens-applications.previews
Diff against target: 1340 lines (+425/-434)
2 files modified
src/daemon.vala (+238/-240)
src/unity-package-search.cc (+187/-194)
To merge this branch: bzr merge lp:~stolowski/unity-lens-applications/unity-lens-applications.formatting-fixes
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+118794@code.launchpad.net

Commit message

Formatting fixes

Description of the change

Formatting fixes.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

549 {
550 - case Category.INSTALLED:
551 + case Category.INSTALLED:
552 case Category.APPLICATIONS:

Haha, gotcha! :)

Overall looking good, but the branch still mixes curly braces on newline and not, don't we want to fix that as well?

Revision history for this message
Michal Hruby (mhr3) wrote :

Missed that this is ready. +1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :
315. By Paweł Stołowski

Merged trunk.

Revision history for this message
Michal Hruby (mhr3) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2012-08-16 08:30:47 +0000
3+++ src/daemon.vala 2012-08-21 12:26:20 +0000
4@@ -42,17 +42,17 @@
5 * the Xapian index from the Software Center */
6 private Unity.Package.Searcher? pkgsearcher;
7 public Unity.Package.Searcher appsearcher;
8-
9+
10 /* Read the app ratings dumped by the Software Center */
11 private Unity.Ratings.Database? ratings;
12
13 private Unity.Lens lens;
14 private Unity.Scope scope;
15-
16+
17 /* Support aptd dbus interface; created when application install/remove was requested by preview action */
18- private AptdProxy aptdclient;
19- private AptdTransactionProxy aptd_transaction;
20-
21+ private AptdProxy aptdclient;
22+ private AptdTransactionProxy aptd_transaction;
23+
24 /* Maps demangled names to mangled names expected by S-C xapian DB (e.g. kde4-KCharSelect.desktop -> kde4__KCharSelect.desktop).
25 There are very few apps that need this and we only store mappings when needed, so it takes very little memory.
26 */
27@@ -83,14 +83,14 @@
28
29 private Gee.List<string> image_extensions;
30 private HashTable<string,Icon> file_icon_cache;
31-
32+
33 /* Monitor the favorite apps in the launcher, so we can filter them
34 * out of the results for Recent Apps */
35 private Unity.LauncherFavorites favorite_apps;
36 private AppWatcher app_watcher;
37
38 private PtrArray zg_templates;
39-
40+
41 /* Gnome menu structure - also used to check whether apps are installed */
42 private uint app_menu_changed_reindex_timeout = 0;
43 private GMenu.Tree app_menu = null;
44@@ -118,7 +118,7 @@
45 monitor.events_inserted.connect (mark_dirty);
46 monitor.events_deleted.connect (mark_dirty);
47 log.install_monitor (monitor);
48-
49+
50 popularity_map = new HashMap<string, int> ();
51 popularities_dirty = true;
52 // refresh the popularities every now and then
53@@ -134,17 +134,17 @@
54
55 pkgsearcher = new Unity.Package.Searcher ();
56 if (pkgsearcher == null)
57- {
58- critical ("Failed to load Software Center index. 'Apps Available for Download' will not be listed");
59- }
60-
61+ {
62+ critical ("Failed to load Software Center index. 'Apps Available for Download' will not be listed");
63+ }
64+
65 try {
66 ratings = new Unity.Ratings.Database ();
67 } catch (FileError e) {
68 warning (e.message);
69 ratings = null;
70 }
71-
72+
73 /* Image file extensions in order of popularity */
74 image_extensions = new Gee.ArrayList<string> ();
75 image_extensions.add ("png");
76@@ -182,7 +182,7 @@
77 {
78 dispatch_search (lens_search, search_type, cancellable);
79 });
80-
81+
82 /* Re-do the search if the filters changed */
83 scope.filters_changed.connect (() =>
84 {
85@@ -200,10 +200,10 @@
86
87 /* Listen for changes in the installed applications */
88 AppInfoManager.get_default().changed.connect (mark_dirty);
89-
90+
91 /* Now start the RunEntry */
92 runner = new Unity.ApplicationsLens.Runner (this);
93-
94+
95 try {
96 uri_regex = new Regex ("^[a-z]+:.+$");
97 mountable_regex = new Regex ("((ftp|ssh|sftp|smb|dav)://).+");
98@@ -211,7 +211,7 @@
99 uri_regex = null;
100 critical ("Failed to compile URI regex. URL launching will be disabled");
101 }
102-
103+
104 favorite_apps = Unity.LauncherFavorites.get_default ();
105 favorite_apps.changed.connect(mark_dirty);
106
107@@ -220,7 +220,7 @@
108
109 aptdclient = new AptdProxy ();
110 launcherservice = new LauncherProxy ();
111-
112+
113 lens = new Unity.Lens ("/com/canonical/unity/lens/applications", "applications");
114 lens.search_hint = _("Search Applications");
115 lens.visible = true;
116@@ -280,9 +280,9 @@
117 var cat = new Unity.Category (_("Recently Used"),
118 new FileIcon (icon_dir.get_child ("group-recent.svg")));
119 categories.append (cat);
120-
121+
122 cat = new Unity.Category (_("Recent Apps"),
123- new FileIcon (icon_dir.get_child ("group-apps.svg")));
124+ new FileIcon (icon_dir.get_child ("group-apps.svg")));
125 categories.append (cat);
126
127 cat = new Unity.Category (_("Installed"),
128@@ -292,11 +292,11 @@
129 cat = new Unity.Category (_("Apps Available for Download"),
130 new FileIcon (icon_dir.get_child ("group-downloads.svg")));
131 categories.append (cat);
132-
133+
134 cat = new Unity.Category (_("Applications"),
135 new FileIcon (icon_dir.get_child ("group-apps.svg")));
136 categories.append (cat);
137-
138+
139 lens.categories = categories;
140 }
141
142@@ -308,7 +308,7 @@
143 {
144 var filter = new CheckOptionFilter ("type", _("Type"));
145 filter.sort_type = Unity.OptionsFilter.SortType.DISPLAY_NAME;
146-
147+
148 filter.add_option ("accessories", _("Accessories"));
149 filter.add_option ("education", _("Education"));
150 filter.add_option ("game", _("Games"));
151@@ -348,38 +348,37 @@
152 return usc_apps_option.active;
153 return true;
154 }
155-
156+
157 /* Load xdg menu info and build a Xapian index over it.
158 * Do throttled re-index if the menu changes */
159 private bool build_app_menu_index ()
160- {
161+ {
162 if (app_menu == null)
163- {
164- debug ("Building initial application menu");
165+ {
166+ debug ("Building initial application menu");
167
168- /* We need INCLUDE_NODISPLAY to employ proper de-duping between
169- * the Installed and Availabale categorys. If a NoDisplay app is installed,
170- * eg. Evince, it wont otherwise be in the menu index, only in the
171- * S-C index - thus show up in the Available category */
172- app_menu = GMenu.Tree.lookup ("unity-lens-applications.menu",
173- GMenu.TreeFlags.INCLUDE_NODISPLAY);
174-
175- app_menu.add_monitor ((menu) => {
176+ /* We need INCLUDE_NODISPLAY to employ proper de-duping between
177+ * the Installed and Availabale categorys. If a NoDisplay app is installed,
178+ * eg. Evince, it wont otherwise be in the menu index, only in the
179+ * S-C index - thus show up in the Available category */
180+ app_menu = GMenu.Tree.lookup ("unity-lens-applications.menu",
181+ GMenu.TreeFlags.INCLUDE_NODISPLAY);
182+
183+ app_menu.add_monitor ((menu) => {
184 /* Reschedule the timeout if we already have one. The menu tree triggers
185 * many change events during app installation. This way we wait the full
186 * delay *after* the last change event has triggered */
187 if (app_menu_changed_reindex_timeout != 0)
188 Source.remove (app_menu_changed_reindex_timeout);
189-
190- app_menu_changed_reindex_timeout =
191- Timeout.add_seconds (5, build_app_menu_index_and_result_models);
192+
193+ app_menu_changed_reindex_timeout = Timeout.add_seconds (5, build_app_menu_index_and_result_models);
194 });
195- }
196-
197+ }
198+
199 debug ("Indexing application menu");
200 appsearcher = new Unity.Package.Searcher.for_menu (app_menu);
201 app_menu_changed_reindex_timeout = 0;
202-
203+
204 return false;
205 }
206
207@@ -390,7 +389,7 @@
208 private bool build_app_menu_index_and_result_models ()
209 {
210 build_app_menu_index ();
211-
212+
213 mark_dirty ();
214
215 return false;
216@@ -418,15 +417,15 @@
217 OptionsFilter? options)
218 {
219 string s = search_string.strip ();
220-
221+
222 if (!s.has_suffix ("*") && s != "")
223 s = s + "*";
224-
225+
226 if (s != "")
227 s = @"app:($s)";
228 else
229 return extract_type_query (options);
230-
231+
232 if (options == null || !options.filtering)
233 return s;
234 else
235@@ -475,13 +474,13 @@
236 * to finish, to prevent flicker. */
237
238 debug ("Searching for: %s", search.search_string);
239-
240+
241 var filter = scope.get_filter ("type") as OptionsFilter;
242
243 string pkg_search_string = prepare_pkg_search_string (search, filter);
244
245 bool has_search = !Utils.is_search_empty (search);
246-
247+
248 Timer timer = new Timer ();
249
250 var transaction = new Dee.Transaction (model);
251@@ -540,8 +539,7 @@
252 // no need to bother
253 return;
254 } catch (GLib.Error e) {
255- warning ("Error performing search '%s': %s",
256- search.search_string, e.message);
257+ warning ("Error performing search '%s': %s", search.search_string, e.message);
258 }
259 }
260
261@@ -583,7 +581,7 @@
262
263 search.finished ();
264 }
265-
266+
267 private async void update_global_search (Unity.LensSearch search,
268 Cancellable cancellable)
269 {
270@@ -591,17 +589,17 @@
271 * In global search, with a non-empty search string, we collate all
272 * hits under one Applications category
273 */
274-
275+
276 if (Utils.is_search_empty (search))
277- {
278- yield update_global_without_search (search, cancellable);
279- return;
280- }
281-
282+ {
283+ yield update_global_without_search (search, cancellable);
284+ return;
285+ }
286+
287 var model = search.results_model;
288-
289+
290 model.clear ();
291-
292+
293 var search_string = prepare_pkg_search_string (search, null);
294 Set<string> installed_uris = new HashSet<string> ();
295 Set<string> available_uris = new HashSet<string> ();
296@@ -612,18 +610,18 @@
297 resort_pkg_search_results (appresults);
298 add_pkg_search_result (appresults, installed_uris, available_uris, model,
299 Category.APPLICATIONS);
300-
301+
302 timer.stop ();
303 debug ("Global search listed %i Installed apps in %fms for query: %s",
304 appresults.num_hits, timer.elapsed ()*1000, search_string);
305-
306+
307 /* Allow new searches once we enter an idle again.
308 * We don't do it directly from here as that could mean we start
309 * changing the model even before we had flushed out current changes
310 */
311 search.finished ();
312 }
313-
314+
315 private async void update_global_without_search (Unity.LensSearch search,
316 Cancellable cancellable)
317 {
318@@ -631,8 +629,8 @@
319 * In global search, with an empty search string, we show just Recent Apps
320 * Excluding apps with icons in the launcher (be they running or faves)
321 */
322- var model = search.results_model;
323-
324+ var model = search.results_model;
325+
326 Timer timer = new Timer ();
327
328 if (local_apps_active () && display_recent_apps)
329@@ -705,37 +703,37 @@
330
331 return result == null ? "NOT category:XYZ" : "(%s)".printf (result);
332 }
333-
334+
335 private string prepare_pkg_search_string (Unity.LensSearch search,
336 OptionsFilter? options)
337 {
338 if (Utils.is_search_empty (search))
339- {
340- if (options == null || !options.filtering)
341- return "type:Application";
342- else
343- return "type:Application AND " + extract_type_query (options);
344- }
345+ {
346+ if (options == null || !options.filtering)
347+ return "type:Application";
348+ else
349+ return "type:Application AND " + extract_type_query (options);
350+ }
351 else
352- {
353- var s = search.search_string;
354-
355- s = s.strip ();
356-
357- /* The Xapian query parser seems to handle hyphens in a special way,
358- * namely that it forces the joined tokens into a phrase query
359- * no matter if it appears as the last word in a query and we have
360- * the PARTIAL flag set on the query parser. This makes 'd-f' not
361- * match 'd-feet' etc. */
362- s = s.delimit ("-", ' ');
363-
364- if (options == null || !options.filtering)
365- return "type:Application AND " + s;
366- else
367- return "type:Application AND %s AND %s".printf (extract_type_query (options), s);
368- }
369+ {
370+ var s = search.search_string;
371+
372+ s = s.strip ();
373+
374+ /* The Xapian query parser seems to handle hyphens in a special way,
375+ * namely that it forces the joined tokens into a phrase query
376+ * no matter if it appears as the last word in a query and we have
377+ * the PARTIAL flag set on the query parser. This makes 'd-f' not
378+ * match 'd-feet' etc. */
379+ s = s.delimit ("-", ' ');
380+
381+ if (options == null || !options.filtering)
382+ return "type:Application AND " + s;
383+ else
384+ return "type:Application AND %s AND %s".printf (extract_type_query (options), s);
385+ }
386 }
387-
388+
389 /**
390 * Find app icon in DATADIR/app-install/icons based on preview_installable_icon_file
391 * obtained from S-C data provider.
392@@ -761,68 +759,68 @@
393 {
394 string desktop_id = Path.get_basename (pkginfo.desktop_file);
395 bool installed = AppInfoManager.get_default().lookup (desktop_id) != null;
396-
397+
398 /* If the app is already installed we should be able to pull the
399 * icon from the theme */
400 if (installed)
401 return new ThemedIcon (pkginfo.icon);
402-
403+
404 /* App is not installed - we need to find the right icon in the bowels
405 * of the software center */
406 if (pkginfo.icon.has_prefix ("/"))
407- {
408- return new FileIcon (File.new_for_path (pkginfo.icon));
409- }
410+ {
411+ return new FileIcon (File.new_for_path (pkginfo.icon));
412+ }
413 else
414- {
415- Icon icon = file_icon_cache.lookup (pkginfo.icon);
416-
417- if (icon != null)
418- return icon;
419-
420- /* If the icon name contains a . it probably already have a
421- * type postfix - so test icon name directly */
422- string path;
423- if ("." in pkginfo.icon)
424- {
425- path = @"$(Config.DATADIR)/app-install/icons/$(pkginfo.icon)";
426- if (FileUtils.test (path, FileTest.EXISTS))
427- {
428- icon = new FileIcon (File.new_for_path (path));
429- file_icon_cache.insert (pkginfo.icon, icon);
430- return icon;
431- }
432- /* Try also software center cache dir */
433- path = Path.build_filename (Environment.get_user_cache_dir (),
434- "software-center",
435- "icons",
436- pkginfo.icon);
437- if (FileUtils.test (path, FileTest.EXISTS))
438- {
439- icon = new FileIcon (File.new_for_path (path));
440- file_icon_cache.insert (pkginfo.icon, icon);
441- return icon;
442- }
443- }
444-
445- /* Now try appending all the image extensions we know */
446- foreach (var ext in image_extensions)
447- {
448- path = @"$(Config.DATADIR)/app-install/icons/$(pkginfo.icon).$(ext)";
449- if (FileUtils.test (path, FileTest.EXISTS))
450- {
451- /* Got it! Cache the icon path and return the icon */
452- icon = new FileIcon (File.new_for_path (path));
453- file_icon_cache.insert (pkginfo.icon, icon);
454- return icon;
455- }
456- }
457- }
458-
459+ {
460+ Icon icon = file_icon_cache.lookup (pkginfo.icon);
461+
462+ if (icon != null)
463+ return icon;
464+
465+ /* If the icon name contains a . it probably already have a
466+ * type postfix - so test icon name directly */
467+ string path;
468+ if ("." in pkginfo.icon)
469+ {
470+ path = @"$(Config.DATADIR)/app-install/icons/$(pkginfo.icon)";
471+ if (FileUtils.test (path, FileTest.EXISTS))
472+ {
473+ icon = new FileIcon (File.new_for_path (path));
474+ file_icon_cache.insert (pkginfo.icon, icon);
475+ return icon;
476+ }
477+ /* Try also software center cache dir */
478+ path = Path.build_filename (Environment.get_user_cache_dir (),
479+ "software-center",
480+ "icons",
481+ pkginfo.icon);
482+ if (FileUtils.test (path, FileTest.EXISTS))
483+ {
484+ icon = new FileIcon (File.new_for_path (path));
485+ file_icon_cache.insert (pkginfo.icon, icon);
486+ return icon;
487+ }
488+ }
489+
490+ /* Now try appending all the image extensions we know */
491+ foreach (var ext in image_extensions)
492+ {
493+ path = @"$(Config.DATADIR)/app-install/icons/$(pkginfo.icon).$(ext)";
494+ if (FileUtils.test (path, FileTest.EXISTS))
495+ {
496+ /* Got it! Cache the icon path and return the icon */
497+ icon = new FileIcon (File.new_for_path (path));
498+ file_icon_cache.insert (pkginfo.icon, icon);
499+ return icon;
500+ }
501+ }
502+ }
503+
504 /* Cache the fact that we couldn't find this icon */
505 var icon = new ThemedIcon ("applications-other");
506 file_icon_cache.insert (pkginfo.icon, icon);
507-
508+
509 return icon;
510 }
511
512@@ -879,7 +877,7 @@
513 return rel_b - rel_a; // we want higher relevancy first
514 });
515 }
516-
517+
518 private void add_pkg_search_result (Unity.Package.SearchResult results,
519 Set<string> installed_uris,
520 Set<string> available_uris,
521@@ -893,23 +891,23 @@
522
523 foreach (var pkginfo in results.results)
524 {
525- if (pkginfo.desktop_file == null)
526+ if (pkginfo.desktop_file == null)
527 continue;
528-
529+
530 string desktop_id = extract_desktop_id (pkginfo.desktop_file,
531- category == Category.AVAILABLE);
532+ category == Category.AVAILABLE);
533 string full_path;
534
535 AppInfo? app = appmanager.lookup (desktop_id);
536 full_path = appmanager.get_path (desktop_id);
537-
538+
539 /* De-dupe by 'application://foo.desktop' URI. Also note that we need
540 * to de-dupe before we chuck out NoDisplay app infos, otherwise they'd
541 * show up from alternate sources */
542 string uri = @"application://$(desktop_id)";
543 if (uri in installed_uris || uri in available_uris)
544 continue;
545-
546+
547 /* Extract basic metadata and register de-dupe keys */
548 string display_name;
549 string comment;
550@@ -929,52 +927,52 @@
551 default:
552 warning (@"Illegal category for package search $(category)");
553 continue;
554- }
555-
556+ }
557+
558 /* We can only chuck out NoDisplay and OnlyShowIn app infos after
559 * we have registered a de-dupe key for them - which is done in the
560 * switch block above) */
561 if (app != null && !app.should_show ())
562 continue;
563-
564+
565 if (category == Category.AVAILABLE)
566+ {
567+ /* If we have an available item, which is not a dupe, but is
568+ * installed anyway, we weed it out here, because it's probably
569+ * left out from the Installed section because of some rule in the
570+ * .menu file */
571+ if (app != null)
572+ continue;
573+
574+ /* Filter by app rating in Software Center if enabled */
575+ if (ratings != null && ratings_filter.rating > 0.00001)
576 {
577- /* If we have an available item, which is not a dupe, but is
578- * installed anyway, we weed it out here, because it's probably
579- * left out from the Installed section because of some rule in the
580- * .menu file */
581- if (app != null)
582+ Unity.Ratings.Result result;
583+ if (ratings.query (pkginfo.package_name, out result))
584+ {
585+ if (result.average_rating < ratings_filter.rating * 5 - 0.2)
586+ continue;
587+ }
588+ else
589 continue;
590-
591- /* Filter by app rating in Software Center if enabled */
592- if (ratings != null && ratings_filter.rating > 0.00001)
593- {
594- Unity.Ratings.Result result;
595- if (ratings.query (pkginfo.package_name, out result))
596- {
597- if (result.average_rating < ratings_filter.rating * 5 - 0.2)
598- continue;
599- }
600- else
601- continue;
602- }
603-
604- /* Apps that are not installed, ie. in the Available category
605- * use the 'unity-install://pkgname/Full App Name' URI scheme,
606- * but only use that after we've de-duped the results.
607- * But only change the URI *after* we've de-duped the results! */
608- uri = @"unity-install://$(pkginfo.package_name)/$(pkginfo.application_name)";
609- available_uris.add (uri);
610 }
611-
612+
613+ /* Apps that are not installed, ie. in the Available category
614+ * use the 'unity-install://pkgname/Full App Name' URI scheme,
615+ * but only use that after we've de-duped the results.
616+ * But only change the URI *after* we've de-duped the results! */
617+ uri = @"unity-install://$(pkginfo.package_name)/$(pkginfo.application_name)";
618+ available_uris.add (uri);
619+ }
620+
621 Icon icon = find_pkg_icon (pkginfo);
622-
623+
624 model.append (uri, icon.to_string (),
625 category,"application/x-desktop",
626 display_name != null ? display_name : "",
627 comment != null ? comment : "",
628- full_path != null ? "file://" + full_path : "");
629-
630+ full_path != null ? "file://" + full_path : "");
631+
632 /* Stop if we added the number of items requested */
633 n_added++;
634 if (max_add > 0 && n_added >= max_add)
635@@ -1089,7 +1087,7 @@
636 }
637
638 var pkginfo = pkgsearcher.get_by_desktop_file (desktopfile);
639-
640+
641 if (pkginfo != null && pkginfo.package_name != null)
642 {
643 try
644@@ -1132,7 +1130,7 @@
645 public Unity.Preview preview (string uri)
646 {
647 Unity.ApplicationPreview? preview = null;
648-
649+
650 string pkgname = "";
651 string appname = "";
652
653@@ -1166,7 +1164,7 @@
654 appname = parts[1];
655 }
656 }
657-
658+
659 if (pkgname != "")
660 {
661 try {
662@@ -1259,7 +1257,7 @@
663 uninstall_action.activated.connect (app_preview_uninstall);
664 preview.add_action (uninstall_action);
665 }
666-
667+
668 preview_installable_desktop_file = sc_data_provider.desktop_file;
669 preview_installable_icon_file = sc_data_provider.icon;
670 }
671@@ -1300,79 +1298,79 @@
672 string[] args;
673 string exec_or_dir = null;
674 if (uri.has_prefix ("unity-install://"))
675- {
676- unowned string pkg = uri.offset (16); // strip off "unity-install://" prefix
677- debug ("Installing: %s", pkg);
678- args = new string[2];
679- args[0] = "software-center";
680- args[1] = pkg;
681- }
682+ {
683+ unowned string pkg = uri.offset (16); // strip off "unity-install://" prefix
684+ debug ("Installing: %s", pkg);
685+ args = new string[2];
686+ args[0] = "software-center";
687+ args[1] = pkg;
688+ }
689 else if (uri.has_prefix ("unity-runner://"))
690- {
691- string orig;
692- orig = uri.offset (15);
693- if (orig.has_prefix("\\\\"))
694- orig = orig.replace ("\\\\","smb://");
695- if (uri_regex != null && uri_regex.match (orig)) {
696- try {
697- /* this code ensures that a file manager will be used
698- * if uri it's a remote location that should be mounted */
699- if (mountable_regex.match (orig)) {
700- var muris = new GLib.List<string>();
701- muris.prepend (orig);
702- var file_manager = AppInfo.get_default_for_type("inode/directory", true);
703- file_manager.launch_uris(muris,null);
704- } else {
705+ {
706+ string orig;
707+ orig = uri.offset (15);
708+ if (orig.has_prefix("\\\\"))
709+ orig = orig.replace ("\\\\","smb://");
710+ if (uri_regex != null && uri_regex.match (orig)) {
711+ try {
712+ /* this code ensures that a file manager will be used
713+ * if uri it's a remote location that should be mounted */
714+ if (mountable_regex.match (orig)) {
715+ var muris = new GLib.List<string>();
716+ muris.prepend (orig);
717+ var file_manager = AppInfo.get_default_for_type("inode/directory", true);
718+ file_manager.launch_uris(muris,null);
719+ } else {
720 AppInfo.launch_default_for_uri (orig, null);
721- }
722- } catch (GLib.Error error) {
723- warning ("Failed to launch URI %s", orig);
724- return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
725 }
726- return new Unity.ActivationResponse(Unity.HandledType.HIDE_DASH);
727-
728- } else {
729- exec_or_dir = Utils.subst_tilde (orig);
730- args = exec_or_dir.split (" ", 0);
731- for (int i = 0; i < args.length; i++)
732- args[i] = Utils.subst_tilde (args[i]);
733+ } catch (GLib.Error error) {
734+ warning ("Failed to launch URI %s", orig);
735+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
736 }
737- this.runner.add_history (orig);
738+ return new Unity.ActivationResponse(Unity.HandledType.HIDE_DASH);
739+
740+ } else {
741+ exec_or_dir = Utils.subst_tilde (orig);
742+ args = exec_or_dir.split (" ", 0);
743+ for (int i = 0; i < args.length; i++)
744+ args[i] = Utils.subst_tilde (args[i]);
745 }
746+ this.runner.add_history (orig);
747+ }
748 else
749- {
750- /* Activation of standard application:// uris */
751-
752- /* Make sure fresh install learns quickly */
753- if (popularity_map.size <= 5) popularities_dirty = true;
754-
755- return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
756- }
757+ {
758+ /* Activation of standard application:// uris */
759+
760+ /* Make sure fresh install learns quickly */
761+ if (popularity_map.size <= 5) popularities_dirty = true;
762+
763+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
764+ }
765
766 if ((exec_or_dir != null) && FileUtils.test (exec_or_dir, FileTest.IS_DIR))
767 {
768 try {
769- AppInfo.launch_default_for_uri ("file://" + exec_or_dir, null);
770+ AppInfo.launch_default_for_uri ("file://" + exec_or_dir, null);
771 } catch (GLib.Error err) {
772- warning ("Failed to open current folder '%s' in file manager: %s",
773- exec_or_dir, err.message);
774- return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
775+ warning ("Failed to open current folder '%s' in file manager: %s",
776+ exec_or_dir, err.message);
777+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
778 }
779 }
780 else
781 {
782- try {
783- unowned string home_dir = GLib.Environment.get_home_dir ();
784- Process.spawn_async (home_dir, args, null, SpawnFlags.SEARCH_PATH, null, null);
785- } catch (SpawnError e) {
786- warning ("Failed to spawn software-center or direct URI activation '%s': %s",
787- uri, e.message);
788- return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
789- }
790+ try {
791+ unowned string home_dir = GLib.Environment.get_home_dir ();
792+ Process.spawn_async (home_dir, args, null, SpawnFlags.SEARCH_PATH, null, null);
793+ } catch (SpawnError e) {
794+ warning ("Failed to spawn software-center or direct URI activation '%s': %s",
795+ uri, e.message);
796+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
797+ }
798 }
799
800 return new Unity.ActivationResponse(Unity.HandledType.HIDE_DASH);
801-
802+
803 }
804
805 /* Appends the subject URIs from a set of Zeitgeist.Events to our Dee.Model
806@@ -1390,7 +1388,7 @@
807 string? app_uri = null;
808 if (ev.num_subjects () > 0)
809 app_uri = ev.get_subject (0).get_uri ();
810-
811+
812 if (app_uri == null)
813 {
814 warning ("Unexpected event without subject");
815@@ -1399,7 +1397,7 @@
816
817 /* Assert that we indeed have a known application as actor */
818 string desktop_id = Utils.get_desktop_id_for_actor (app_uri);
819-
820+
821 /* Discard Recently Used apps that are in the launcher */
822 if ((category_id == Category.RECENT ||
823 category_id == Category.RECENT_APPS) &&
824@@ -1413,7 +1411,7 @@
825
826 if (app == null)
827 continue;
828-
829+
830 if (!app.should_show ())
831 continue;
832
833@@ -1437,7 +1435,7 @@
834 app.get_description (), full_uri);
835 }
836 }
837-
838+
839 } /* END: class Daemon */
840
841 } /* namespace */
842
843=== modified file 'src/unity-package-search.cc'
844--- src/unity-package-search.cc 2012-07-26 14:07:49 +0000
845+++ src/unity-package-search.cc 2012-08-21 12:26:20 +0000
846@@ -1,6 +1,6 @@
847 /*
848 * Copyright (C) 2010 Canonical Ltd
849- *
850+ *
851 * This program is free software: you can redistribute it and/or modify
852 * it under the terms of the GNU General Public License version 3 as
853 * published by the Free Software Foundation.
854@@ -58,7 +58,7 @@
855
856 extern "C"
857 {
858-extern gchar* unity_applications_lens_utils_preprocess_string (const gchar* input);
859+ extern gchar* unity_applications_lens_utils_preprocess_string (const gchar* input);
860 }
861
862 struct _UnityPackageSearcher
863@@ -74,7 +74,7 @@
864 class LocaleKeyMaker : public Xapian::KeyMaker
865 {
866 private:
867- Xapian::valueno value;
868+ Xapian::valueno value;
869
870 public:
871
872@@ -102,7 +102,7 @@
873 // Activate Xapian CJK support
874 setenv("XAPIAN_CJK_NGRAM", "1", 1);
875
876- Xapian::Database db = *searcher->db;
877+ Xapian::Database db = *searcher->db;
878
879 // Start an enquire session
880 Xapian::Enquire *enquire = new Xapian::Enquire (db);
881@@ -113,18 +113,18 @@
882 searcher->sorter = new LocaleKeyMaker (XAPIAN_VALUE_APPNAME);
883 enquire->set_sort_by_key (searcher->sorter, FALSE);
884
885- // Create query parser
886- Xapian::QueryParser *query_parser = new Xapian::QueryParser ();
887- query_parser->add_prefix ("section", "AE");
888- query_parser->add_prefix ("type", "AT");
889- query_parser->add_prefix ("category", "AC");
890- query_parser->add_prefix ("name", "AA");
891- query_parser->add_prefix ("pkgname", "AP");
892- query_parser->add_prefix ("exec", "XX");
893- query_parser->add_prefix ("keyword", "KW");
894- query_parser->set_default_op (Xapian::Query::OP_AND);
895- query_parser->set_database (db);
896- searcher->query_parser = query_parser;
897+ // Create query parser
898+ Xapian::QueryParser *query_parser = new Xapian::QueryParser ();
899+ query_parser->add_prefix ("section", "AE");
900+ query_parser->add_prefix ("type", "AT");
901+ query_parser->add_prefix ("category", "AC");
902+ query_parser->add_prefix ("name", "AA");
903+ query_parser->add_prefix ("pkgname", "AP");
904+ query_parser->add_prefix ("exec", "XX");
905+ query_parser->add_prefix ("keyword", "KW");
906+ query_parser->set_default_op (Xapian::Query::OP_AND);
907+ query_parser->set_database (db);
908+ searcher->query_parser = query_parser;
909
910 // Init random number generator from 32 lowest bits of system time
911 searcher->random = g_rand_new_with_seed (g_get_monotonic_time ());
912@@ -144,111 +144,105 @@
913 gchar *dum1, *dum2, *dum3;
914 gint i, len;
915
916- g_return_if_fail (db != NULL);
917- g_return_if_fail (indexer != NULL);
918- g_return_if_fail (item != NULL);
919-
920- switch (gmenu_tree_item_get_type (item))
921- {
922- case GMENU_TREE_ITEM_INVALID:
923- return;
924- case GMENU_TREE_ITEM_DIRECTORY:
925- /* Recurse into directory */
926- iter = gmenu_tree_directory_get_contents (GMENU_TREE_DIRECTORY (item));
927- for (; iter != NULL; iter = iter->next)
928- {
929- index_menu_item (db, indexer, GMENU_TREE_ITEM (iter->data));
930- }
931- break;
932- case GMENU_TREE_ITEM_ENTRY:
933- /* Add this entry to the index */
934- entry = GMENU_TREE_ENTRY (item);
935-
936- /* Store relevant values */
937- if (gmenu_tree_entry_get_display_name (entry))
938- doc.add_value (XAPIAN_VALUE_APPNAME,
939- gmenu_tree_entry_get_display_name (entry));
940- if (gmenu_tree_entry_get_icon (entry))
941- doc.add_value (XAPIAN_VALUE_ICON,
942- gmenu_tree_entry_get_icon (entry));
943+ g_return_if_fail (db != NULL);
944+ g_return_if_fail (indexer != NULL);
945+ g_return_if_fail (item != NULL);
946+
947+ switch (gmenu_tree_item_get_type (item))
948+ {
949+ case GMENU_TREE_ITEM_INVALID:
950+ return;
951+ case GMENU_TREE_ITEM_DIRECTORY:
952+ /* Recurse into directory */
953+ iter = gmenu_tree_directory_get_contents (GMENU_TREE_DIRECTORY (item));
954+ for (; iter != NULL; iter = iter->next)
955+ {
956+ index_menu_item (db, indexer, GMENU_TREE_ITEM (iter->data));
957+ }
958+ break;
959+ case GMENU_TREE_ITEM_ENTRY:
960+ /* Add this entry to the index */
961+ entry = GMENU_TREE_ENTRY (item);
962+
963+ /* Store relevant values */
964+ if (gmenu_tree_entry_get_display_name (entry))
965+ doc.add_value (XAPIAN_VALUE_APPNAME, gmenu_tree_entry_get_display_name (entry));
966+ if (gmenu_tree_entry_get_icon (entry))
967+ doc.add_value (XAPIAN_VALUE_ICON, gmenu_tree_entry_get_icon (entry));
968 if (gmenu_tree_entry_get_desktop_file_id (entry))
969- doc.add_value (XAPIAN_VALUE_DESKTOP_FILE,
970- gmenu_tree_entry_get_desktop_file_id (entry));
971-
972- /* Index full text data */
973- indexer->set_document(doc);
974+ doc.add_value (XAPIAN_VALUE_DESKTOP_FILE, gmenu_tree_entry_get_desktop_file_id (entry));
975+
976+ /* Index full text data */
977+ indexer->set_document(doc);
978 if (gmenu_tree_entry_get_display_name (entry))
979 {
980- dum1 = unity_applications_lens_utils_preprocess_string (
981- gmenu_tree_entry_get_display_name (entry));
982+ dum1 = unity_applications_lens_utils_preprocess_string (gmenu_tree_entry_get_display_name (entry));
983 indexer->index_text(dum1, 5);
984 g_free (dum1);
985 }
986 if (gmenu_tree_entry_get_name (entry))
987 {
988- dum1 = unity_applications_lens_utils_preprocess_string (
989- gmenu_tree_entry_get_name (entry));
990+ dum1 = unity_applications_lens_utils_preprocess_string (gmenu_tree_entry_get_name (entry));
991 indexer->index_text(dum1, 5);
992 g_free (dum1);
993 }
994 if (gmenu_tree_entry_get_comment (entry))
995 {
996- dum1 = unity_applications_lens_utils_preprocess_string (
997- gmenu_tree_entry_get_comment (entry));
998- indexer->index_text (dum1, 0);
999- g_free (dum1);
1000- }
1001-
1002- /* Index the XDG categories */
1003- appman = unity_app_info_manager_get_default ();
1004- cats = unity_app_info_manager_get_categories (appman, // const return
1005- gmenu_tree_entry_get_desktop_file_id (entry),
1006- &len);
1007-
1008- /* Note: Wine apps and app launchers created with Alacarte commonly
1009- * don't have any category metadata, so they'll only show up under
1010- * All Applications */
1011- for (i = 0; i < len; i++)
1012- {
1013- dum1 = g_ascii_strdown (cats[i], -1);
1014- dum2 = g_strconcat ("AC", dum1, NULL);
1015- doc.add_term (dum2);
1016- g_free (dum1);
1017- g_free (dum2);
1018- }
1019-
1020- /* Index Keywords*/
1021- keywords = unity_app_info_manager_get_keywords (appman, // const return
1022- gmenu_tree_entry_get_desktop_file_id (entry),
1023- &len);
1024- for (i = 0; i < len; i++)
1025- {
1026- dum1 = unity_applications_lens_utils_preprocess_string (keywords[i]);
1027- indexer->index_text (dum1, 0);
1028- indexer->index_text (dum1, 0, "KW");
1029- g_free (dum1);
1030- }
1031-
1032-
1033- g_object_unref (appman);
1034-
1035- /* Always assume Type=Application for items in a menu... */
1036- doc.add_term ("ATapplication");
1037-
1038- /* Index application names */
1039- dum1 = (gchar *) gmenu_tree_entry_get_display_name (entry); // const
1040- dum2 = g_strconcat ("AA", dum1, NULL);
1041+ dum1 = unity_applications_lens_utils_preprocess_string (gmenu_tree_entry_get_comment (entry));
1042+ indexer->index_text (dum1, 0);
1043+ g_free (dum1);
1044+ }
1045+
1046+ /* Index the XDG categories */
1047+ appman = unity_app_info_manager_get_default ();
1048+ cats = unity_app_info_manager_get_categories (appman, // const return
1049+ gmenu_tree_entry_get_desktop_file_id (entry),
1050+ &len);
1051+
1052+ /* Note: Wine apps and app launchers created with Alacarte commonly
1053+ * don't have any category metadata, so they'll only show up under
1054+ * All Applications */
1055+ for (i = 0; i < len; i++)
1056+ {
1057+ dum1 = g_ascii_strdown (cats[i], -1);
1058+ dum2 = g_strconcat ("AC", dum1, NULL);
1059+ doc.add_term (dum2);
1060+ g_free (dum1);
1061+ g_free (dum2);
1062+ }
1063+
1064+ /* Index Keywords*/
1065+ keywords = unity_app_info_manager_get_keywords (appman, // const return
1066+ gmenu_tree_entry_get_desktop_file_id (entry),
1067+ &len);
1068+ for (i = 0; i < len; i++)
1069+ {
1070+ dum1 = unity_applications_lens_utils_preprocess_string (keywords[i]);
1071+ indexer->index_text (dum1, 0);
1072+ indexer->index_text (dum1, 0, "KW");
1073+ g_free (dum1);
1074+ }
1075+
1076+ g_object_unref (appman);
1077+
1078+ /* Always assume Type=Application for items in a menu... */
1079+ doc.add_term ("ATapplication");
1080+
1081+ /* Index application names */
1082+ dum1 = (gchar *) gmenu_tree_entry_get_display_name (entry); // const
1083+ dum2 = g_strconcat ("AA", dum1, NULL);
1084 doc.add_term (dum2);
1085 g_free (dum2);
1086
1087 dum1 = (gchar *) gmenu_tree_entry_get_name (entry); // const
1088- dum2 = g_strconcat ("AA", dum1, NULL);
1089+ dum2 = g_strconcat ("AA", dum1, NULL);
1090 doc.add_term (dum2);
1091 g_free (dum2);
1092
1093 /* Index executable name, change - in _ for exec */
1094 dum1 = g_strdup (gmenu_tree_entry_get_exec (entry)); // alloc
1095- if (dum1) {
1096+ if (dum1)
1097+ {
1098 dum2 = strstr (dum1, " "); // const
1099 dum2 == NULL ? : *dum2 = '\0'; // const
1100 dum2 = g_path_get_basename (dum1); // alloc
1101@@ -265,19 +259,17 @@
1102 }
1103
1104 db->add_document(doc);
1105- break;
1106- case GMENU_TREE_ITEM_SEPARATOR:
1107- case GMENU_TREE_ITEM_HEADER:
1108- case GMENU_TREE_ITEM_ALIAS:
1109- break;
1110- default:
1111- g_warning ("Unexpected GMenuTreeItemType %u",
1112- gmenu_tree_item_get_type (item));
1113- return;
1114+ break;
1115+ case GMENU_TREE_ITEM_SEPARATOR:
1116+ case GMENU_TREE_ITEM_HEADER:
1117+ case GMENU_TREE_ITEM_ALIAS:
1118+ break;
1119+ default:
1120+ g_warning ("Unexpected GMenuTreeItemType %u", gmenu_tree_item_get_type (item));
1121+ return;
1122 }
1123
1124 // Add the document to the database.
1125-
1126 }
1127
1128 /* Create a searcher that searches in a menu tree. The menu tree
1129@@ -316,26 +308,32 @@
1130 searcher = g_new0 (UnityPackageSearcher, 1);
1131
1132 // Xapian initialization
1133- try {
1134+ try
1135+ {
1136 searcher->db = new Xapian::Database (SOFTWARE_CENTER_INDEX);
1137- } catch(const Xapian::Error &error) {
1138+ }
1139+ catch(const Xapian::Error &error)
1140+ {
1141 cerr << "Error loading package indexes: " << error.get_msg() << endl;
1142 return NULL;
1143 }
1144
1145 // add software-center-agent.db
1146- try {
1147+ try
1148+ {
1149 agent = g_strdup_printf("%s/software-center/software-center-agent.db",
1150 g_get_user_cache_dir());
1151 if (g_file_test(agent, G_FILE_TEST_IS_DIR))
1152- searcher->db->add_database (Xapian::Database (agent));
1153+ searcher->db->add_database (Xapian::Database (agent));
1154 g_free(agent);
1155- } catch(const Xapian::Error &error) {
1156+ }
1157+ catch(const Xapian::Error &error)
1158+ {
1159 cerr << "Error loading agent indexes: " << error.get_msg() << endl;
1160 }
1161
1162 init_searcher (searcher);
1163-
1164+
1165 return searcher;
1166 }
1167
1168@@ -447,29 +445,25 @@
1169 searcher->enquire->set_collapse_key(XAPIAN_VALUE_DESKTOP_FILE);
1170 max_hits = (max_hits != 0 ? max_hits : searcher->db->get_doccount ());
1171 searcher->enquire->set_query(query);
1172- Xapian::MSet matches =
1173- searcher->enquire->get_mset(0, max_hits);
1174+ Xapian::MSet matches = searcher->enquire->get_mset(0, max_hits);
1175
1176 // Retrieve the results, note that we build the result->results
1177 // list in reverse order and then reverse it before we return it
1178 result->num_hits = matches.get_matches_estimated ();
1179- for (Xapian::MSetIterator i = matches.begin();
1180- i != matches.end();
1181- ++i)
1182- {
1183- try
1184- {
1185- Xapian::Document doc = i.get_document();
1186- UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1187- pkginfo->relevancy = i.get_percent ();
1188- result->results = g_slist_prepend (result->results, pkginfo);
1189- }
1190- catch (Xapian::Error e)
1191- {
1192- g_warning ("Unable to read document from result set: %s",
1193- e.get_msg().c_str());
1194- }
1195- }
1196+ for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
1197+ {
1198+ try
1199+ {
1200+ Xapian::Document doc = i.get_document();
1201+ UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1202+ pkginfo->relevancy = i.get_percent ();
1203+ result->results = g_slist_prepend (result->results, pkginfo);
1204+ }
1205+ catch (Xapian::Error e)
1206+ {
1207+ g_warning ("Unable to read document from result set: %s", e.get_msg().c_str());
1208+ }
1209+ }
1210
1211 result->results = g_slist_reverse (result->results);
1212 }
1213@@ -503,69 +497,68 @@
1214 * requested apps in order to try and avoid dupes. This is a sloppy
1215 * check, but works well enough in practice */
1216 if (filter_query == NULL)
1217+ {
1218+ g_debug ("RANDOM");
1219+ for (i = 0, n_unique = 0; i < n_apps*2, n_unique < n_apps; i++)
1220 {
1221- g_debug ("RANDOM");
1222- for (i = 0, n_unique = 0; i < n_apps*2, n_unique < n_apps; i++)
1223- {
1224- Xapian::Document doc;
1225- try
1226- {
1227- doc = searcher->db->get_document (
1228- g_rand_int_range (searcher->random, 1, lastdocid));
1229- UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1230- if (g_hash_table_lookup_extended (unique, pkginfo->package_name, NULL, NULL))
1231- {
1232- _free_package_info (pkginfo);
1233- }
1234- else
1235- {
1236- g_hash_table_insert (unique, pkginfo->package_name, NULL);
1237- result->results = g_slist_prepend (result->results, pkginfo);
1238- n_unique++;
1239- }
1240- }
1241- catch (Xapian::Error e)
1242- {
1243- g_warning ("Error getting random apps: %s", e.get_msg().c_str());
1244- continue;
1245- }
1246- }
1247+ Xapian::Document doc;
1248+ try
1249+ {
1250+ doc = searcher->db->get_document (
1251+ g_rand_int_range (searcher->random, 1, lastdocid));
1252+ UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1253+ if (g_hash_table_lookup_extended (unique, pkginfo->package_name, NULL, NULL))
1254+ {
1255+ _free_package_info (pkginfo);
1256+ }
1257+ else
1258+ {
1259+ g_hash_table_insert (unique, pkginfo->package_name, NULL);
1260+ result->results = g_slist_prepend (result->results, pkginfo);
1261+ n_unique++;
1262+ }
1263+ }
1264+ catch (Xapian::Error e)
1265+ {
1266+ g_warning ("Error getting random apps: %s", e.get_msg().c_str());
1267+ continue;
1268+ }
1269 }
1270+ }
1271 else
1272- {
1273- g_debug ("FILTER %s", filter_query);
1274- Xapian::Query query;
1275- try
1276- {
1277- query = searcher->query_parser->parse_query (filter_query, QUERY_PARSER_FILTER_FLAGS);
1278- searcher->enquire->set_sort_by_relevance ();
1279- searcher->enquire->set_query(query);
1280- Xapian::MSet matches = searcher->enquire->get_mset(0, searcher->db->get_doccount ());
1281- for (i = 0, n_unique = 0; i < n_apps*4, n_unique < n_apps; i++)
1282- {
1283- docid = g_rand_int_range (searcher->random, 0, matches.size ());
1284- Xapian::MSetIterator iter = matches[docid];
1285- Xapian::Document doc = iter.get_document ();
1286- UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1287- if (g_hash_table_lookup_extended (unique, pkginfo->package_name, NULL, NULL))
1288- {
1289- _free_package_info (pkginfo);
1290- }
1291- else
1292- {
1293- g_hash_table_insert (unique, pkginfo->package_name, NULL);
1294- result->results = g_slist_prepend (result->results, pkginfo);
1295- n_unique++;
1296- }
1297- }
1298- }
1299- catch (Xapian::Error e)
1300- {
1301- g_debug ("Error getting random apps for query '%s': %s",
1302- filter_query, e.get_msg().c_str());
1303- return g_slice_new0 (UnityPackageSearchResult);
1304- }
1305- }
1306+ {
1307+ g_debug ("FILTER %s", filter_query);
1308+ Xapian::Query query;
1309+ try
1310+ {
1311+ query = searcher->query_parser->parse_query (filter_query, QUERY_PARSER_FILTER_FLAGS);
1312+ searcher->enquire->set_sort_by_relevance ();
1313+ searcher->enquire->set_query(query);
1314+ Xapian::MSet matches = searcher->enquire->get_mset(0, searcher->db->get_doccount ());
1315+ for (i = 0, n_unique = 0; i < n_apps*4, n_unique < n_apps; i++)
1316+ {
1317+ docid = g_rand_int_range (searcher->random, 0, matches.size ());
1318+ Xapian::MSetIterator iter = matches[docid];
1319+ Xapian::Document doc = iter.get_document ();
1320+ UnityPackageInfo *pkginfo = _pkginfo_from_document (doc);
1321+ if (g_hash_table_lookup_extended (unique, pkginfo->package_name, NULL, NULL))
1322+ {
1323+ _free_package_info (pkginfo);
1324+ }
1325+ else
1326+ {
1327+ g_hash_table_insert (unique, pkginfo->package_name, NULL);
1328+ result->results = g_slist_prepend (result->results, pkginfo);
1329+ n_unique++;
1330+ }
1331+ }
1332+ }
1333+ catch (Xapian::Error e)
1334+ {
1335+ g_debug ("Error getting random apps for query '%s': %s", filter_query, e.get_msg().c_str());
1336+ return g_slice_new0 (UnityPackageSearchResult);
1337+ }
1338+ }
1339
1340 g_hash_table_unref (unique);
1341

Subscribers

People subscribed via source and target branches