comparison src/view_file_icon.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 cc46a09d0805
comparison
equal deleted inserted replaced
496:a1f13fab6686 497:a33badd85f16
240 ViewFileIcon *vfi = data; 240 ViewFileIcon *vfi = data;
241 241
242 file_util_delete(NULL, vficon_pop_menu_file_list(vfi), vfi->listview); 242 file_util_delete(NULL, vficon_pop_menu_file_list(vfi), vfi->listview);
243 } 243 }
244 244
245 static void vficon_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data)
246 {
247 ViewFileIcon *vfi = data;
248
249 file_util_copy_path_list_to_clipboard(vficon_pop_menu_file_list(vfi));
250 }
251
245 static void vficon_pop_menu_sort_cb(GtkWidget *widget, gpointer data) 252 static void vficon_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
246 { 253 {
247 ViewFileIcon *vfi; 254 ViewFileIcon *vfi;
248 SortType type; 255 SortType type;
249 256
334 gtk_widget_set_sensitive(item, active); 341 gtk_widget_set_sensitive(item, active);
335 item = menu_item_add(menu, _("_Rename..."), G_CALLBACK(vficon_pop_menu_rename_cb), vfi); 342 item = menu_item_add(menu, _("_Rename..."), G_CALLBACK(vficon_pop_menu_rename_cb), vfi);
336 gtk_widget_set_sensitive(item, active); 343 gtk_widget_set_sensitive(item, active);
337 item = menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(vficon_pop_menu_delete_cb), vfi); 344 item = menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(vficon_pop_menu_delete_cb), vfi);
338 gtk_widget_set_sensitive(item, active); 345 gtk_widget_set_sensitive(item, active);
346 if (options->show_copy_path)
347 {
348 item = menu_item_add(menu, _("_Copy path"), G_CALLBACK(vficon_pop_menu_copy_path_cb), vfi);
349 gtk_widget_set_sensitive(item, active);
350 }
339 351
340 menu_item_add_divider(menu); 352 menu_item_add_divider(menu);
341 353
342 submenu = submenu_add_sort(NULL, G_CALLBACK(vficon_pop_menu_sort_cb), vfi, 354 submenu = submenu_add_sort(NULL, G_CALLBACK(vficon_pop_menu_sort_cb), vfi,
343 FALSE, FALSE, TRUE, vfi->sort_method); 355 FALSE, FALSE, TRUE, vfi->sort_method);