comparison src/utilops.c @ 136:18c2a29e681c

more external commands
author nadvornik
date Mon, 20 Aug 2007 20:11:32 +0000
parents 15c1925b3bfb
children 71e1ebee420e
comparison
equal deleted inserted replaced
135:15c1925b3bfb 136:18c2a29e681c
330 /* 330 /*
331 *-------------------------------------------------------------------------- 331 *--------------------------------------------------------------------------
332 * Move and Copy routines 332 * Move and Copy routines
333 *-------------------------------------------------------------------------- 333 *--------------------------------------------------------------------------
334 */ 334 */
335
336 static gint copy_file_ext(const gchar *s, const gchar *t)
337 {
338 if (editor_command[CMD_COPY])
339 return start_editor_from_pair(CMD_COPY, s, t);
340 return copy_file(s, t);
341 }
342
343 static gint move_file_ext(const gchar *s, const gchar *t)
344 {
345 if (editor_command[CMD_MOVE])
346 return start_editor_from_pair(CMD_MOVE, s, t);
347 return move_file(s, t);
348 }
349
350 static gint rename_file_ext(const gchar *s, const gchar *t)
351 {
352 if (editor_command[CMD_RENAME])
353 return start_editor_from_pair(CMD_RENAME, s, t);
354 return rename_file(s, t);
355 }
356
335 357
336 /* 358 /*
337 * Multi file move 359 * Multi file move
338 */ 360 */
339 361
635 } 657 }
636 if (try) 658 if (try)
637 { 659 {
638 if (fdm->copy) 660 if (fdm->copy)
639 { 661 {
640 if (copy_file(fdm->source, fdm->dest)) 662 if (copy_file_ext(fdm->source, fdm->dest))
641 { 663 {
642 success = TRUE; 664 success = TRUE;
643 file_maint_copied(fdm->source, fdm->dest); 665 file_maint_copied(fdm->source, fdm->dest);
644 } 666 }
645 } 667 }
646 else 668 else
647 { 669 {
648 if (move_file(fdm->source, fdm->dest)) 670 if (move_file_ext(fdm->source, fdm->dest))
649 { 671 {
650 success = TRUE; 672 success = TRUE;
651 file_maint_moved(fdm->source, fdm->dest, fdm->source_list); 673 file_maint_moved(fdm->source, fdm->dest, fdm->source_list);
652 } 674 }
653 } 675 }
868 else 890 else
869 { 891 {
870 gint success = FALSE; 892 gint success = FALSE;
871 if (fds->copy) 893 if (fds->copy)
872 { 894 {
873 if (copy_file(fds->source, fds->dest)) 895 if (copy_file_ext(fds->source, fds->dest))
874 { 896 {
875 success = TRUE; 897 success = TRUE;
876 file_maint_copied(fds->source, fds->dest); 898 file_maint_copied(fds->source, fds->dest);
877 } 899 }
878 } 900 }
879 else 901 else
880 { 902 {
881 if (move_file(fds->source, fds->dest)) 903 if (move_file_ext(fds->source, fds->dest))
882 { 904 {
883 success = TRUE; 905 success = TRUE;
884 file_maint_moved(fds->source, fds->dest, NULL); 906 file_maint_moved(fds->source, fds->dest, NULL);
885 } 907 }
886 } 908 }
1766 gtk_widget_show(gd->dialog); 1788 gtk_widget_show(gd->dialog);
1767 return; 1789 return;
1768 } 1790 }
1769 else 1791 else
1770 { 1792 {
1771 if (!rename_file(fd->source_path, fd->dest_path)) 1793 if (!rename_file_ext(fd->source_path, fd->dest_path))
1772 { 1794 {
1773 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\n to:\n%s"), 1795 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\n to:\n%s"),
1774 filename_from_path(fd->source_path), 1796 filename_from_path(fd->source_path),
1775 filename_from_path(fd->dest_path)); 1797 filename_from_path(fd->dest_path));
1776 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, NULL); 1798 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, NULL);
1987 else 2009 else
1988 { 2010 {
1989 dest = g_strdup_printf("%s/%s%0*d%s", base, front, padding, n, end); 2011 dest = g_strdup_printf("%s/%s%0*d%s", base, front, padding, n, end);
1990 } 2012 }
1991 2013
1992 if (!rename_file(path, dest)) 2014 if (!rename_file_ext(path, dest))
1993 { 2015 {
1994 success = FALSE; 2016 success = FALSE;
1995 } 2017 }
1996 else 2018 else
1997 { 2019 {
2487 2509
2488 return; 2510 return;
2489 } 2511 }
2490 else 2512 else
2491 { 2513 {
2492 if (!rename_file(fds->source, fds->dest)) 2514 if (!rename_file_ext(fds->source, fds->dest))
2493 { 2515 {
2494 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\nto:\n%s"), filename_from_path(fds->source), filename_from_path(fds->dest)); 2516 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\nto:\n%s"), filename_from_path(fds->source), filename_from_path(fds->dest));
2495 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, NULL); 2517 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, NULL);
2496 g_free(text); 2518 g_free(text);
2497 } 2519 }
2702 g_free(text); 2724 g_free(text);
2703 2725
2704 return FALSE; 2726 return FALSE;
2705 } 2727 }
2706 2728
2707 if (!rename_file(old_path, new_path)) 2729 if (!rename_file_ext(old_path, new_path))
2708 { 2730 {
2709 gchar *text = g_strdup_printf(_("Failed to rename %s to %s."), old_name, new_name); 2731 gchar *text = g_strdup_printf(_("Failed to rename %s to %s."), old_name, new_name);
2710 file_util_warning_dialog(_("Rename failed"), text, GTK_STOCK_DIALOG_ERROR, parent); 2732 file_util_warning_dialog(_("Rename failed"), text, GTK_STOCK_DIALOG_ERROR, parent);
2711 g_free(text); 2733 g_free(text);
2712 2734