[gvfs] Mark files as untrashable for main backends



commit 1a4e823966e31f72eedfec536cb150c629e126a7
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Aug 26 17:46:57 2015 +0200

    Mark files as untrashable for main backends
    
    Otherwise nautilus will offer the wrong action in its UI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753934

 daemon/gvfsafpserver.c   |    1 +
 daemon/gvfsbackendafc.c  |    2 ++
 daemon/gvfsbackendsftp.c |    2 ++
 daemon/gvfsbackendsmb.c  |    2 ++
 daemon/gvfsftpdircache.c |    2 ++
 5 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index 69e04b5..c10b66f 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -1507,6 +1507,7 @@ g_vfs_afp_server_fill_info (GVfsAfpServer *server,
   else
     g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR);
 
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
   
   start_pos = g_vfs_afp_reply_get_pos (reply);
 
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index d093cce..5762571 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -1641,6 +1641,8 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self,
 
   g_file_info_set_is_hidden (info, hidden);
 
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+
   /* Check for matching thumbnail in .MISC directory */
   if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_PREVIEW_ICON) &&
       self->mode == ACCESS_MODE_AFC &&
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index c301dc9..a9dc781 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -2501,6 +2501,8 @@ parse_attributes (GVfsBackendSftp *backend,
 
     }
 
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+
   g_file_info_set_file_type (info, type);
   
   if (flags & SSH_FILEXFER_ATTR_ACMODTIME)
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 5e75a73..de1161d 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1656,6 +1656,8 @@ set_info_from_stat (GVfsBackendSmb *backend,
   if (!(statbuf->st_mode & S_IWUSR) && S_ISREG (statbuf->st_mode))
     g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE);
 
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+
   g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, statbuf->st_atime);
 #if defined (HAVE_STRUCT_STAT_ST_ATIMENSEC)
   g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, statbuf->st_atimensec / 1000);
diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c
index 365b11b..b123e4e 100644
--- a/daemon/gvfsftpdircache.c
+++ b/daemon/gvfsftpdircache.c
@@ -693,6 +693,8 @@ g_vfs_ftp_dir_cache_funcs_process (GInputStream *        stream,
             g_debug ("# unknown listing format\n");
         }
 
+      g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
+
       if (file_type == G_FILE_TYPE_UNKNOWN)
         {
           file_type = type == 'f' ? G_FILE_TYPE_REGULAR :


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