diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-09-26 13:29:33 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-09-26 13:29:33 -0400 |
commit | 41b6b28035779fbf5b74f82e6d6239cdc1b0a12a (patch) | |
tree | d73a470d71ac46f2d96c69974001130582db947e /src/nautilus-shell-search-provider.c | |
parent | 6f1e24dfe88261ea8d6d80707bab11c95c8486fb (diff) | |
download | nautilus-41b6b28035779fbf5b74f82e6d6239cdc1b0a12a.tar.gz |
shell-search-provider: include Home and Trash among the results
https://bugzilla.gnome.org/show_bug.cgi?id=684697
Diffstat (limited to 'src/nautilus-shell-search-provider.c')
-rw-r--r-- | 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 6d4291e8a..f38eeddfc 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; |