summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorTimothy Arceri <t_arceri@yahoo.com.au>2012-11-29 17:39:36 +1100
committerCosimo Cecchi <cosimoc@gnome.org>2012-11-30 17:44:38 -0500
commitecee8be850b8342c804de2ecc3e613b99a20a010 (patch)
tree18bb87edac8fecd4bfdc1d17ea92e23eca21ba12 /libnautilus-private
parent7382ddfb87938e1433090ad39b46df5cce1908f8 (diff)
downloadnautilus-ecee8be850b8342c804de2ecc3e613b99a20a010.tar.gz
Make sure to use correct filename when restoring from Trash
https://bugzilla.gnome.org/show_bug.cgi?id=673598
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-file-operations.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index b60b748d2..85d5a6f1f 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -3258,18 +3258,28 @@ get_target_file_with_custom_name (GFile *src,
if (dest == NULL && !same_fs) {
info = g_file_query_info (src,
- G_FILE_ATTRIBUTE_STANDARD_COPY_NAME,
+ G_FILE_ATTRIBUTE_STANDARD_COPY_NAME ","
+ G_FILE_ATTRIBUTE_TRASH_ORIG_PATH,
0, NULL, NULL);
if (info) {
- copyname = g_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_COPY_NAME));
+ copyname = NULL;
+
+ /* if file is being restored from trash make sure it uses its original name */
+ if (g_file_has_uri_scheme (src, "trash")) {
+ copyname = g_strdup (g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH));
+ }
+
+ if (copyname == NULL) {
+ copyname = g_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_COPY_NAME));
+ }
if (copyname) {
make_file_name_valid_for_dest_fs (copyname, dest_fs_type);
dest = g_file_get_child_for_display_name (dest_dir, copyname, NULL);
g_free (copyname);
}
-
+
g_object_unref (info);
}
}