changeset 522:fd4208f8b5f3

Allow to copy the path of a directory to clipboard from directory views. Show Copy path option has to be enabled. Suggested by Frdric Mantegazza.
author zas_
date Thu, 24 Apr 2008 20:29:09 +0000
parents 57007e49d767
children 0717bcc4f2b7
files src/view_dir.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_dir.c	Thu Apr 24 20:18:59 2008 +0000
+++ b/src/view_dir.c	Thu Apr 24 20:29:09 2008 +0000
@@ -441,6 +441,15 @@
 	file_util_delete_dir(vd->click_fd, vd->widget);
 }
 
+static void vd_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data)
+{
+	ViewDir *vd = data;
+
+	if (!vd->click_fd) return;
+
+	file_util_copy_path_to_clipboard(vd->click_fd);
+}
+
 #define VIEW_DIR_AS_SUBMENU_KEY "view_dir_as_submenu"
 static void vd_pop_submenu_dir_view_as_cb(GtkWidget *widget, gpointer data)
 {
@@ -599,6 +608,10 @@
 	menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, rename_delete_active,
 				      G_CALLBACK(vd_pop_menu_delete_cb), vd);
 
+	if (options->show_copy_path)
+		menu_item_add(menu, _("_Copy path"), 
+			      G_CALLBACK(vd_pop_menu_copy_path_cb), vd);
+
 	menu_item_add_divider(menu);
 
 	item = menu_item_add(menu, _("_View as"), NULL, NULL);