Add g_file_info_set_attribute_status

Required for gvfs implementation for set_attribures_from_info.
This commit is contained in:
Alexander Larsson 2009-06-23 11:30:14 +02:00
parent becf4186e6
commit 9a6146f54c
3 changed files with 40 additions and 0 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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