Handle hostnames in the progress dialog strings more robustly. Fixes

2006-01-14  Martin Wehner  <martin.wehner@gmail.com>

	* libnautilus-private/nautilus-file-operations.c:
	(progress_dialog_set_to_from_item_text):
	Handle hostnames in the progress dialog strings more robustly.
	Fixes #325737.
	Based on a batch from Anilkumar B. <anilkumar.bacheli@wipro.com>
This commit is contained in:
Martin Wehner 2006-01-14 12:44:28 +00:00 committed by Martin Wehner
parent fbcc3d7a9e
commit 5dbfb86c95
2 changed files with 25 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2006-01-14 Martin Wehner <martin.wehner@gmail.com>
* libnautilus-private/nautilus-file-operations.c:
(progress_dialog_set_to_from_item_text):
Handle hostnames in the progress dialog strings more robustly.
Fixes #325737.
Based on a batch from Anilkumar B. <anilkumar.bacheli@wipro.com>
2006-01-12 Christian Neumair <chris@gnome-de.org>
* src/nautilus-bookmarks-window.c: (update_bookmark_from_text):

View file

@ -416,6 +416,7 @@ progress_dialog_set_to_from_item_text (NautilusFileOperationsProgress *dialog,
char *to_path;
char *to_text;
char *progress_label_text;
const char *hostname;
const char *from_prefix;
const char *to_prefix;
GnomeVFSURI *uri;
@ -432,6 +433,7 @@ progress_dialog_set_to_from_item_text (NautilusFileOperationsProgress *dialog,
uri = gnome_vfs_uri_new (from_uri);
item = gnome_vfs_uri_extract_short_name (uri);
from_path = gnome_vfs_uri_extract_dirname (uri);
hostname = NULL;
/* remove the last '/' */
length = strlen (from_path);
@ -439,12 +441,15 @@ progress_dialog_set_to_from_item_text (NautilusFileOperationsProgress *dialog,
from_path [length - 1] = '\0';
}
if (g_str_has_prefix (from_uri, "file://")) {
from_text = from_path;
} else {
if (!gnome_vfs_uri_is_local (uri)) {
hostname = gnome_vfs_uri_get_host_name (uri);
}
if (hostname) {
from_text = g_strdup_printf (_("%s on %s"),
from_path, gnome_vfs_uri_get_host_name (uri));
from_path, hostname);
g_free (from_path);
} else {
from_text = from_path;
}
gnome_vfs_uri_unref (uri);
@ -457,6 +462,7 @@ progress_dialog_set_to_from_item_text (NautilusFileOperationsProgress *dialog,
if (to_uri != NULL) {
uri = gnome_vfs_uri_new (to_uri);
to_path = gnome_vfs_uri_extract_dirname (uri);
hostname = NULL;
/* remove the last '/' */
length = strlen (to_path);
@ -464,12 +470,15 @@ progress_dialog_set_to_from_item_text (NautilusFileOperationsProgress *dialog,
to_path [length - 1] = '\0';
}
if (g_str_has_prefix (to_uri, "file://")) {
to_text = to_path;
} else {
if (!gnome_vfs_uri_is_local (uri)) {
hostname = gnome_vfs_uri_get_host_name (uri);
}
if (hostname) {
to_text = g_strdup_printf (_("%s on %s"),
to_path, gnome_vfs_uri_get_host_name (uri));
to_path, hostname);
g_free (to_path);
} else {
to_text = to_path;
}
gnome_vfs_uri_unref (uri);