diff options
author | Ondrej Holy <oholy@redhat.com> | 2015-10-15 16:08:34 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2015-10-16 09:05:19 +0200 |
commit | 3aade766e1793bbf3ba2ecd29aba44d0467a0c6d (patch) | |
tree | 288bec6a76745fb526aabbb9e360054b3ac69935 | |
parent | e65c48683510f6a069628029bf07c15041af2074 (diff) | |
download | gvfs-3aade766e1793bbf3ba2ecd29aba44d0467a0c6d.tar.gz |
google: Mark files you can't see on the web as hidden
Files without the parent are currently shown in google backend root.
You can see many files consequently, which are not shown in your google
drive folder on the web. Those files can be shared with you, or you
opened them in some google applications (i.e. google docs). Mark those
files as hidden to see same files as you can see on the web. Also mark
the files as undeletable, because it is not possible to delete them
from the obvious reason.
https://bugzilla.gnome.org/show_bug.cgi?id=756644
-rw-r--r-- | daemon/gvfsbackendgoogle.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c index 099be282..0acec9a3 100644 --- a/daemon/gvfsbackendgoogle.c +++ b/daemon/gvfsbackendgoogle.c @@ -886,8 +886,10 @@ build_file_info (GVfsBackendGoogle *self, { GFileType file_type; GList *authors; + GList *links; gboolean is_folder = FALSE; gboolean is_root = FALSE; + gboolean has_parent = FALSE; const gchar *etag; const gchar *id; const gchar *name; @@ -907,7 +909,9 @@ build_file_info (GVfsBackendGoogle *self, if (entry == self->root) is_root = TRUE; - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, !is_root); + links = gdata_entry_look_up_links (entry, GDATA_LINK_PARENT); + has_parent = (links != NULL); + g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, !is_root); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, is_folder); @@ -916,6 +920,9 @@ build_file_info (GVfsBackendGoogle *self, g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE, is_symlink); 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 && has_parent); + + g_file_info_set_is_hidden (info, !has_parent); if (is_folder) { @@ -1079,6 +1086,7 @@ build_file_info (GVfsBackendGoogle *self, g_free (generated_copy_name); g_free (escaped_name); g_free (content_type); + g_list_free (links); } /* ---------------------------------------------------------------------------------------------------- */ |