[gvfs] Don't always overwrite on trash restore



commit bffa8a049d7d1ce681af3b0288684a0e64a56a0b
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Oct 8 15:11:10 2009 +0200

    Don't always overwrite on trash restore
    
    We want to get overwrite dialogs when restoring from trash.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596618

 daemon/gvfsbackendtrash.c   |    2 +-
 daemon/trashlib/trashitem.c |    8 +++++---
 daemon/trashlib/trashitem.h |    1 +
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index 166bd04..e515fb8 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -447,7 +447,7 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
               destination = g_file_new_for_path (local_path);
 
               if (remove_source)
-                it_worked = trash_item_restore (item, destination, &error);
+                it_worked = trash_item_restore (item, destination, flags, &error);
               else
                 it_worked = g_file_copy (real, destination, flags, 
                                          G_VFS_JOB (job)->cancellable, 
diff --git a/daemon/trashlib/trashitem.c b/daemon/trashlib/trashitem.c
index 335e8d4..bcfc301 100644
--- a/daemon/trashlib/trashitem.c
+++ b/daemon/trashlib/trashitem.c
@@ -486,7 +486,9 @@ trash_item_delete (TrashItem  *item,
       temp_name = g_file_get_child (expunged, buffer);
 
       /* "restore" the item into the expunged folder */
-      if (trash_item_restore (item, temp_name, NULL))
+      if (trash_item_restore (item, temp_name,
+			      G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS,
+			      NULL))
         {
           trash_expunge (expunged);
           success = TRUE;
@@ -507,11 +509,11 @@ trash_item_delete (TrashItem  *item,
 gboolean
 trash_item_restore (TrashItem  *item,
                     GFile      *dest,
+		    GFileCopyFlags flags,
                     GError    **error)
 {
   if (g_file_move (item->file, dest,
-                   G_FILE_COPY_OVERWRITE |
-                   G_FILE_COPY_NOFOLLOW_SYMLINKS |
+		   flags |
                    G_FILE_COPY_NO_FALLBACK_FOR_MOVE,
                    NULL, NULL, NULL, error))
     {
diff --git a/daemon/trashlib/trashitem.h b/daemon/trashlib/trashitem.h
index 0fe0938..ad78202 100644
--- a/daemon/trashlib/trashitem.h
+++ b/daemon/trashlib/trashitem.h
@@ -54,6 +54,7 @@ gboolean        trash_item_delete            (TrashItem          *item,
                                               GError            **error);
 gboolean        trash_item_restore           (TrashItem          *item,
                                               GFile              *dest,
+					      GFileCopyFlags      flags,
                                               GError            **error);
 
 #endif /* _trashitem_h_ */



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