diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-07-24 16:01:25 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-07-27 08:07:39 -0400 |
commit | 93bfec3ac525260a4a45b11fd321c43d2ee517fe (patch) | |
tree | 6d4571d14f0705656cd0f893fce53ee629cb3845 /gtk/gtkfilesystem.c | |
parent | 30de4cc7bbaa3d36ebfeb761582c9cc987635fc6 (diff) | |
download | gtk+-93bfec3ac525260a4a45b11fd321c43d2ee517fe.tar.gz |
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.
Diffstat (limited to 'gtk/gtkfilesystem.c')
-rw-r--r-- | gtk/gtkfilesystem.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 772618f3d0..baae74251d 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -921,3 +921,34 @@ _gtk_file_has_native_path (GFile *file) return has_native_path; } + +static const gchar * const remote_types[] = { + "sftp", + "webdav", + "ftp", + "nfs", + "cifs", + NULL +}; + +gboolean +_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); + } + else + is_remote = FALSE; + + return is_remote; +} |