comparison src/utilops.c @ 1637:cc3ccf3c7c27

unify code paths for New directory keep the directory visible after rename https://sourceforge.net/tracker/?func=detail&aid=1951183&group_id=222125&atid=1054680
author nadvornik
date Mon, 08 Jun 2009 19:05:49 +0000
parents 2842a051c870
children c16f499ea1ce
comparison
equal deleted inserted replaced
1636:157ef2c48fa2 1637:cc3ccf3c7c27
933 void file_util_check_ci(UtilityData *ud) 933 void file_util_check_ci(UtilityData *ud)
934 { 934 {
935 gint error = CHANGE_OK; 935 gint error = CHANGE_OK;
936 gchar *desc = NULL; 936 gchar *desc = NULL;
937 937
938 if (ud->type != UTILITY_TYPE_CREATE_FOLDER) 938 if (ud->type != UTILITY_TYPE_CREATE_FOLDER &&
939 ud->type != UTILITY_TYPE_RENAME_FOLDER)
939 { 940 {
940 if (ud->dest_path && !isdir(ud->dest_path)) 941 if (ud->dest_path && !isdir(ud->dest_path))
941 { 942 {
942 error = CHANGE_GENERIC_ERROR; 943 error = CHANGE_GENERIC_ERROR;
943 desc = g_strdup_printf(_("%s is not a directory"), ud->dest_path); 944 desc = g_strdup_printf(_("%s is not a directory"), ud->dest_path);
2578 2579
2579 return ok; 2580 return ok;
2580 } 2581 }
2581 2582
2582 2583
2583 static void file_util_rename_dir_full(FileData *fd, const gchar *new_path, GtkWidget *parent, UtilityPhase phase) 2584 static void file_util_rename_dir_full(FileData *fd, const gchar *new_path, GtkWidget *parent, UtilityPhase phase, FileUtilDoneFunc done_func, gpointer done_data)
2584 { 2585 {
2585 UtilityData *ud; 2586 UtilityData *ud;
2586 2587
2587 ud = file_util_data_new(UTILITY_TYPE_RENAME_FOLDER); 2588 ud = file_util_data_new(UTILITY_TYPE_RENAME_FOLDER);
2588 2589
2592 2593
2593 ud->dir_fd = file_data_ref(fd); 2594 ud->dir_fd = file_data_ref(fd);
2594 ud->flist = NULL; 2595 ud->flist = NULL;
2595 ud->content_list = NULL; 2596 ud->content_list = NULL;
2596 ud->parent = parent; 2597 ud->parent = parent;
2598
2599 ud->done_func = done_func;
2600 ud->done_data = done_data;
2601 ud->dest_path = g_strdup(new_path);
2597 2602
2598 ud->messages.title = _("Rename"); 2603 ud->messages.title = _("Rename");
2599 ud->messages.question = _("Rename folder?"); 2604 ud->messages.question = _("Rename folder?");
2600 ud->messages.desc_flist = _("The folder contains the following files"); 2605 ud->messages.desc_flist = _("The folder contains the following files");
2601 ud->messages.desc_source_fd = ""; 2606 ud->messages.desc_source_fd = "";
2730 void file_util_create_dir(FileData *dir_fd, GtkWidget *parent, FileUtilDoneFunc done_func, gpointer done_data) 2735 void file_util_create_dir(FileData *dir_fd, GtkWidget *parent, FileUtilDoneFunc done_func, gpointer done_data)
2731 { 2736 {
2732 file_util_create_dir_full(dir_fd, NULL, parent, UTILITY_PHASE_ENTERING, done_func, done_data); 2737 file_util_create_dir_full(dir_fd, NULL, parent, UTILITY_PHASE_ENTERING, done_func, done_data);
2733 } 2738 }
2734 2739
2735 void file_util_rename_dir(FileData *source_fd, const gchar *new_path, GtkWidget *parent) 2740 void file_util_rename_dir(FileData *source_fd, const gchar *new_path, GtkWidget *parent, FileUtilDoneFunc done_func, gpointer done_data)
2736 { 2741 {
2737 file_util_rename_dir_full(source_fd, new_path, parent, UTILITY_PHASE_ENTERING); 2742 file_util_rename_dir_full(source_fd, new_path, parent, UTILITY_PHASE_ENTERING, done_func, done_data);
2738 } 2743 }
2739 2744
2740 2745
2741 void file_util_copy_path_to_clipboard(FileData *fd) 2746 void file_util_copy_path_to_clipboard(FileData *fd)
2742 { 2747 {