glocalfile: Add SMB on the list of remote filesystems

The G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE is set to TRUE only for NFS
filesystem types currently. Let's add also SMB filesystem types. This
also changes g_local_file_is_nfs_home function logic to handle only
NFS filesystems.
This commit is contained in:
Ondrej Holy 2020-06-15 17:43:49 +02:00
parent a8f97cbe8e
commit 92c9960521

View File

@ -2532,6 +2532,12 @@ is_remote_fs_type (const gchar *fsname)
return TRUE; return TRUE;
if (strcmp (fsname, "nfs4") == 0) if (strcmp (fsname, "nfs4") == 0)
return TRUE; return TRUE;
if (strcmp (fsname, "cifs") == 0)
return TRUE;
if (strcmp (fsname, "smb") == 0)
return TRUE;
if (strcmp (fsname, "smb2") == 0)
return TRUE;
} }
return FALSE; return FALSE;
@ -2540,7 +2546,7 @@ is_remote_fs_type (const gchar *fsname)
gboolean gboolean
g_local_file_is_nfs_home (const gchar *filename) g_local_file_is_nfs_home (const gchar *filename)
{ {
static gboolean remote_home; static gboolean remote_home = FALSE;
static gsize initialized; static gsize initialized;
const gchar *home; const gchar *home;
@ -2557,7 +2563,8 @@ g_local_file_is_nfs_home (const gchar *filename)
info = g_local_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, NULL); info = g_local_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, NULL);
if (info != NULL) if (info != NULL)
fs_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE); fs_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
remote_home = is_remote_fs_type (fs_type); if (g_strcmp0 (fs_type, "nfs") == 0 || g_strcmp0 (fs_type, "nfs4") == 0)
remote_home = TRUE;
g_clear_object (&info); g_clear_object (&info);
g_object_unref (file); g_object_unref (file);