[PATCH] Launch file search tool from Nautilus Windows.



This patch against CVS HEAD adds a convenient Edit/Search for Files menu
entry to both Spatial and Browser windows, and would fix
http://bugs.gnome.org/show_bug.cgi?id=96014
? depcomp
? stamp-h1
? libnautilus-private/nautilus-directory-background.loT
Index: src/nautilus-shell-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-shell-ui.xml,v
retrieving revision 1.117
diff -u -r1.117 nautilus-shell-ui.xml
--- src/nautilus-shell-ui.xml	22 Nov 2004 15:24:37 -0000	1.117
+++ src/nautilus-shell-ui.xml	22 Apr 2005 16:30:45 -0000
@@ -23,6 +23,8 @@
 		<separator/>
 		<placeholder name="Select Items"/>
 		<separator/>
+		<placeholder name="Search Actions"/>
+		<separator/>
 		<placeholder name="File Items Placeholder"/>
 		<separator/>
 		<placeholder name="Dangerous File Items Placeholder"/>
Index: src/file-manager/fm-actions.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-actions.h,v
retrieving revision 1.5
diff -u -r1.5 fm-actions.h
--- src/file-manager/fm-actions.h	12 Mar 2005 11:18:32 -0000	1.5
+++ src/file-manager/fm-actions.h	22 Apr 2005 16:30:45 -0000
@@ -44,6 +44,7 @@
 #define FM_ACTION_CREATE_LINK "Create Link"
 #define FM_ACTION_SELECT_ALL "Select All"
 #define FM_ACTION_SELECT_PATTERN "Select Pattern"
+#define FM_ACTION_SEARCH_FOR_FILES "Search for Files"
 #define FM_ACTION_TRASH "Trash"
 #define FM_ACTION_DELETE "Delete"
 #define FM_ACTION_SHOW_HIDDEN_FILES "Show Hidden Files"
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.668
diff -u -r1.668 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	11 Apr 2005 21:42:03 -0000	1.668
+++ src/file-manager/fm-directory-view.c	22 Apr 2005 16:30:54 -0000
@@ -1026,6 +1026,41 @@
 }
 
 static void
+run_search_tool (FMDirectoryView *view)
+{
+	char *uri;
+	char *search_parameter;
+	
+	
+	uri = fm_directory_view_get_backing_uri (view);
+
+	if (eel_str_has_prefix (uri, "file:")) {
+		char *folder = gnome_vfs_get_local_path_from_uri (uri);
+		search_parameter = g_strconcat("--path=", folder, NULL);
+		g_free (folder);
+	} else {
+		search_parameter = g_strdup ("");
+	}
+
+	nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (view)),
+						"gnome-search-tool",
+						"gnome-search-tool",
+						search_parameter,
+						FALSE);
+	g_free (uri);
+	g_free (search_parameter);					
+}
+
+static void
+action_search_for_files_callback (GtkAction *action,
+				gpointer callback_data)
+{
+	g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
+
+	run_search_tool (callback_data);	
+}
+
+static void
 action_reset_to_defaults_callback (GtkAction *action, 
 				   gpointer callback_data)
 {
@@ -5811,6 +5846,10 @@
     N_("Select _Pattern"), "<control>S",                /* label, accelerator */
     N_("Select items in this window matching a given pattern"),                   /* tooltip */ 
     G_CALLBACK (action_select_pattern_callback) },
+  { "Search for Files",  "gnome-searchtool",			/*name, stock id */
+    N_("_Search for Files"), "<control>F",				/* label, accelerator */
+    N_("Find files, folders, and documents on your computer"),			/* tooltip */
+    G_CALLBACK (action_search_for_files_callback) },
   { "Duplicate", NULL,                  /* name, stock id */
     N_("D_uplicate"), NULL,                /* label, accelerator */
     N_("Duplicate each selected item"),                   /* tooltip */ 
@@ -6177,6 +6216,7 @@
 	gboolean vfolder_directory;
 	gboolean show_open_alternate;
 	gboolean can_open;
+	gboolean show_search;
 	ActivationAction activation_action;
 	GtkAction *action;
 
@@ -6198,6 +6238,8 @@
 	
 	vfolder_directory = we_are_in_vfolder_desktop_dir (view);
 
+	show_search = eel_str_has_prefix (fm_directory_view_get_backing_uri (view) , "file:");
+	
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_RENAME);
 	gtk_action_set_sensitive (action,
@@ -6351,6 +6393,11 @@
 	gtk_action_set_sensitive (action, !fm_directory_view_is_empty (view));
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
+						FM_ACTION_SEARCH_FOR_FILES);
+	gtk_action_set_sensitive (action, !fm_directory_view_is_empty (view));
+	gtk_action_set_visible (action, show_search);
+	
+	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      FM_ACTION_CUT);
 	g_object_set (action, "label",
 		      selection_count == 1
Index: src/file-manager/nautilus-directory-view-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/nautilus-directory-view-ui.xml,v
retrieving revision 1.72
diff -u -r1.72 nautilus-directory-view-ui.xml
--- src/file-manager/nautilus-directory-view-ui.xml	23 Jan 2005 19:03:56 -0000	1.72
+++ src/file-manager/nautilus-directory-view-ui.xml	22 Apr 2005 16:30:54 -0000
@@ -50,6 +50,9 @@
 		<menuitem name="Select All" action="Select All"/>
 		<menuitem name="Select Pattern" action="Select Pattern"/>
 		</placeholder>
+		<placeholder name="Search Actions">
+			<menuitem name="Search for Files" action = "Search for Files"/>
+		</placeholder>		
 		<placeholder name="File Items Placeholder">
 			<menuitem name="Duplicate" action="Duplicate"/>
 			<menuitem name="Create Link" action="Create Link"/>

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]