changeset 900:dc13766d1eeb

fixed file copy/move dialog
author nadvornik
date Sun, 20 Jul 2008 13:59:55 +0000
parents 5d9c0b4e6d5f
children ae75cd2b4d76
files src/utilops.c
diffstat 1 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/utilops.c	Sun Jul 20 13:19:22 2008 +0000
+++ b/src/utilops.c	Sun Jul 20 13:59:55 2008 +0000
@@ -812,24 +812,10 @@
 	file_util_dialog_run(ud);
 }
 
-static void file_util_fdlg_ok_cb(FileDialog *fdlg, gpointer data)
+static void file_util_dest_folder_update_path(UtilityData *ud)
 {
-	UtilityData *ud = data;
-	
-	file_dialog_close(fdlg);
-	
-	ud->fdlg = NULL;
-
-	file_util_dialog_run(ud);
-}
-
-
-static void file_util_dest_folder_entry_cb(GtkWidget *entry, gpointer data)
-{
-	UtilityData *ud = data;
-	
 	g_free(ud->dest_path);
-	ud->dest_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+	ud->dest_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(ud->fdlg->entry)));
 	
 	switch (ud->type)
 		{
@@ -852,6 +838,24 @@
 		}
 }
 
+static void file_util_fdlg_ok_cb(FileDialog *fdlg, gpointer data)
+{
+	UtilityData *ud = data;
+	
+	file_util_dest_folder_update_path(ud);
+	file_dialog_close(fdlg);
+	
+	ud->fdlg = NULL;
+
+	file_util_dialog_run(ud);
+}
+
+
+static void file_util_dest_folder_entry_cb(GtkWidget *entry, gpointer data)
+{
+	UtilityData *ud = data;
+	file_util_dest_folder_update_path(ud);
+}
 
 /* format: * = filename without extension, ## = number position, extension is kept */
 static gchar *file_util_rename_multiple_auto_format_name(const gchar *format, const gchar *name, gint n)
@@ -1429,7 +1433,7 @@
 	ud->content_list = NULL;
 	ud->parent = parent;
 
-	ud->dest_path = g_strdup(dest_path ? dest_path : "");
+	if (dest_path) ud->dest_path = g_strdup(dest_path);
 	
 	ud->messages.title = _("Move");
 	ud->messages.question = _("Move files?");
@@ -1466,7 +1470,7 @@
 	ud->content_list = NULL;
 	ud->parent = parent;
 
-	ud->dest_path = g_strdup(dest_path ? dest_path : "");
+	if (dest_path) ud->dest_path = g_strdup(dest_path);
 	
 	ud->messages.title = _("Copy");
 	ud->messages.question = _("Copy files?");
@@ -1549,7 +1553,7 @@
 	ud->content_list = NULL;
 	ud->parent = parent;
 
-	ud->dest_path = g_strdup(dest_path ? dest_path : "");
+	if (dest_path) ud->dest_path = g_strdup(dest_path);
 	
 	ud->messages.title = _("Editor");
 	ud->messages.question = _("Run editor?");