guint64 uint64;
char *string;
GObject *obj;
+ char **stringv;
} u;
} GFileAttributeValue;
guint64 _g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr);
gint64 _g_file_attribute_value_get_int64 (const GFileAttributeValue *attr);
GObject * _g_file_attribute_value_get_object (const GFileAttributeValue *attr);
+char ** _g_file_attribute_value_get_stringv (const GFileAttributeValue *attr);
void _g_file_attribute_value_set_from_pointer(GFileAttributeValue *attr,
GFileAttributeType type,
gint64 value);
void _g_file_attribute_value_set_object (GFileAttributeValue *attr,
GObject *obj);
+void _g_file_attribute_value_set_stringv (GFileAttributeValue *attr,
+ char **value);
GFileAttributeValue *_g_file_info_get_attribute_value (GFileInfo *info,
attr->type == G_FILE_ATTRIBUTE_TYPE_BYTE_STRING)
g_free (attr->u.string);
+ if (attr->type == G_FILE_ATTRIBUTE_TYPE_STRINGV)
+ g_strfreev (attr->u.stringv);
+
if (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT &&
attr->u.obj != NULL)
g_object_unref (attr->u.obj);
attr->type == G_FILE_ATTRIBUTE_TYPE_BYTE_STRING)
attr->u.string = g_strdup (attr->u.string);
+ if (attr->type == G_FILE_ATTRIBUTE_TYPE_STRINGV)
+ attr->u.stringv = g_strdupv (attr->u.stringv);
+
if (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT &&
attr->u.obj != NULL)
g_object_ref (attr->u.obj);
case G_FILE_ATTRIBUTE_TYPE_STRING:
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
return attr->u.string;
+ case G_FILE_ATTRIBUTE_TYPE_STRINGV:
+ return attr->u.stringv;
case G_FILE_ATTRIBUTE_TYPE_OBJECT:
return attr->u.obj;
default:
char *
_g_file_attribute_value_as_string (const GFileAttributeValue *attr)
{
+ GString *s;
+ int i;
char *str;
g_return_val_if_fail (attr != NULL, NULL);
case G_FILE_ATTRIBUTE_TYPE_STRING:
str = g_strdup (attr->u.string);
break;
+ case G_FILE_ATTRIBUTE_TYPE_STRINGV:
+ s = g_string_new ("[");
+ for (i = 0; attr->u.stringv[i] != NULL; i++)
+ {
+ g_string_append (s, attr->u.stringv[i]);
+ if (attr->u.stringv[i+1] != NULL)
+ g_string_append (s, ", ");
+ }
+ g_string_append (s, "]");
+ str = g_string_free (s, FALSE);
+ break;
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
str = escape_byte_string (attr->u.string);
break;
return attr->u.string;
}
+char **
+_g_file_attribute_value_get_stringv (const GFileAttributeValue *attr)
+{
+ if (attr == NULL)
+ return NULL;
+
+ g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_STRINGV, NULL);
+
+ return attr->u.stringv;
+}
+
/*
* _g_file_attribute_value_get_boolean:
* @attr: a #GFileAttributeValue.
value->u.string = value_p;
break;
+ case G_FILE_ATTRIBUTE_TYPE_STRINGV:
+ if (dup)
+ value->u.stringv = g_strdupv (value_p);
+ else
+ value->u.stringv = value_p;
+ break;
+
case G_FILE_ATTRIBUTE_TYPE_OBJECT:
if (dup)
value->u.obj = g_object_ref (value_p);
attr->u.string = g_strdup (string);
}
+void
+_g_file_attribute_value_set_stringv (GFileAttributeValue *attr,
+ char **value)
+{
+ g_return_if_fail (attr != NULL);
+ g_return_if_fail (value != NULL);
+
+ _g_file_attribute_value_clear (attr);
+ attr->type = G_FILE_ATTRIBUTE_TYPE_STRINGV;
+ attr->u.stringv = g_strdupv (value);
+}
+
+
/*
* _g_file_attribute_value_set_boolean:
* @attr: a #GFileAttributeValue.
}
/**
+ * 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.
* @attribute: a file attribute key.
}
/**
+ * 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.
* @attribute: a file attribute key.
const char *attribute);
GObject * g_file_info_get_attribute_object (GFileInfo *info,
const char *attribute);
+char ** g_file_info_get_attribute_stringv (GFileInfo *info,
+ const char *attribute);
void g_file_info_set_attribute (GFileInfo *info,
const char *attribute,
void g_file_info_set_attribute_object (GFileInfo *info,
const char *attribute,
GObject *attr_value);
+void g_file_info_set_attribute_stringv (GFileInfo *info,
+ const char *attribute,
+ char **attr_value);
void g_file_info_clear_status (GFileInfo *info);
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
g_file_info_set_attribute_string
g_file_info_set_attribute_byte_string
g_file_info_set_attribute_uint64
g_file_info_set_attribute_int64
g_file_info_set_attribute_object
+g_file_info_set_attribute_stringv
g_file_info_clear_status
g_file_info_get_file_type
g_file_info_get_is_hidden
* @G_FILE_ATTRIBUTE_TYPE_UINT64: an unsigned 8-byte/64-bit integer.
* @G_FILE_ATTRIBUTE_TYPE_INT64: a signed 8-byte/64-bit integer.
* @G_FILE_ATTRIBUTE_TYPE_OBJECT: a #GObject.
+ * @G_FILE_ATTRIBUTE_TYPE_STRINGV: a %NULL terminated char **. Since 2.22
*
* The data types for file attributes.
**/
G_FILE_ATTRIBUTE_TYPE_INT32,
G_FILE_ATTRIBUTE_TYPE_UINT64,
G_FILE_ATTRIBUTE_TYPE_INT64,
- G_FILE_ATTRIBUTE_TYPE_OBJECT
+ G_FILE_ATTRIBUTE_TYPE_OBJECT,
+ G_FILE_ATTRIBUTE_TYPE_STRINGV
} GFileAttributeType;