[nautilus/gnome-3-6] shell-search-provider: include Home and Trash among the results
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-6] shell-search-provider: include Home and Trash among the results
- Date: Wed, 26 Sep 2012 18:00:40 +0000 (UTC)
commit 2eeac5f2267c4afaeb0406420b63934fbf70686f
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Sep 26 13:29:33 2012 -0400
shell-search-provider: include Home and Trash among the results
https://bugzilla.gnome.org/show_bug.cgi?id=684697
src/nautilus-shell-search-provider.c | 37 ++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 6d4291e..f38eedd 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -26,6 +26,7 @@
#include <gio/gio.h>
#include <string.h>
+#include <glib/gi18n.h>
#include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-file-utilities.h>
@@ -339,6 +340,42 @@ search_add_volumes_and_bookmarks (NautilusShellSearchProviderApp *self)
}
}
+ /* Home dir */
+ found = TRUE;
+ prepared = prepare_string_for_compare (_("Home"));
+
+ for (j = 0; terms[j] != NULL; j++) {
+ if (strstr (prepared, terms[j]) == NULL) {
+ found = FALSE;
+ break;
+ }
+ }
+
+ if (found) {
+ uri = nautilus_get_home_directory_uri ();
+ hit = nautilus_search_hit_new (uri);
+ nautilus_search_hit_compute_scores (hit, self->current_search->query);
+ g_hash_table_replace (self->current_search->hits, uri, hit);
+ }
+
+ /* Trash */
+ found = TRUE;
+ prepared = prepare_string_for_compare (_("Trash"));
+
+ for (j = 0; terms[j] != NULL; j++) {
+ if (strstr (prepared, terms[j]) == NULL) {
+ found = FALSE;
+ break;
+ }
+ }
+
+ if (found) {
+ uri = g_strdup ("trash:///");
+ hit = nautilus_search_hit_new (uri);
+ nautilus_search_hit_compute_scores (hit, self->current_search->query);
+ g_hash_table_replace (self->current_search->hits, uri, hit);
+ }
+
/* now match mounts */
mounts_to_check = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]