Add option for Copy and Move to automatically overwrite destination file if source is newer. Index:rox-1.2.0-newer/ROX-Filer/Options.xml *** rox-1.2.0/ROX-Filer/Options.xml Thu Dec 27 13:41:52 2001 --- rox-1.2.0-newer/ROX-Filer/Options.xml Thu Feb 21 08:37:37 2002 *************** *** 102,107 **** --- 102,109 ---- Don't confirm deletion of non-writeable items. Don't display so much information in the message area. Also change contents of subdirectories. + Only over-write if source + is newer than destination.
Index:rox-1.2.0-newer/ROX-Filer/src/action.c *** rox-1.2.0/ROX-Filer/src/action.c Sat Feb 2 14:31:32 2002 --- rox-1.2.0-newer/ROX-Filer/src/action.c Wed Feb 20 16:29:04 2002 *************** *** 59,64 **** --- 59,65 ---- * F Force deletion of non-writeable items * Q Quiet toggled * E Entry text changed + * W neWer toggled */ #define SENSITIVE_YESNO(gui_side, state) \ *************** *** 119,124 **** --- 120,126 ---- static gboolean o_force = FALSE; static gboolean o_brief = FALSE; static gboolean o_recurse = FALSE; + static gboolean o_newer = FALSE; /* Whenever the text in these boxes is changed we store a copy of the new * string to be used as the default next time. *************** *** 738,743 **** --- 740,748 ---- case 'E': read_new_entry_text(); break; + case 'W': + o_newer=!o_newer; + break; default: g_string_sprintf(message, "!ERROR: Bad message '%c'\n", flag); *************** *** 856,862 **** */ static GUIside *start_action_with_options(gpointer data, ActionChild *func, gboolean autoq, ! int force, int brief, int recurse) { int filedes[4]; /* 0 and 2 are for reading */ GUIside *gui_side; --- 861,868 ---- */ static GUIside *start_action_with_options(gpointer data, ActionChild *func, gboolean autoq, ! int force, int brief, int recurse, ! int newer) { int filedes[4]; /* 0 and 2 are for reading */ GUIside *gui_side; *************** *** 884,889 **** --- 890,896 ---- o_force = force; o_brief = brief; o_recurse = recurse; + o_newer = newer; child = fork(); switch (child) *************** *** 1026,1032 **** return start_action_with_options(data, func, autoq, option_get_int("action_force"), option_get_int("action_brief"), ! option_get_int("action_recurse")); } /* ACTIONS ON ONE ITEM */ --- 1033,1040 ---- return start_action_with_options(data, func, autoq, option_get_int("action_force"), option_get_int("action_brief"), ! option_get_int("action_recurse"), ! option_get_int("action_newer")); } /* ACTIONS ON ONE ITEM */ *************** *** 1360,1372 **** merge = S_ISDIR(info.st_mode) && S_ISDIR(dest_info.st_mode); ! g_string_sprintf(message, _("?'%s' already exists - %s?"), dest_path, merge ? _("merge contents") : _("overwrite")); - - if (!reply(from_parent, TRUE)) - return; if (!merge) { if (S_ISDIR(dest_info.st_mode)) --- 1368,1384 ---- merge = S_ISDIR(info.st_mode) && S_ISDIR(dest_info.st_mode); ! if(!merge && o_newer && info.st_ctime>dest_info.st_ctime) { ! /* Newer, keep going */ ! } else { ! g_string_sprintf(message, _("?'%s' already exists - %s?"), dest_path, merge ? _("merge contents") : _("overwrite")); + if (!reply(from_parent, TRUE)) + return; + } + if (!merge) { if (S_ISDIR(dest_info.st_mode)) *************** *** 1520,1531 **** struct stat info; int err; - g_string_sprintf(message, - _("?'%s' already exists - overwrite?"), - dest_path); - if (!reply(from_parent, TRUE)) - return; - if (mc_lstat(dest_path, &info)) { send_error(); --- 1532,1537 ---- *************** *** 1532,1537 **** --- 1538,1553 ---- return; } + if(!is_dir && o_newer && info2.st_ctime>info.st_ctime) { + /* */ + } else { + g_string_sprintf(message, + _("?'%s' already exists - overwrite?"), + dest_path); + if (!reply(from_parent, TRUE)) + return; + } + if (S_ISDIR(info.st_mode)) err = rmdir(dest_path); else *************** *** 2150,2155 **** --- 2166,2175 ---- return; gtk_window_set_title(GTK_WINDOW(gui_side->window), _("Copy")); + add_toggle(gui_side, + _("Newer"), + _("Only over-write if source is newer than destination."), + "W", option_get_int("action_newer")); number_of_windows++; gtk_widget_show_all(gui_side->window); } *************** *** 2172,2177 **** --- 2192,2201 ---- return; gtk_window_set_title(GTK_WINDOW(gui_side->window), _("Move")); + add_toggle(gui_side, + _("Newer"), + _("Only over-write if source is newer than destination."), + "W", option_get_int("action_newer")); number_of_windows++; gtk_widget_show_all(gui_side->window); } *************** *** 2204,2209 **** --- 2228,2234 ---- option_add_int("action_force", o_force, NULL); option_add_int("action_brief", o_brief, NULL); option_add_int("action_recurse", o_recurse, NULL); + option_add_int("action_newer", o_newer, NULL); } #define MAX_ASK 4