mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-13 04:51:15 +00:00
file: Also use FS remote attribute in is_remote
Gio can provide us this info, so we can use this together with the checks nautilus already does. However, since there are many false-positives cases (like when using a fuse filesystem that is actually a remote mount, like sshfs or similar), we can't take this information as granted.
This commit is contained in:
parent
feadc9fee9
commit
99f55748ef
|
@ -4009,6 +4009,7 @@ got_filesystem_info (FilesystemInfoState *state,
|
|||
file->details->filesystem_readonly =
|
||||
g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
|
||||
filesystem_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
|
||||
file->details->filesystem_remote = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE);
|
||||
if (g_strcmp0 (eel_ref_str_peek (file->details->filesystem_type), filesystem_type) != 0)
|
||||
{
|
||||
eel_ref_str_unref (file->details->filesystem_type);
|
||||
|
@ -4091,7 +4092,8 @@ filesystem_info_start (NautilusDirectory *directory,
|
|||
g_file_query_filesystem_info_async (location,
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_READONLY ","
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW ","
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ","
|
||||
G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE,
|
||||
G_PRIORITY_DEFAULT,
|
||||
state->cancellable,
|
||||
query_filesystem_info_callback,
|
||||
|
|
|
@ -194,7 +194,8 @@ struct NautilusFileDetails
|
|||
eel_boolean_bit filesystem_readonly : 1;
|
||||
eel_boolean_bit filesystem_use_preview : 2; /* GFilesystemPreviewType */
|
||||
eel_boolean_bit filesystem_info_is_up_to_date : 1;
|
||||
eel_ref_str filesystem_type;
|
||||
eel_boolean_bit filesystem_remote : 1;
|
||||
eel_ref_str filesystem_type;
|
||||
|
||||
time_t trash_time; /* 0 is unknown */
|
||||
time_t recency; /* 0 is unknown */
|
||||
|
|
|
@ -4688,6 +4688,29 @@ nautilus_file_get_filesystem_type (NautilusFile *file)
|
|||
return filesystem_type;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_get_filesystem_remote (NautilusFile *file)
|
||||
{
|
||||
NautilusFile *parent;
|
||||
|
||||
g_assert (NAUTILUS_IS_FILE (file));
|
||||
|
||||
if (nautilus_file_is_directory (file))
|
||||
{
|
||||
return file->details->filesystem_remote;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = nautilus_file_get_parent (file);
|
||||
if (parent != NULL)
|
||||
{
|
||||
return parent->details->filesystem_remote;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_should_show_thumbnail (NautilusFile *file)
|
||||
{
|
||||
|
@ -8070,6 +8093,11 @@ nautilus_file_is_remote (NautilusFile *file)
|
|||
|
||||
g_assert (NAUTILUS_IS_FILE (file));
|
||||
|
||||
if (nautilus_file_get_filesystem_remote (file))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
filesystem_type = nautilus_file_get_filesystem_type (file);
|
||||
|
||||
return filesystem_type != NULL && g_strv_contains (remote_types, filesystem_type);
|
||||
|
|
|
@ -248,6 +248,8 @@ char * nautilus_file_get_filesystem_id (Nautilu
|
|||
|
||||
char * nautilus_file_get_filesystem_type (NautilusFile *file);
|
||||
|
||||
gboolean nautilus_file_get_filesystem_remote (NautilusFile *file);
|
||||
|
||||
NautilusFile * nautilus_file_get_trash_original_file (NautilusFile *file);
|
||||
|
||||
/* Permissions. */
|
||||
|
|
Loading…
Reference in a new issue