[gvfs/gnome-3-36] google: Set the display name for the root folder also



commit 87e7c44a0773905db8603c718eba2e52cf109eb5
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Oct 21 07:18:21 2020 +0000

    google: Set the display name for the root folder also
    
    As per the documentation, it is guaranteed that the display name attribute
    is always set. The same applies for the name attribute. However, this is
    not true for the root of the google backend. This sometimes causes file
    chooser crashes currently. Let's set those attributes also for root.
    
    Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/523
    
    
    (cherry picked from commit 731bdbf7bf807c05eddd3a1559c01640d0dfe40e)

 daemon/gvfsbackendgoogle.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index d4b074e2..57c447eb 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -1298,23 +1298,29 @@ build_file_info (GVfsBackendGoogle      *self,
 
   g_file_info_set_file_type (info, file_type);
 
-  if (is_root)
-    goto out;
-
   id = gdata_entry_get_id (entry);
   g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILE, id);
 
-  if (is_symlink)
+  if (is_root)
+    name = "/";
+  else if (is_symlink)
     name = symlink_name;
   else
     name = id;
 
   g_file_info_set_name (info, name);
 
-  title = gdata_entry_get_title (entry);
+  if (is_root)
+    title = g_vfs_backend_get_display_name (G_VFS_BACKEND (self));
+  else
+    title = gdata_entry_get_title (entry);
+
   g_file_info_set_display_name (info, title);
   g_file_info_set_edit_name (info, title);
 
+  if (is_root)
+    goto out;
+
   copy_name = generate_copy_name (self, entry, entry_path);
 
   /* Sanitize copy-name by replacing slashes with dashes. This is


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