[gvfs/wip/oholy/google-shared-drives-support: 42/43] google: Set G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE and _READ attributes




commit c01cc21c3b3a1f2223dd70ca0633580728d3bcf3
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Jan 29 14:50:19 2021 +0100

    google: Set G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE and _READ attributes
    
    The G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE and G_FILE_ATTRIBUTE_ACCESS_CAN_READ
    attributes are not set currently. Let's use the newly added libgdata API to
    set them.

 daemon/gvfsbackendgoogle.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 684a2e8a..8a5cf415 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -1312,6 +1312,10 @@ build_file_info (GVfsBackendGoogle      *self,
   g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
   g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, !is_root && !is_home && 
!is_shared_with_me_dir);
 
+  can_edit = gdata_documents_entry_can_edit (GDATA_DOCUMENTS_ENTRY (entry));
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, !is_root && 
!is_shared_with_me_dir && can_edit);
+  g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE);
+
   if (is_folder)
     {
       content_type = g_strdup ("inode/directory");


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