From 4b8ad50fc4463d72862d29a8802b5982e66c0fc2 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 29 Jun 2009 15:28:08 +0200 Subject: [PATCH] add g_file_attribute_set_*_by_id() and use them MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch and the previous ones fixes the performance issues noted in Bug 587089 – lookup_attribute() takes too much CPU It increases performance for querying attributes by ~15% in my tests. --- gio/gfileinfo-priv.h | 36 +++++++++- gio/gfileinfo.c | 183 +++++++++++++++++++++++++++++++++++++-------------- gio/glocalfileinfo.c | 96 +++++++++++++-------------- 3 files changed, 217 insertions(+), 98 deletions(-) diff --git a/gio/gfileinfo-priv.h b/gio/gfileinfo-priv.h index a318edb..10ada1d 100644 --- a/gio/gfileinfo-priv.h +++ b/gio/gfileinfo-priv.h @@ -97,8 +97,40 @@ #define G_FILE_ATTRIBUTE_ID_TRASH_ITEM_COUNT (15728640 + 1) -gboolean _g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher, - guint32 id); +gboolean _g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher, + guint32 id); + +void _g_file_info_set_attribute_by_id (GFileInfo *info, + guint32 attribute, + GFileAttributeType type, + gpointer value_p); +void _g_file_info_set_attribute_string_by_id (GFileInfo *info, + guint32 attribute, + const char *attr_value); +void _g_file_info_set_attribute_byte_string_by_id (GFileInfo *info, + guint32 attribute, + const char *attr_value); +void _g_file_info_set_attribute_boolean_by_id (GFileInfo *info, + guint32 attribute, + gboolean attr_value); +void _g_file_info_set_attribute_uint32_by_id (GFileInfo *info, + guint32 attribute, + guint32 attr_value); +void _g_file_info_set_attribute_int32_by_id (GFileInfo *info, + guint32 attribute, + gint32 attr_value); +void _g_file_info_set_attribute_uint64_by_id (GFileInfo *info, + guint32 attribute, + guint64 attr_value); +void _g_file_info_set_attribute_int64_by_id (GFileInfo *info, + guint32 attribute, + gint64 attr_value); +void _g_file_info_set_attribute_object_by_id (GFileInfo *info, + guint32 attribute, + GObject *attr_value); +void _g_file_info_set_attribute_stringv_by_id (GFileInfo *info, + guint32 attribute, + char **attr_value); #endif /* __G_FILE_INFO_PRIV_H__ */ diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c index 2cc4318..72ed959 100644 --- a/gio/gfileinfo.c +++ b/gio/gfileinfo.c @@ -1079,15 +1079,18 @@ g_file_info_create_value (GFileInfo *info, } } -static GFileAttributeValue * -g_file_info_create_value_by_name (GFileInfo *info, - const char *attribute) +void +_g_file_info_set_attribute_by_id (GFileInfo *info, + guint32 attribute, + GFileAttributeType type, + gpointer value_p) { - guint32 attr_id; + GFileAttributeValue *value; - attr_id = lookup_attribute (attribute); + value = g_file_info_create_value (info, attribute); - return g_file_info_create_value (info, attr_id); + if (value) + _g_file_attribute_value_set_from_pointer (value, type, value_p, TRUE); } /** @@ -1105,15 +1108,22 @@ g_file_info_set_attribute (GFileInfo *info, GFileAttributeType type, gpointer value_p) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_by_id (info, lookup_attribute (attribute), type, value_p); +} + +void +_g_file_info_set_attribute_object_by_id (GFileInfo *info, + guint32 attribute, + GObject *attr_value) +{ + GFileAttributeValue *value; + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_from_pointer (value, type, value_p, TRUE); + _g_file_attribute_value_set_object (value, attr_value); } /** @@ -1130,15 +1140,25 @@ g_file_info_set_attribute_object (GFileInfo *info, const char *attribute, GObject *attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); g_return_if_fail (G_IS_OBJECT (attr_value)); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_object_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_stringv_by_id (GFileInfo *info, + guint32 attribute, + char **attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_object (value, attr_value); + _g_file_attribute_value_set_stringv (value, attr_value); } /** @@ -1157,15 +1177,25 @@ g_file_info_set_attribute_stringv (GFileInfo *info, const char *attribute, char **attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); g_return_if_fail (attr_value != NULL); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_stringv_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_string_by_id (GFileInfo *info, + guint32 attribute, + const char *attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_stringv (value, attr_value); + _g_file_attribute_value_set_string (value, attr_value); } /** @@ -1182,15 +1212,25 @@ g_file_info_set_attribute_string (GFileInfo *info, const char *attribute, const char *attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); g_return_if_fail (attr_value != NULL); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_string_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_byte_string_by_id (GFileInfo *info, + guint32 attribute, + const char *attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_string (value, attr_value); + _g_file_attribute_value_set_byte_string (value, attr_value); } /** @@ -1207,15 +1247,25 @@ g_file_info_set_attribute_byte_string (GFileInfo *info, const char *attribute, const char *attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); g_return_if_fail (attr_value != NULL); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_byte_string_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_boolean_by_id (GFileInfo *info, + guint32 attribute, + gboolean attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_byte_string (value, attr_value); + _g_file_attribute_value_set_boolean (value, attr_value); } /** @@ -1232,14 +1282,24 @@ g_file_info_set_attribute_boolean (GFileInfo *info, const char *attribute, gboolean attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_boolean_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_uint32_by_id (GFileInfo *info, + guint32 attribute, + guint32 attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_boolean (value, attr_value); + _g_file_attribute_value_set_uint32 (value, attr_value); } /** @@ -1256,16 +1316,25 @@ g_file_info_set_attribute_uint32 (GFileInfo *info, const char *attribute, guint32 attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); - if (value) - _g_file_attribute_value_set_uint32 (value, attr_value); + _g_file_info_set_attribute_uint32_by_id (info, + lookup_attribute (attribute), + attr_value); } +void +_g_file_info_set_attribute_int32_by_id (GFileInfo *info, + guint32 attribute, + gint32 attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); + if (value) + _g_file_attribute_value_set_int32 (value, attr_value); +} /** * g_file_info_set_attribute_int32: @@ -1281,14 +1350,24 @@ g_file_info_set_attribute_int32 (GFileInfo *info, const char *attribute, gint32 attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_int32_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_uint64_by_id (GFileInfo *info, + guint32 attribute, + guint64 attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_int32 (value, attr_value); + _g_file_attribute_value_set_uint64 (value, attr_value); } /** @@ -1305,14 +1384,24 @@ g_file_info_set_attribute_uint64 (GFileInfo *info, const char *attribute, guint64 attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); + _g_file_info_set_attribute_uint64_by_id (info, + lookup_attribute (attribute), + attr_value); +} + +void +_g_file_info_set_attribute_int64_by_id (GFileInfo *info, + guint32 attribute, + gint64 attr_value) +{ + GFileAttributeValue *value; + + value = g_file_info_create_value (info, attribute); if (value) - _g_file_attribute_value_set_uint64 (value, attr_value); + _g_file_attribute_value_set_int64 (value, attr_value); } /** @@ -1330,14 +1419,12 @@ g_file_info_set_attribute_int64 (GFileInfo *info, const char *attribute, gint64 attr_value) { - GFileAttributeValue *value; - g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); - value = g_file_info_create_value_by_name (info, attribute); - if (value) - _g_file_attribute_value_set_int64 (value, attr_value); + _g_file_info_set_attribute_int64_by_id (info, + lookup_attribute (attribute), + attr_value); } /* Helper getters */ diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 3aa4acd..0c5b12c 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -215,7 +215,7 @@ get_selinux_context (const char *path, if (context) { - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_SELINUX_CONTEXT, context); freecon (context); } } @@ -855,18 +855,18 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher, /* FIXME: Windows: The underlyin _waccess() is mostly pointless */ if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_READ)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, - g_access (path, R_OK) == 0); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_READ, + g_access (path, R_OK) == 0); if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_WRITE)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, - g_access (path, W_OK) == 0); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_WRITE, + g_access (path, W_OK) == 0); if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_EXECUTE)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, - g_access (path, X_OK) == 0); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_EXECUTE, + g_access (path, X_OK) == 0); if (parent_info) @@ -892,16 +892,16 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher, } if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_RENAME)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, - writable); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_RENAME, + writable); if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_DELETE)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, - writable); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_DELETE, + writable); if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_TRASH)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, - writable && parent_info->has_trash_dir); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_TRASH, + writable && parent_info->has_trash_dir); } } @@ -936,52 +936,52 @@ set_info_from_stat (GFileInfo *info, g_file_info_set_file_type (info, file_type); g_file_info_set_size (info, statbuf->st_size); - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_DEVICE, statbuf->st_dev); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_DEVICE, statbuf->st_dev); #ifndef G_OS_WIN32 /* Pointless setting these on Windows even if they exist in the struct */ - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_INODE, statbuf->st_ino); - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_NLINK, statbuf->st_nlink); - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID, statbuf->st_uid); - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_GID, statbuf->st_gid); - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_RDEV, statbuf->st_rdev); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_INODE, statbuf->st_ino); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_NLINK, statbuf->st_nlink); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_UID, statbuf->st_uid); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_GID, statbuf->st_gid); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_RDEV, statbuf->st_rdev); #endif /* FIXME: st_mode is mostly pointless on Windows, too. Set the attribute or not? */ - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE, statbuf->st_mode); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_MODE, statbuf->st_mode); #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE, statbuf->st_blksize); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_BLOCK_SIZE, statbuf->st_blksize); #endif #if defined (HAVE_STRUCT_STAT_ST_BLOCKS) - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_BLOCKS, statbuf->st_blocks); - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE, - statbuf->st_blocks * G_GUINT64_CONSTANT (512)); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_BLOCKS, statbuf->st_blocks); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_ALLOCATED_SIZE, + statbuf->st_blocks * G_GUINT64_CONSTANT (512)); #endif - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, statbuf->st_mtime); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_MODIFIED, statbuf->st_mtime); #if defined (HAVE_STRUCT_STAT_ST_MTIMENSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, statbuf->st_mtimensec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_MODIFIED_USEC, statbuf->st_mtimensec / 1000); #elif defined (HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC, statbuf->st_mtim.tv_nsec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_MODIFIED_USEC, statbuf->st_mtim.tv_nsec / 1000); #endif - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, statbuf->st_atime); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_ACCESS, statbuf->st_atime); #if defined (HAVE_STRUCT_STAT_ST_ATIMENSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, statbuf->st_atimensec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_ACCESS_USEC, statbuf->st_atimensec / 1000); #elif defined (HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, statbuf->st_atim.tv_nsec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_ACCESS_USEC, statbuf->st_atim.tv_nsec / 1000); #endif - g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_CHANGED, statbuf->st_ctime); + _g_file_info_set_attribute_uint64_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED, statbuf->st_ctime); #if defined (HAVE_STRUCT_STAT_ST_CTIMENSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_CHANGED_USEC, statbuf->st_ctimensec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED_USEC, statbuf->st_ctimensec / 1000); #elif defined (HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC) - g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_CHANGED_USEC, statbuf->st_ctim.tv_nsec / 1000); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_TIME_CHANGED_USEC, statbuf->st_ctim.tv_nsec / 1000); #endif if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ETAG_VALUE)) { char *etag = _g_local_file_info_create_etag (statbuf); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_ETAG_VALUE, etag); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_ETAG_VALUE, etag); g_free (etag); } @@ -989,7 +989,7 @@ set_info_from_stat (GFileInfo *info, G_FILE_ATTRIBUTE_ID_ID_FILE)) { char *id = _g_local_file_info_create_file_id (statbuf); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILE, id); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_ID_FILE, id); g_free (id); } @@ -997,7 +997,7 @@ set_info_from_stat (GFileInfo *info, G_FILE_ATTRIBUTE_ID_ID_FILESYSTEM)) { char *id = _g_local_file_info_create_fs_id (statbuf); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM, id); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_ID_FILESYSTEM, id); g_free (id); } } @@ -1302,7 +1302,7 @@ get_thumbnail_attributes (const char *path, NULL); if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) - g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH, filename); + _g_file_info_set_attribute_byte_string_by_id (info, G_FILE_ATTRIBUTE_ID_THUMBNAIL_PATH, filename); else { g_free (filename); @@ -1313,7 +1313,7 @@ get_thumbnail_attributes (const char *path, NULL); if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_THUMBNAILING_FAILED, TRUE); } g_free (basename); g_free (filename); @@ -1517,16 +1517,16 @@ _g_local_file_info_get (const char *basename, if (basename != NULL && basename[strlen (basename) -1] == '~' && S_ISREG (statbuf.st_mode)) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP, TRUE); #else if (dos_attributes & FILE_ATTRIBUTE_HIDDEN) g_file_info_set_is_hidden (info, TRUE); if (dos_attributes & FILE_ATTRIBUTE_ARCHIVE) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_IS_ARCHIVE, TRUE); if (dos_attributes & FILE_ATTRIBUTE_SYSTEM) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_DOS_IS_SYSTEM, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_IS_SYSTEM, TRUE); #endif symlink_target = NULL; @@ -1569,7 +1569,7 @@ _g_local_file_info_get (const char *basename, { char *copy_name = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL); if (copy_name) - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_COPY_NAME, copy_name); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_COPY_NAME, copy_name); g_free (copy_name); } @@ -1639,7 +1639,7 @@ _g_local_file_info_get (const char *basename, if (content_type) { - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_FAST_CONTENT_TYPE, content_type); g_free (content_type); } } @@ -1655,7 +1655,7 @@ _g_local_file_info_get (const char *basename, name = get_username_from_uid (statbuf.st_uid); #endif if (name) - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_USER, name); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_OWNER_USER, name); g_free (name); } @@ -1669,7 +1669,7 @@ _g_local_file_info_get (const char *basename, name = get_realname_from_uid (statbuf.st_uid); #endif if (name) - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_USER_REAL, name); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_OWNER_USER_REAL, name); g_free (name); } @@ -1683,14 +1683,14 @@ _g_local_file_info_get (const char *basename, name = get_groupname_from_gid (statbuf.st_gid); #endif if (name) - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_OWNER_GROUP, name); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_OWNER_GROUP, name); g_free (name); } if (parent_info && parent_info->device != 0 && _g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_UNIX_IS_MOUNTPOINT) && statbuf.st_dev != parent_info->device) - g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT, TRUE); + _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_IS_MOUNTPOINT, TRUE); get_access_rights (attribute_matcher, info, path, &statbuf, parent_info); @@ -1776,7 +1776,7 @@ _g_local_file_info_get_from_fd (int fd, char *context; if (fgetfilecon_raw (fd, &context) >= 0) { - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context); + _g_file_info_set_attribute_string_by_id (info, G_FILE_ATTRIBUTE_ID_SELINUX_CONTEXT, context); freecon (context); } } -- 2.7.4