diff -ur mc-4.5.55/gnome/cmd.c mc-4.5.55-colin/gnome/cmd.c --- mc-4.5.55/gnome/cmd.c Sun Aug 12 10:36:26 2001 +++ mc-4.5.55-colin/gnome/cmd.c Tue Apr 16 13:53:39 2002 @@ -1576,3 +1576,10 @@ } #endif /* !HAVE_X */ +char * +get_tmpdir(void) +{ + char *retval; + retval = g_strdup_printf ("/tmp/.mctmp%d", getuid()); + return retval; +} diff -ur mc-4.5.55/gnome/file.c mc-4.5.55-colin/gnome/file.c --- mc-4.5.55/gnome/file.c Tue Aug 14 02:55:38 2001 +++ mc-4.5.55-colin/gnome/file.c Tue Apr 16 13:53:39 2002 @@ -1454,6 +1454,12 @@ int erase_dir (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes) { + return erase_dir_ask (ctx, s, &progress_count, &progress_bytes, 1); +} + +int +erase_dir_ask (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes, int confirm) +{ int error; if (strcmp (s, "..") == 0) @@ -1475,7 +1481,10 @@ */ error = check_dir_is_empty (s); if (error == 0){ /* not empty */ - error = query_recursive (ctx, s); + if (confirm) + error = query_recursive (ctx, s); + else + error = FILE_CONT; if (error == FILE_CONT) return recursive_erase (ctx, s, progress_count, progress_bytes); else diff -ur mc-4.5.55/gnome/gcmd.c mc-4.5.55-colin/gnome/gcmd.c --- mc-4.5.55/gnome/gcmd.c Tue Aug 21 08:00:12 2001 +++ mc-4.5.55-colin/gnome/gcmd.c Tue Apr 16 13:53:39 2002 @@ -25,6 +25,7 @@ #include "gdesktop.h" #include "gmain.h" #include "file.h" +#include "util.h" #include "../vfs/vfs.h" static char *panelize_section = "Panelize"; @@ -989,4 +990,64 @@ g_free (icon); g_free (template); g_free (url); +} + +void +gnome_copy_files (GtkWidget *widget, WPanel *panel) +{ + gint i; + gchar *tmpdir; + FileOpContext *ctx, *ctx_del; + long count = 0; + double bytes = 0; + tmpdir = get_tmpdir(); + ctx = file_op_context_new(); + ctx_del = file_op_context_new(); + file_op_context_create_ui (ctx_del, OP_DELETE, 0); + if (exist_file(tmpdir)) + erase_dir_ask(ctx_del, tmpdir, &count, &bytes, 0); + my_mkdir (tmpdir, 0700); + count = 0; + bytes = 0; + file_op_context_destroy (ctx_del); + file_op_context_create_ui (ctx, OP_COPY, 0); + + for (i = 0; i < panel->count; i++) { + if(panel->dir.list[i].f.marked) { + char * dest_file = NULL; + dest_file = g_strdup_printf ("%s/%s", tmpdir, + panel->dir.list[i].fname); + if(S_ISDIR(panel->dir.list[i].buf.st_mode)) { + copy_dir_dir (ctx, panel->dir.list[i].fname, + dest_file, 0, 1, 1, 0, &count, &bytes); + + } else { + copy_file_file (ctx, panel->dir.list[i].fname, + dest_file, 0, &count, &bytes, 1); + } + g_free (dest_file); + } + } + file_op_context_destroy (ctx); + +} + +void +gnome_paste_files (GtkWidget *widget, WPanel *panel) +{ + gint i; + gchar *tmpdir; + FileOpContext *ctx; + long count = 0; + double bytes = 0; + tmpdir = get_tmpdir(); + ctx = file_op_context_new(); + file_op_context_create_ui (ctx, OP_COPY, 0); + + if (exist_file(tmpdir)) { + copy_dir_dir(ctx, tmpdir, ".", 0, 1, 1, 0, &count, &bytes); + } + + file_op_context_destroy (ctx); + reread_cmd(); } diff -ur mc-4.5.55/gnome/gcmd.h mc-4.5.55-colin/gnome/gcmd.h --- mc-4.5.55/gnome/gcmd.h Fri Jun 16 20:16:44 2000 +++ mc-4.5.55-colin/gnome/gcmd.h Tue Apr 16 13:53:39 2002 @@ -41,6 +41,8 @@ void gnome_new_launcher (GtkWidget *widget, WPanel *panel); void gnome_reverse_selection_cmd_panel (GtkWidget *widget, WPanel *panel); void gnome_select (GtkWidget *widget, WPanel *panel); +void gnome_copy_files (GtkWidget *widget, WPanel *panel); +void gnome_paste_files (GtkWidget *widget, WPanel *panel); void set_cursor_normal (WPanel *panel); void set_cursor_busy (WPanel *panel); void gnome_new_link (GtkWidget *widget, WPanel *panel); diff -ur mc-4.5.55/gnome/glayout.c mc-4.5.55-colin/gnome/glayout.c --- mc-4.5.55/gnome/glayout.c Wed Jul 25 20:27:42 2001 +++ mc-4.5.55-colin/gnome/glayout.c Tue Apr 16 13:53:39 2002 @@ -404,6 +404,11 @@ GNOMEUIINFO_ITEM_NONE(N_("_Invert Selection"), N_("Reverses the list of tagged files"), gnome_reverse_selection_cmd_panel), GNOMEUIINFO_SEPARATOR, + { GNOME_APP_UI_ITEM, N_("Temporarily _Copy Files"), N_("Temporarily copy files to paste them elsewhere"), gnome_copy_files, + NULL, NULL, 0, NULL, 'c', GDK_CONTROL_MASK }, + { GNOME_APP_UI_ITEM, N_("_Paste temporary files"), N_("Paste the temporary files you copied"), gnome_paste_files, + NULL, NULL, 0, NULL, 'v', GDK_CONTROL_MASK }, + GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Search"), N_("Search for a file in the current Panel"), gnome_start_search, NULL, NULL, 0, NULL, 's', GDK_CONTROL_MASK }, GNOMEUIINFO_SEPARATOR, diff -ur mc-4.5.55/src/cmd.c mc-4.5.55-colin/src/cmd.c --- mc-4.5.55/src/cmd.c Sun Aug 12 10:36:26 2001 +++ mc-4.5.55-colin/src/cmd.c Tue Apr 16 13:53:35 2002 @@ -1576,3 +1576,10 @@ } #endif /* !HAVE_X */ +char * +get_tmpdir(void) +{ + char *retval; + retval = g_strdup_printf ("/tmp/.mctmp%d", getuid()); + return retval; +} diff -ur mc-4.5.55/src/cmd.h mc-4.5.55-colin/src/cmd.h --- mc-4.5.55/src/cmd.h Wed Aug 23 16:42:00 2000 +++ mc-4.5.55-colin/src/cmd.h Tue Apr 16 13:53:35 2002 @@ -75,6 +75,7 @@ void info_cmd_no_menu (void); void quick_view_cmd (void); void toggle_listing_cmd (void); +char * get_tmpdir (void); void configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user, char *status); #ifdef USE_INTERNAL_EDIT diff -ur mc-4.5.55/src/file.c mc-4.5.55-colin/src/file.c --- mc-4.5.55/src/file.c Tue Aug 14 02:55:38 2001 +++ mc-4.5.55-colin/src/file.c Tue Apr 16 13:53:35 2002 @@ -1454,6 +1454,12 @@ int erase_dir (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes) { + return erase_dir_ask (ctx, s, &progress_count, &progress_bytes, 1); +} + +int +erase_dir_ask (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes, int confirm) +{ int error; if (strcmp (s, "..") == 0) @@ -1475,7 +1481,10 @@ */ error = check_dir_is_empty (s); if (error == 0){ /* not empty */ - error = query_recursive (ctx, s); + if (confirm) + error = query_recursive (ctx, s); + else + error = FILE_CONT; if (error == FILE_CONT) return recursive_erase (ctx, s, progress_count, progress_bytes); else diff -ur mc-4.5.55/src/file.h mc-4.5.55-colin/src/file.h --- mc-4.5.55/src/file.h Thu Feb 25 05:21:39 1999 +++ mc-4.5.55-colin/src/file.h Tue Apr 16 13:53:35 2002 @@ -19,6 +19,7 @@ int delete, struct link *parent_dirs, long *progres_count, double *progress_bytes); int erase_dir (FileOpContext *ctx, char *s, long *progres_count, double *progress_bytes); +int erase_dir_ask (FileOpContext *ctx, char *s, long *progres_count, double *progress_bytes, int confirm); int erase_file (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes, int is_toplevel_file); int erase_dir_iff_empty (FileOpContext *ctx, char *s);