[nautilus] shell-search-provider: include Home and Trash among the results



commit 41b6b28035779fbf5b74f82e6d6239cdc1b0a12a
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]