Patch for bug #103802



Hi

I created a patch for bug #103802 (Fixing a "invalid unicode" filename
causes "invalid" info to become part of filename).

I forward it here so that it doesn't get lost in bugzilla.

-- 
Julien Olivier <julo altern org>
Index: nautilus/libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.365
diff -p -u -r1.365 nautilus-icon-container.c
--- nautilus/libnautilus-private/nautilus-icon-container.c	10 Feb 2004 11:33:40 -0000	1.365
+++ nautilus/libnautilus-private/nautilus-icon-container.c	6 Mar 2004 13:00:01 -0000
@@ -6043,6 +6043,7 @@ nautilus_icon_container_start_renaming_s
 	const char *editable_text;
 	int x, y, width;
 	int start_offset, end_offset;
+	gchar **split_editable_text;
 
 	/* Check if it already in renaming mode. */
 	details = container->details;
@@ -6072,6 +6073,14 @@ nautilus_icon_container_start_renaming_s
 	/* This could conceivably be NULL if a rename was triggered really early. */
 	if (editable_text == NULL) {
 		return;
+	}
+	else {
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_editable_text = g_strsplit (editable_text, gettext (" (invalid Unicode)"), 2);
+		if (split_editable_text [0] && split_editable_text [1]) {
+			editable_text = split_editable_text [0];
+		}
+		g_strfreev (split_editable_text);
 	}
 
 	details->original_text = g_strdup (editable_text);
Index: nautilus/src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.197
diff -p -u -r1.197 fm-properties-window.c
--- nautilus/src/file-manager/fm-properties-window.c	27 Feb 2004 21:42:36 -0000	1.197
+++ nautilus/src/file-manager/fm-properties-window.c	6 Mar 2004 13:00:18 -0000
@@ -543,6 +543,7 @@ update_name_field (FMPropertiesWindow *w
 	NautilusFile *file;
 	const char *original_name;
 	char *current_name, *displayed_name;
+	gchar **split_name;
 
 	if (is_multi_file_window (window)) {
 		/* Multifile property dialog, show all names */
@@ -594,6 +595,16 @@ update_name_field (FMPropertiesWindow *w
 		 * aspect of the file might have), then don't clobber changes.
 		 */
 		current_name = nautilus_file_get_display_name (file);
+
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_name = g_strsplit (current_name, gettext (" (invalid Unicode)"), 2);
+		if (split_name [0] && split_name [1]) {
+			g_free (current_name);
+			current_name = g_strdup_printf ("%s", split_name [0]);
+		}
+		g_strfreev (split_name);
+
+
 		if (original_name == NULL || 
 		    eel_strcmp (original_name, current_name) != 0) {
 			g_object_set_data_full (G_OBJECT (window->details->name_field),
@@ -3495,6 +3506,38 @@ fm_properties_window_present (GList *ori
 	/* Look to see if we're already waiting for a window for this file. */
 	if (g_hash_table_lookup (pending_lists, pending_key) != NULL) {
 		return;
+	}
+	else {
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_editable_text = g_strsplit (editable_text, gettext (" (invalid Unicode)"), 2);
+		if (split_editable_text [0] && split_editable_text [1]) {
+			editable_text = split_editable_text [0];
+		}
+		g_strfreev (split_editable_text);
+	}
+	else {
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_editable_text = g_strsplit (editable_text, gettext (" (invalid Unicode)"), 2);
+		if (split_editable_text [0] && split_editable_text [1]) {
+			editable_text = split_editable_text [0];
+		}
+		g_strfreev (split_editable_text);
+	}
+	else {
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_editable_text = g_strsplit (editable_text, gettext (" (invalid Unicode)"), 2);
+		if (split_editable_text [0] && split_editable_text [1]) {
+			editable_text = split_editable_text [0];
+		}
+		g_strfreev (split_editable_text);
+	}
+	else {
+		/* Remove the " (invalid Unicode)" part of the name*/
+		split_editable_text = g_strsplit (editable_text, gettext (" (invalid Unicode)"), 2);
+		if (split_editable_text [0] && split_editable_text [1]) {
+			editable_text = split_editable_text [0];
+		}
+		g_strfreev (split_editable_text);
 	}
 
 	target_files = get_target_file_list (original_files);


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