diff src/img-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 67a612985686
children f9bf33be53ff
line wrap: on
line diff
--- a/src/img-view.c	Wed Apr 23 21:08:29 2008 +0000
+++ b/src/img-view.c	Wed Apr 23 22:17:21 2008 +0000
@@ -1183,6 +1183,15 @@
 	file_util_delete(image_get_fd(imd), NULL, imd->widget);
 }
 
+static void view_copy_path_cb(GtkWidget *widget, gpointer data)
+{
+	ViewWindow *vw = data;
+	ImageWindow *imd;
+
+	imd = view_window_active_image(vw);
+	file_util_copy_path_to_clipboard(image_get_fd(imd));
+}
+
 static void view_fullscreen_cb(GtkWidget *widget, gpointer data)
 {
 	ViewWindow *vw = data;
@@ -1279,6 +1288,8 @@
 	menu_item_add(menu, _("_Move..."), G_CALLBACK(view_move_cb), vw);
 	menu_item_add(menu, _("_Rename..."), G_CALLBACK(view_rename_cb), vw);
 	menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(view_delete_cb), vw);
+	if (options->show_copy_path)
+		menu_item_add(menu, _("_Copy path"), G_CALLBACK(view_copy_path_cb), vw);
 
 	menu_item_add_divider(menu);