Skip to content

Commit

Permalink
Allow to copy the path of a directory to clipboard from directory views.
Browse files Browse the repository at this point in the history
Show Copy path option has to be enabled.
Suggested by Frédéric Mantegazza.
  • Loading branch information
Laurent Monin committed Apr 24, 2008
1 parent 7674727 commit 856f0b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/view_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,15 @@ static void vd_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
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)
{
Expand Down Expand Up @@ -599,6 +608,10 @@ GtkWidget *vd_pop_menu(ViewDir *vd, FileData *fd)
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);
Expand Down

0 comments on commit 856f0b2

Please sign in to comment.