diff src/pan-view.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 c7a2471e5c4e
children fc9c8a3e1a8b
line wrap: on
line diff
--- a/src/pan-view.c	Wed Apr 23 21:08:29 2008 +0000
+++ b/src/pan-view.c	Wed Apr 23 22:17:21 2008 +0000
@@ -2737,6 +2737,15 @@
 	if (fd) file_util_delete(fd, NULL, pw->imd->widget);
 }
 
+static void pan_copy_path_cb(GtkWidget *widget, gpointer data)
+{
+	PanWindow *pw = data;
+	FileData *fd;
+
+	fd = pan_menu_click_fd(pw);
+	if (fd) file_util_copy_path_to_clipboard(fd);
+}
+
 static void pan_exif_date_toggle_cb(GtkWidget *widget, gpointer data)
 {
 	PanWindow *pw = data;
@@ -2812,6 +2821,9 @@
 				G_CALLBACK(pan_rename_cb), pw);
 	menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
 				      G_CALLBACK(pan_delete_cb), pw);
+	if (options->show_copy_path)
+		menu_item_add_sensitive(menu, _("_Copy path"), active,
+					G_CALLBACK(pan_copy_path_cb), pw);
 
 	menu_item_add_divider(menu);
 	item = menu_item_add_check(menu, _("Sort by E_xif date"), pw->exif_date_enable,