[glib] Add g_file_info_set_attribute_status
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [glib] Add g_file_info_set_attribute_status
- Date: Tue, 23 Jun 2009 11:07:08 -0400 (EDT)
commit 9a6146f54cdc085a42095b930066853dbb4e0c67
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 23 11:30:14 2009 +0200
Add g_file_info_set_attribute_status
Required for gvfs implementation for set_attribures_from_info.
gio/gfileinfo.c | 36 ++++++++++++++++++++++++++++++++++++
gio/gfileinfo.h | 3 +++
gio/gio.symbols | 1 +
3 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c
index 582e744..aed7975 100644
--- a/gio/gfileinfo.c
+++ b/gio/gfileinfo.c
@@ -679,6 +679,42 @@ g_file_info_get_attribute_status (GFileInfo *info,
return G_FILE_ATTRIBUTE_STATUS_UNSET;
}
+/**
+ * g_file_info_set_attribute_status:
+ * @info: a #GFileInfo
+ * @attribute: a file attribute key
+ * @status: a #GFileAttributeStatus
+ *
+ * Sets the attribute status for an attribute key. This is only
+ * needed by external code that implement g_file_set_attributes_from_info()
+ * or similar functions.
+ *
+ * The attribute must exist in @info for this to work. Otherwise %FALSE
+ * is returned and @info is unchanged.
+ *
+ * Returns: %TRUE if the status was changed, %FALSE if the key was not set.
+ *
+ * Since: 2.22
+ */
+gboolean
+g_file_info_set_attribute_status (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeStatus status)
+{
+ GFileAttributeValue *val;
+
+ g_return_val_if_fail (G_IS_FILE_INFO (info), 0);
+ g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
+
+ val = g_file_info_find_value_by_name (info, attribute);
+ if (val)
+ {
+ val->status = status;
+ return TRUE;
+ }
+
+ return FALSE;
+}
GFileAttributeValue *
_g_file_info_get_attribute_value (GFileInfo *info,
diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h
index 330e996..3fc5217 100644
--- a/gio/gfileinfo.h
+++ b/gio/gfileinfo.h
@@ -764,6 +764,9 @@ void g_file_info_remove_attribute (GFileInfo *info,
const char *attribute);
GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info,
const char *attribute);
+gboolean g_file_info_set_attribute_status (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeStatus status);
char * g_file_info_get_attribute_as_string (GFileInfo *info,
const char *attribute);
const char * g_file_info_get_attribute_string (GFileInfo *info,
diff --git a/gio/gio.symbols b/gio/gio.symbols
index d0200a2..2323c93 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -393,6 +393,7 @@ g_file_info_get_attribute_uint64
g_file_info_get_attribute_int64
g_file_info_get_attribute_object
g_file_info_get_attribute_stringv
+g_file_info_set_attribute_status
g_file_info_set_attribute
g_file_info_set_attribute_string
g_file_info_set_attribute_byte_string
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]