Convert link names and duplicate names with g_filename_to/from_utf8().

2003-01-17  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-file-operations.c:
	Convert link names and duplicate names with
	g_filename_to/from_utf8(). (#103721)
	Patch from hidetoshi.tajima@sun.com
This commit is contained in:
Alexander Larsson 2003-01-17 08:53:29 +00:00 committed by Alexander Larsson
parent 00dc676d51
commit 5a1f0d7b6a
2 changed files with 27 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2003-01-17 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c:
Convert link names and duplicate names with
g_filename_to/from_utf8(). (#103721)
Patch from hidetoshi.tajima@sun.com
2003-01-16 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c (nautilus_file_operations_new_folder):

View file

@ -1103,15 +1103,21 @@ get_link_name (char *name, int count)
{
char *result;
char *unescaped_name;
char *unescaped_tmp_name;
char *unescaped_result;
char *new_file;
const char *format;
g_assert (name != NULL);
unescaped_name = gnome_vfs_unescape_string (name, "/");
unescaped_tmp_name = gnome_vfs_unescape_string (name, "/");
g_free (name);
unescaped_name = g_filename_to_utf8 (unescaped_tmp_name, -1,
NULL, NULL, NULL);
g_free (unescaped_tmp_name);
if (count < 1) {
g_warning ("bad count in get_link_name");
count = 1;
@ -1164,11 +1170,12 @@ get_link_name (char *name, int count)
}
unescaped_result = g_strdup_printf (format, count, unescaped_name);
}
result = gnome_vfs_escape_path_string (unescaped_result);
new_file = g_filename_from_utf8 (unescaped_result, -1, NULL, NULL, NULL);
result = gnome_vfs_escape_path_string (new_file);
g_free (unescaped_name);
g_free (unescaped_result);
g_free (new_file);
return result;
}
@ -1455,18 +1462,25 @@ static char *
get_next_duplicate_name (char *name, int count_increment)
{
char *unescaped_name;
char *unescaped_tmp_name;
char *unescaped_result;
char *result;
char *new_file;
unescaped_name = gnome_vfs_unescape_string (name, "/");
unescaped_tmp_name = gnome_vfs_unescape_string (name, "/");
g_free (name);
unescaped_name = g_filename_to_utf8 (unescaped_tmp_name, -1,
NULL, NULL, NULL);
g_free (unescaped_tmp_name);
unescaped_result = get_duplicate_name (unescaped_name, count_increment);
g_free (unescaped_name);
result = gnome_vfs_escape_path_string (unescaped_result);
new_file = g_filename_from_utf8 (unescaped_result, -1, NULL, NULL, NULL);
result = gnome_vfs_escape_path_string (new_file);
g_free (unescaped_result);
g_free (new_file);
return result;
}