Add string vector attribute type to GFileInfo

This is needed for the new metadata backend since nautilus has a
string-list metadata type, and we want to use this for nautilus.
This commit is contained in:
Alexander Larsson
2009-06-22 19:25:32 +02:00
parent c1ab6454fe
commit 0ed9201ad2
6 changed files with 117 additions and 1 deletions

View File

@@ -751,6 +751,30 @@ g_file_info_get_attribute_byte_string (GFileInfo *info,
return _g_file_attribute_value_get_byte_string (value);
}
/**
* g_file_info_get_attribute_stringv:
* @info: a #GFileInfo.
* @attribute: a file attribute key.
*
* Gets the value of a stringv attribute. If the attribute does
* not contain a stringv, %NULL will be returned.
*
* Returns: the contents of the @attribute value as a stringv, or
* %NULL otherwise. Do not free.
**/
char **
g_file_info_get_attribute_stringv (GFileInfo *info,
const char *attribute)
{
GFileAttributeValue *value;
g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
g_return_val_if_fail (attribute != NULL && *attribute != '\0', NULL);
value = g_file_info_find_value_by_name (info, attribute);
return _g_file_attribute_value_get_stringv (value);
}
/**
* g_file_info_get_attribute_boolean:
* @info: a #GFileInfo.
@@ -960,6 +984,33 @@ g_file_info_set_attribute_object (GFileInfo *info,
_g_file_attribute_value_set_object (value, attr_value);
}
/**
* g_file_info_set_attribute_stringv:
* @info: a #GFileInfo.
* @attribute: a file attribute key.
* @attr_value: a %NULL terminated string array
*
* Sets the @attribute to contain the given @attr_value,
* if possible.
*
* Sinze: 2.22
**/
void
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);
if (value)
_g_file_attribute_value_set_stringv (value, attr_value);
}
/**
* g_file_info_set_attribute_string:
* @info: a #GFileInfo.