[gtk+] gtkfilesystem: Improve heuristics to detect remote filesystem
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkfilesystem: Improve heuristics to detect remote filesystem
- Date: Tue, 28 Jun 2016 09:03:17 +0000 (UTC)
commit 0c1cc9832f091ae8606baa789b34759e166c6df0
Author: Ondrej Holy <oholy redhat com>
Date: Wed Jun 22 14:04:00 2016 +0200
gtkfilesystem: Improve heuristics to detect remote filesystem
Use G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE to detect remote filesystems
instead of hardcoded list of filesystem types.
Bump required GLib version accordingly.
https://bugzilla.gnome.org/show_bug.cgi?id=767965
configure.ac | 2 +-
gtk/gtkfilesystem.c | 21 ++-------------------
2 files changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dddd812..4971ad3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_major], [2])
m4_define([glib_required_minor], [49])
-m4_define([glib_required_micro], [1])
+m4_define([glib_required_micro], [3])
m4_define([glib_required_version],
[glib_required_major.glib_required_minor.glib_required_micro])
m4_define([glib_min_required_minor],
diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c
index aac300d..f6edb4e 100644
--- a/gtk/gtkfilesystem.c
+++ b/gtk/gtkfilesystem.c
@@ -902,33 +902,16 @@ _gtk_file_has_native_path (GFile *file)
return has_native_path;
}
-static const gchar * const remote_types[] = {
- "afp",
- "google-drive",
- "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);
+ info = g_file_query_filesystem_info (file, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE, NULL, NULL);
if (info)
{
- const gchar *type;
-
- type = g_file_info_get_attribute_string (info, "filesystem::type");
- if (type != NULL)
- is_remote = g_strv_contains (remote_types, type);
- else
- is_remote = FALSE;
+ is_remote = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE);
g_object_unref (info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]