[gvfs/wip/oholy/google-display-name] google: Set the display name for the root folder also




commit 731bdbf7bf807c05eddd3a1559c01640d0dfe40e
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Oct 21 09:18:21 2020 +0200

    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

 daemon/gvfsbackendgoogle.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 27c9eba0..d3333281 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]