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




commit 8d1e888352d359d41655ff98a76192311c24b6f7
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 cd41d61c..2716ad85 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]