comparison src/utilops.c @ 900:dc13766d1eeb

fixed file copy/move dialog
author nadvornik
date Sun, 20 Jul 2008 13:59:55 +0000
parents 6c676d3eef5b
children ae75cd2b4d76
comparison
equal deleted inserted replaced
899:5d9c0b4e6d5f 900:dc13766d1eeb
810 810
811 ud->phase = UTILITY_PHASE_CANCEL; 811 ud->phase = UTILITY_PHASE_CANCEL;
812 file_util_dialog_run(ud); 812 file_util_dialog_run(ud);
813 } 813 }
814 814
815 static void file_util_fdlg_ok_cb(FileDialog *fdlg, gpointer data) 815 static void file_util_dest_folder_update_path(UtilityData *ud)
816 { 816 {
817 UtilityData *ud = data;
818
819 file_dialog_close(fdlg);
820
821 ud->fdlg = NULL;
822
823 file_util_dialog_run(ud);
824 }
825
826
827 static void file_util_dest_folder_entry_cb(GtkWidget *entry, gpointer data)
828 {
829 UtilityData *ud = data;
830
831 g_free(ud->dest_path); 817 g_free(ud->dest_path);
832 ud->dest_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); 818 ud->dest_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(ud->fdlg->entry)));
833 819
834 switch (ud->type) 820 switch (ud->type)
835 { 821 {
836 case UTILITY_TYPE_COPY: 822 case UTILITY_TYPE_COPY:
837 file_data_sc_update_ci_copy_list(ud->flist, ud->dest_path); 823 file_data_sc_update_ci_copy_list(ud->flist, ud->dest_path);
850 case UTILITY_TYPE_RENAME_FOLDER: 836 case UTILITY_TYPE_RENAME_FOLDER:
851 g_warning("unhandled operation"); 837 g_warning("unhandled operation");
852 } 838 }
853 } 839 }
854 840
841 static void file_util_fdlg_ok_cb(FileDialog *fdlg, gpointer data)
842 {
843 UtilityData *ud = data;
844
845 file_util_dest_folder_update_path(ud);
846 file_dialog_close(fdlg);
847
848 ud->fdlg = NULL;
849
850 file_util_dialog_run(ud);
851 }
852
853
854 static void file_util_dest_folder_entry_cb(GtkWidget *entry, gpointer data)
855 {
856 UtilityData *ud = data;
857 file_util_dest_folder_update_path(ud);
858 }
855 859
856 /* format: * = filename without extension, ## = number position, extension is kept */ 860 /* format: * = filename without extension, ## = number position, extension is kept */
857 static gchar *file_util_rename_multiple_auto_format_name(const gchar *format, const gchar *name, gint n) 861 static gchar *file_util_rename_multiple_auto_format_name(const gchar *format, const gchar *name, gint n)
858 { 862 {
859 gchar *new_name; 863 gchar *new_name;
1427 ud->dir_fd = NULL; 1431 ud->dir_fd = NULL;
1428 ud->flist = flist; 1432 ud->flist = flist;
1429 ud->content_list = NULL; 1433 ud->content_list = NULL;
1430 ud->parent = parent; 1434 ud->parent = parent;
1431 1435
1432 ud->dest_path = g_strdup(dest_path ? dest_path : ""); 1436 if (dest_path) ud->dest_path = g_strdup(dest_path);
1433 1437
1434 ud->messages.title = _("Move"); 1438 ud->messages.title = _("Move");
1435 ud->messages.question = _("Move files?"); 1439 ud->messages.question = _("Move files?");
1436 ud->messages.desc_flist = _("This will move the following files"); 1440 ud->messages.desc_flist = _("This will move the following files");
1437 ud->messages.desc_dlist = ""; 1441 ud->messages.desc_dlist = "";
1464 ud->dir_fd = NULL; 1468 ud->dir_fd = NULL;
1465 ud->flist = flist; 1469 ud->flist = flist;
1466 ud->content_list = NULL; 1470 ud->content_list = NULL;
1467 ud->parent = parent; 1471 ud->parent = parent;
1468 1472
1469 ud->dest_path = g_strdup(dest_path ? dest_path : ""); 1473 if (dest_path) ud->dest_path = g_strdup(dest_path);
1470 1474
1471 ud->messages.title = _("Copy"); 1475 ud->messages.title = _("Copy");
1472 ud->messages.question = _("Copy files?"); 1476 ud->messages.question = _("Copy files?");
1473 ud->messages.desc_flist = _("This will copy the following files"); 1477 ud->messages.desc_flist = _("This will copy the following files");
1474 ud->messages.desc_dlist = ""; 1478 ud->messages.desc_dlist = "";
1547 ud->dir_fd = NULL; 1551 ud->dir_fd = NULL;
1548 ud->flist = flist; 1552 ud->flist = flist;
1549 ud->content_list = NULL; 1553 ud->content_list = NULL;
1550 ud->parent = parent; 1554 ud->parent = parent;
1551 1555
1552 ud->dest_path = g_strdup(dest_path ? dest_path : ""); 1556 if (dest_path) ud->dest_path = g_strdup(dest_path);
1553 1557
1554 ud->messages.title = _("Editor"); 1558 ud->messages.title = _("Editor");
1555 ud->messages.question = _("Run editor?"); 1559 ud->messages.question = _("Run editor?");
1556 ud->messages.desc_flist = _("This will copy the following files"); 1560 ud->messages.desc_flist = _("This will copy the following files");
1557 ud->messages.desc_dlist = ""; 1561 ud->messages.desc_dlist = "";