1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
27 #ifndef __G_FILE_ATTRIBUTE_H__
28 #define __G_FILE_ATTRIBUTE_H__
30 #include <glib-object.h>
36 * @G_FILE_ATTRIBUTE_TYPE_INVALID: indicates an invalid or uninitalized type.
37 * @G_FILE_ATTRIBUTE_TYPE_STRING: a null terminated UTF8 string.
38 * @G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: a zero terminated string of non-zero bytes.
39 * @G_FILE_ATTRIBUTE_TYPE_BOOLEAN: a boolean value.
40 * @G_FILE_ATTRIBUTE_TYPE_UINT32: an unsigned 4-byte/32-bit integer.
41 * @G_FILE_ATTRIBUTE_TYPE_INT32: a signed 4-byte/32-bit integer.
42 * @G_FILE_ATTRIBUTE_TYPE_UINT64: an unsigned 8-byte/64-bit integer.
43 * @G_FILE_ATTRIBUTE_TYPE_INT64: a signed 8-byte/64-bit integer.
44 * @G_FILE_ATTRIBUTE_TYPE_OBJECT: a #GObject.
46 * The data type for #GFileAttributeValue<!-- -->s.
49 G_FILE_ATTRIBUTE_TYPE_INVALID = 0,
50 G_FILE_ATTRIBUTE_TYPE_STRING,
51 G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, /* zero terminated string of non-zero bytes */
52 G_FILE_ATTRIBUTE_TYPE_BOOLEAN,
53 G_FILE_ATTRIBUTE_TYPE_UINT32,
54 G_FILE_ATTRIBUTE_TYPE_INT32,
55 G_FILE_ATTRIBUTE_TYPE_UINT64,
56 G_FILE_ATTRIBUTE_TYPE_INT64,
57 G_FILE_ATTRIBUTE_TYPE_OBJECT
61 * GFileAttributeInfoFlags:
62 * @G_FILE_ATTRIBUTE_INFO_NONE: no flags set.
63 * @G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE: copy the attribute values when the file is copied.
64 * @G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED: copy the attribute values when the file is moved.
66 * Flags specifying the behaviour of an attribute.
69 G_FILE_ATTRIBUTE_INFO_NONE = 0,
70 G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE = 1 << 0,
71 G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED = 1 << 1
72 } GFileAttributeInfoFlags;
75 * GFileAttributeStatus:
76 * @G_FILE_ATTRIBUTE_STATUS_UNSET: Attribute value is unset (empty).
77 * @G_FILE_ATTRIBUTE_STATUS_SET: Attribute value is set.
78 * @G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING: Indicates an error in setting the value.
80 * Used by g_file_set_attributes_from_info() when setting file attributes.
83 G_FILE_ATTRIBUTE_STATUS_UNSET = 0,
84 G_FILE_ATTRIBUTE_STATUS_SET,
85 G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING
86 } GFileAttributeStatus;
88 #define G_FILE_ATTRIBUTE_VALUE_INIT {0}
91 * GFileAttributeValue:
92 * @type: a #GFileAttributeType.
93 * @status: a #GFileAttributeStatus.
95 * Contains the value data for the Key-Value pair.
98 GFileAttributeType type : 8;
99 GFileAttributeStatus status : 8;
110 } GFileAttributeValue;
113 * GFileAttributeInfo:
114 * @name: the name of the attribute.
115 * @type: the #GFileAttributeType type of the attribute.
116 * @flags: a set of #GFileAttributeInfoFlags.
118 * Information about a specific attribute.
122 GFileAttributeType type;
123 GFileAttributeInfoFlags flags;
124 } GFileAttributeInfo;
127 * GFileAttributeInfoList:
128 * @infos: an array of #GFileAttributeInfo<!-- -->s.
129 * @n_infos: the number of values in the array.
131 * Acts as a lightweight registry for possible valid file attributes.
132 * The registry stores Key-Value pair formats as #GFileAttributeInfo<!-- -->s.
135 GFileAttributeInfo *infos;
137 } GFileAttributeInfoList;
139 GFileAttributeValue *g_file_attribute_value_new (void);
140 void g_file_attribute_value_free (GFileAttributeValue *attr);
141 void g_file_attribute_value_clear (GFileAttributeValue *attr);
142 void g_file_attribute_value_set (GFileAttributeValue *attr,
143 const GFileAttributeValue *new_value);
144 GFileAttributeValue *g_file_attribute_value_dup (const GFileAttributeValue *other);
146 char * g_file_attribute_value_as_string (const GFileAttributeValue *attr);
148 const char * g_file_attribute_value_get_string (const GFileAttributeValue *attr);
149 const char * g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr);
150 gboolean g_file_attribute_value_get_boolean (const GFileAttributeValue *attr);
151 guint32 g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr);
152 gint32 g_file_attribute_value_get_int32 (const GFileAttributeValue *attr);
153 guint64 g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr);
154 gint64 g_file_attribute_value_get_int64 (const GFileAttributeValue *attr);
155 GObject * g_file_attribute_value_get_object (const GFileAttributeValue *attr);
157 void g_file_attribute_value_set_string (GFileAttributeValue *attr,
159 void g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
161 void g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
163 void g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
165 void g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
167 void g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
169 void g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
171 void g_file_attribute_value_set_object (GFileAttributeValue *attr,
174 GFileAttributeInfoList * g_file_attribute_info_list_new (void);
175 GFileAttributeInfoList * g_file_attribute_info_list_ref (GFileAttributeInfoList *list);
176 void g_file_attribute_info_list_unref (GFileAttributeInfoList *list);
177 GFileAttributeInfoList * g_file_attribute_info_list_dup (GFileAttributeInfoList *list);
178 const GFileAttributeInfo *g_file_attribute_info_list_lookup (GFileAttributeInfoList *list,
180 void g_file_attribute_info_list_add (GFileAttributeInfoList *list,
182 GFileAttributeType type,
183 GFileAttributeInfoFlags flags);
188 #endif /* __G_FILE_INFO_H__ */