diff options
author | Joe Shaw <joeshaw@src.gnome.org> | 2005-10-31 17:59:28 +0000 |
---|---|---|
committer | Joe Shaw <joeshaw@src.gnome.org> | 2005-10-31 17:59:28 +0000 |
commit | 82c9545fb258d0e50919612717d79802e3e7d0ba (patch) | |
tree | 1b27266f5dbc5f14e940ec041391cc1384989052 | |
parent | 3a4ee101071d30e28bf2af8f9b9c5191a65a8302 (diff) | |
download | nautilus-82c9545fb258d0e50919612717d79802e3e7d0ba.tar.gz |
Add search to the Places sidebar
-rw-r--r-- | src/nautilus-bookmark-list.c | 2 | ||||
-rw-r--r-- | src/nautilus-places-sidebar.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c index 4f1c88822..608c8a319 100644 --- a/src/nautilus-bookmark-list.c +++ b/src/nautilus-bookmark-list.c @@ -568,7 +568,7 @@ nautilus_bookmark_list_save_file (NautilusBookmarkList *bookmarks) /* make sure we save label if it has one for compatibility with GTK 2.7 and 2.8 */ if (nautilus_bookmark_get_has_custom_name (bookmark)) { - char *label, *uri; + char *label; label = nautilus_bookmark_get_name (bookmark); bookmark_string = g_strconcat (uri, " ", label, NULL); g_free (label); diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c index c9d7643a1..dd12d19e2 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -28,6 +28,7 @@ #include <eel/eel-glib-extensions.h> #include <eel/eel-preferences.h> #include <eel/eel-string.h> +#include <eel/eel-vfs-extensions.h> #include <gtk/gtkalignment.h> #include <gtk/gtkbutton.h> #include <gtk/gtkvbox.h> @@ -45,11 +46,13 @@ #include <libnautilus-private/nautilus-sidebar-provider.h> #include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-file-utilities.h> +#include <libnautilus-private/nautilus-search-directory.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <libgnomevfs/gnome-vfs-volume-monitor.h> #include "nautilus-bookmark-list.h" #include "nautilus-places-sidebar.h" +#include "nautilus-window.h" #define NAUTILUS_PLACES_SIDEBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PLACES_SIDEBAR, NautilusPlacesSidebarClass)) #define NAUTILUS_IS_PLACES_SIDEBAR(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PLACES_SIDEBAR)) @@ -86,6 +89,7 @@ enum { }; typedef enum { + PLACES_SEARCH, PLACES_BUILT_IN, PLACES_MOUNTED_VOLUME, PLACES_BOOKMARK, @@ -142,6 +146,16 @@ update_places (NautilusPlacesSidebar *sidebar) gtk_list_store_clear (sidebar->store); location = nautilus_window_info_get_current_location (sidebar->window); + /* add search item */ + last_iter = add_place (sidebar->store, PLACES_SEARCH, + _("Search"), "gnome-searchtool", NULL); + /* add separator */ + + gtk_list_store_append (sidebar->store, &iter); + gtk_list_store_set (sidebar->store, &iter, + PLACES_SIDEBAR_COLUMN_ROW_TYPE, PLACES_SEPARATOR, + -1); + /* add built in bookmarks */ desktop_path = nautilus_get_desktop_directory (); @@ -272,6 +286,7 @@ row_activated_callback (GtkTreeView *tree_view, NautilusPlacesSidebar *sidebar; GtkTreeModel *model; GtkTreeIter iter; + PlaceType place_type; char *uri; sidebar = NAUTILUS_PLACES_SIDEBAR (user_data); @@ -281,6 +296,14 @@ row_activated_callback (GtkTreeView *tree_view, return; } + gtk_tree_model_get + (model, &iter, PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type, -1); + + if (place_type == PLACES_SEARCH) { + nautilus_window_set_search_mode (sidebar->window, TRUE); + return; + } + gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_URI, &uri, -1); |