Commit 93bfec3a authored by Matthias Clasen's avatar Matthias Clasen

Add a helper function for remote locations

Add a helper function that says whether a location should be
considered remote. To determine this, we look at the filesystem
type reported by gvfs, and say 'remote' for sftp, webdav, ftp,
nfs and cifs.
parent 30de4cc7
......@@ -921,3 +921,34 @@ _gtk_file_has_native_path (GFile *file)
return has_native_path;
static const gchar * const remote_types[] = {
_gtk_file_consider_as_remote (GFile *file)
GFileInfo *info;
gboolean is_remote;
info = g_file_query_filesystem_info (file, "filesystem::type", NULL, NULL);
if (info)
const gchar *type;
type = g_file_info_get_attribute_string (info, "filesystem::type");
is_remote = g_strv_contains (remote_types, type);
g_object_unref (info);
is_remote = FALSE;
return is_remote;
......@@ -118,6 +118,8 @@ gboolean _gtk_file_info_consider_as_directory (GFileInfo *info);
/* GFile helper functions */
gboolean _gtk_file_has_native_path (GFile *file);
gboolean _gtk_file_consider_as_remote (GFile *file);
#endif /* __GTK_FILE_SYSTEM_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment