summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-10-21 07:18:21 +0000
committerOndrej Holy <oholy@redhat.com>2020-10-30 10:13:15 +0000
commit87e7c44a0773905db8603c718eba2e52cf109eb5 (patch)
tree68369b822d648d0a68dd5bd13cc571959a923e77
parent226f0dd44e78af04333452a9b3ef4a94cf6cce5f (diff)
downloadgvfs-87e7c44a0773905db8603c718eba2e52cf109eb5.tar.gz
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)
-rw-r--r--daemon/gvfsbackendgoogle.c16
1 files 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