diff src/search.c @ 497:a33badd85f16

Allow the copy of file paths to clipboard. This feature is disabled by default, it can be set through Preferences > Advanced > Behavior > Show "Copy path" ... When enabled, it adds a menu entry "Copy path" that let the user copies current selection's paths to X clipboard. It is very convenient to paste paths to xterm for example. Patch by Carles Pina i Estany and me.
author zas_
date Wed, 23 Apr 2008 22:17:21 +0000
parents 5212d4fed37f
children 905688aa2317
line wrap: on
line diff
--- a/src/search.c	Wed Apr 23 21:08:29 2008 +0000
+++ b/src/search.c	Wed Apr 23 22:17:21 2008 +0000
@@ -946,6 +946,13 @@
 	file_util_delete(NULL, search_result_selection_list(sd), sd->window);
 }
 
+static void sr_menu_copy_path_cb(GtkWidget *widget, gpointer data)
+{
+	SearchData *sd = data;
+
+	file_util_copy_path_list_to_clipboard(search_result_selection_list(sd));
+}
+
 static void sr_menu_remove_cb(GtkWidget *widget, gpointer data)
 {
 	SearchData *sd = data;
@@ -993,6 +1000,9 @@
 				G_CALLBACK(sr_menu_rename_cb), sd);
 	menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, on_row,
 				      G_CALLBACK(sr_menu_delete_cb), sd);
+	if (options->show_copy_path)
+		menu_item_add_sensitive(menu, _("_Copy path"), on_row,
+					G_CALLBACK(sr_menu_copy_path_cb), sd);
 	menu_item_add_divider(menu);
 	menu_item_add_stock_sensitive(menu, _("Rem_ove"), GTK_STOCK_REMOVE, on_row,
 				      G_CALLBACK(sr_menu_remove_cb), sd);