[file-roller] Extract multi-byte filename from URI in case of DND.



commit 7d4c57ff5255fd35a6c6fa4a74d68acb5f5ec3ca
Author: Takao Fujiwara <tfujiwar redhat com>
Date:   Wed Mar 24 18:36:07 2010 +0900

    Extract multi-byte filename from URI in case of DND.
    
    [bug #613298]

 src/fr-command-tar.c |    3 +++
 src/fr-window.c      |   22 +++++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 7e364ab..53ab601 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -168,6 +168,9 @@ process_line (char     *line,
 		fdata->original_path = fdata->full_path + 1;
 	}
 	g_free (name);
+	name = g_filename_from_utf8 (fdata->original_path, -1, NULL, NULL, NULL);
+	if (name)
+		fdata->original_path = name;
 
 	if (fields[1] != NULL)
 		fdata->link = g_strdup (fields[1]);
diff --git a/src/fr-window.c b/src/fr-window.c
index ed3cb66..ad6a805 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4059,6 +4059,8 @@ fr_window_drag_data_received  (GtkWidget          *widget,
 			if (r == GTK_RESPONSE_YES) {
 				char       *first_item;
 				char       *folder;
+				char       *local_path = NULL;
+				char       *utf8_path = NULL;
 				const char *archive_name;
 
 				fr_window_free_batch_data (window);
@@ -4072,12 +4074,26 @@ fr_window_drag_data_received  (GtkWidget          *widget,
 				if (folder != NULL)
 					fr_window_set_open_default_dir (window, folder);
 
-				if ((list->next != NULL) && (folder != NULL))
+				if ((list->next != NULL) && (folder != NULL)) {
 					archive_name = file_name_from_path (folder);
-				else
-					archive_name = file_name_from_path (first_item);
+				}
+				else {
+					if (uri_is_local (first_item)) {
+						local_path = g_filename_from_uri (first_item, NULL, NULL);
+						if (local_path)
+							utf8_path = g_filename_to_utf8 (local_path, -1, NULL, NULL, NULL);
+						if (!utf8_path)
+							utf8_path= g_strdup (first_item);
+						g_free (local_path);
+					}
+					else {
+						utf8_path = g_strdup (first_item);
+					}
+					archive_name = file_name_from_path (utf8_path);
+				}
 
 				show_new_archive_dialog (window, archive_name);
+				g_free (utf8_path);
 
 				g_free (folder);
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]