[glib] fileinfo: Add G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute



commit e57355b055217b067cd1a71340f7ea47e51d4aae
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Jun 22 14:03:57 2016 +0200

    fileinfo: Add G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute
    
    Add filesystem attribute to detect remote filesystems in order to
    replace hardcoded filesystem types in GtkFileSystem. Set this attribute
    also for GLocalFile appropriately.
    
    Bump version to 2.49.3, so that early adopters of new API have a version
    number to target.

 configure.ac                        |    2 +-
 docs/reference/gio/gio-sections.txt |    1 +
 gio/gfileinfo.h                     |    9 +++++++++
 gio/glocalfile.c                    |    5 +++++
 4 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6e02df4..3d0daf2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ m4_define(glib_configure_ac)
 
 m4_define([glib_major_version], [2])
 m4_define([glib_minor_version], [49])
-m4_define([glib_micro_version], [2])
+m4_define([glib_micro_version], [3])
 m4_define([glib_interface_age], [0])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index e83c3c5..6207717 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -326,6 +326,7 @@ G_FILE_ATTRIBUTE_FILESYSTEM_FREE
 G_FILE_ATTRIBUTE_FILESYSTEM_USED
 G_FILE_ATTRIBUTE_FILESYSTEM_TYPE
 G_FILE_ATTRIBUTE_FILESYSTEM_READONLY
+G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE
 G_FILE_ATTRIBUTE_GVFS_BACKEND
 G_FILE_ATTRIBUTE_SELINUX_CONTEXT
 G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT
diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h
index cda63d6..c4bafb0 100644
--- a/gio/gfileinfo.h
+++ b/gio/gfileinfo.h
@@ -805,6 +805,15 @@ typedef struct _GFileInfoClass   GFileInfoClass;
 #define G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW "filesystem::use-preview"        /* uint32 
(GFilesystemPreviewType) */
 
 /**
+ * G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE:
+ *
+ * A key in the "filesystem" namespace for checking if the file system
+ * is remote. Is set to %TRUE if the file system is remote.
+ * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
+ **/
+#define G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE "filesystem::remote"                   /* boolean */
+
+/**
  * G_FILE_ATTRIBUTE_GVFS_BACKEND:
  *
  * A key in the "gvfs" namespace that gets the name of the current
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 0a1cadf..0698289 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1113,6 +1113,11 @@ g_local_file_query_filesystem_info (GFile         *file,
 #endif /* G_OS_WIN32 */
     }
   
+  if (g_file_attribute_matcher_matches (attribute_matcher,
+                                       G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE))
+      g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE,
+                                        g_local_file_is_remote (local->filename));
+
   g_file_attribute_matcher_unref (attribute_matcher);
   
   return info;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]