* @short_description: File Information and Attributes
* @include: gio/gio.h
* @see_also: #GFile, <link linkend="gio-GFileAttribute">GFileAttribute</link>
- *
+ *
* Functionality for manipulating basic metadata for files. #GFileInfo
- * implements methods for getting information that all files should
- * contain, and allows for manipulation of extended attributes.
+ * implements methods for getting information that all files should
+ * contain, and allows for manipulation of extended attributes.
*
* See <link linkend="gio-GFileAttribute">GFileAttribute</link> for more
* information on how GIO handles file attributes.
*
- * To obtain a #GFileInfo for a #GFile, use g_file_query_info() (or its
- * async variant). To obtain a #GFileInfo for a file input or output
- * stream, use g_file_input_stream_query_info() or
+ * To obtain a #GFileInfo for a #GFile, use g_file_query_info() (or its
+ * async variant). To obtain a #GFileInfo for a file input or output
+ * stream, use g_file_input_stream_query_info() or
* g_file_output_stream_query_info() (or their async variants).
*
- * To change the actual attributes of a file, you should then set the
- * attribute in the #GFileInfo and call g_file_set_attributes_from_info()
+ * To change the actual attributes of a file, you should then set the
+ * attribute in the #GFileInfo and call g_file_set_attributes_from_info()
* or g_file_set_attributes_async() on a GFile.
*
- * However, not all attributes can be changed in the file. For instance,
- * the actual size of a file cannot be changed via g_file_info_set_size().
- * You may call g_file_query_settable_attributes() and
- * g_file_query_writable_namespaces() to discover the settable attributes
+ * However, not all attributes can be changed in the file. For instance,
+ * the actual size of a file cannot be changed via g_file_info_set_size().
+ * You may call g_file_query_settable_attributes() and
+ * g_file_query_writable_namespaces() to discover the settable attributes
* of a particular file at runtime.
*
- * #GFileAttributeMatcher allows for searching through a #GFileInfo for
+ * #GFileAttributeMatcher allows for searching through a #GFileInfo for
* attributes.
**/
#include <string.h>
#include "gfileinfo.h"
+#include "gfileinfo-priv.h"
#include "gfileattribute-priv.h"
#include "gicon.h"
#include "glibintl.h"
-#include "gioalias.h"
/* We use this nasty thing, because NULL is a valid attribute matcher (matches nothing) */
#define NO_ATTRIBUTE_MASK ((GFileAttributeMatcher *)1)
};
-static gboolean g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher,
- guint32 id);
-
G_DEFINE_TYPE (GFileInfo, g_file_info, G_TYPE_OBJECT);
typedef struct {
}
static guint32
+_lookup_attribute (const char *attribute)
+{
+ guint32 attr_id, id;
+ char *ns;
+ const char *colon;
+ NSInfo *ns_info;
+
+ attr_id = GPOINTER_TO_UINT (g_hash_table_lookup (attribute_hash, attribute));
+
+ if (attr_id != 0)
+ return attr_id;
+
+ colon = strstr (attribute, "::");
+ if (colon)
+ ns = g_strndup (attribute, colon - attribute);
+ else
+ ns = g_strdup ("");
+
+ ns_info = _lookup_namespace (ns);
+ g_free (ns);
+
+ id = ++ns_info->attribute_id_counter;
+ attributes[ns_info->id] = g_realloc (attributes[ns_info->id], (id + 1) * sizeof (char *));
+ attributes[ns_info->id][id] = g_strdup (attribute);
+
+ attr_id = MAKE_ATTR_ID (ns_info->id, id);
+
+ g_hash_table_insert (attribute_hash, attributes[ns_info->id][id], GUINT_TO_POINTER (attr_id));
+
+ return attr_id;
+}
+
+static void
+ensure_attribute_hash (void)
+{
+ if (attribute_hash != NULL)
+ return;
+
+ ns_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ attribute_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+#define REGISTER_ATTRIBUTE(name) G_STMT_START{\
+ guint _u = _lookup_attribute (G_FILE_ATTRIBUTE_ ## name); \
+ /* use for generating the ID: g_print ("#define G_FILE_ATTRIBUTE_ID_%s (%u + %u)\n", #name + 17, _u & ~ID_MASK, _u & ID_MASK); */ \
+ g_assert (_u == G_FILE_ATTRIBUTE_ID_ ## name); \
+}G_STMT_END
+
+ REGISTER_ATTRIBUTE (STANDARD_TYPE);
+ REGISTER_ATTRIBUTE (STANDARD_IS_HIDDEN);
+ REGISTER_ATTRIBUTE (STANDARD_IS_BACKUP);
+ REGISTER_ATTRIBUTE (STANDARD_IS_SYMLINK);
+ REGISTER_ATTRIBUTE (STANDARD_IS_VIRTUAL);
+ REGISTER_ATTRIBUTE (STANDARD_NAME);
+ REGISTER_ATTRIBUTE (STANDARD_DISPLAY_NAME);
+ REGISTER_ATTRIBUTE (STANDARD_EDIT_NAME);
+ REGISTER_ATTRIBUTE (STANDARD_COPY_NAME);
+ REGISTER_ATTRIBUTE (STANDARD_DESCRIPTION);
+ REGISTER_ATTRIBUTE (STANDARD_ICON);
+ REGISTER_ATTRIBUTE (STANDARD_CONTENT_TYPE);
+ REGISTER_ATTRIBUTE (STANDARD_FAST_CONTENT_TYPE);
+ REGISTER_ATTRIBUTE (STANDARD_SIZE);
+ REGISTER_ATTRIBUTE (STANDARD_ALLOCATED_SIZE);
+ REGISTER_ATTRIBUTE (STANDARD_SYMLINK_TARGET);
+ REGISTER_ATTRIBUTE (STANDARD_TARGET_URI);
+ REGISTER_ATTRIBUTE (STANDARD_SORT_ORDER);
+ REGISTER_ATTRIBUTE (ETAG_VALUE);
+ REGISTER_ATTRIBUTE (ID_FILE);
+ REGISTER_ATTRIBUTE (ID_FILESYSTEM);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_READ);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_WRITE);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_EXECUTE);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_DELETE);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_TRASH);
+ REGISTER_ATTRIBUTE (ACCESS_CAN_RENAME);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_MOUNT);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_UNMOUNT);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_EJECT);
+ REGISTER_ATTRIBUTE (MOUNTABLE_UNIX_DEVICE);
+ REGISTER_ATTRIBUTE (MOUNTABLE_UNIX_DEVICE_FILE);
+ REGISTER_ATTRIBUTE (MOUNTABLE_HAL_UDI);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_START);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_START_DEGRADED);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_STOP);
+ REGISTER_ATTRIBUTE (MOUNTABLE_START_STOP_TYPE);
+ REGISTER_ATTRIBUTE (MOUNTABLE_CAN_POLL);
+ REGISTER_ATTRIBUTE (MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC);
+ REGISTER_ATTRIBUTE (TIME_MODIFIED);
+ REGISTER_ATTRIBUTE (TIME_MODIFIED_USEC);
+ REGISTER_ATTRIBUTE (TIME_ACCESS);
+ REGISTER_ATTRIBUTE (TIME_ACCESS_USEC);
+ REGISTER_ATTRIBUTE (TIME_CHANGED);
+ REGISTER_ATTRIBUTE (TIME_CHANGED_USEC);
+ REGISTER_ATTRIBUTE (TIME_CREATED);
+ REGISTER_ATTRIBUTE (TIME_CREATED_USEC);
+ REGISTER_ATTRIBUTE (UNIX_DEVICE);
+ REGISTER_ATTRIBUTE (UNIX_INODE);
+ REGISTER_ATTRIBUTE (UNIX_MODE);
+ REGISTER_ATTRIBUTE (UNIX_NLINK);
+ REGISTER_ATTRIBUTE (UNIX_UID);
+ REGISTER_ATTRIBUTE (UNIX_GID);
+ REGISTER_ATTRIBUTE (UNIX_RDEV);
+ REGISTER_ATTRIBUTE (UNIX_BLOCK_SIZE);
+ REGISTER_ATTRIBUTE (UNIX_BLOCKS);
+ REGISTER_ATTRIBUTE (UNIX_IS_MOUNTPOINT);
+ REGISTER_ATTRIBUTE (DOS_IS_ARCHIVE);
+ REGISTER_ATTRIBUTE (DOS_IS_SYSTEM);
+ REGISTER_ATTRIBUTE (OWNER_USER);
+ REGISTER_ATTRIBUTE (OWNER_USER_REAL);
+ REGISTER_ATTRIBUTE (OWNER_GROUP);
+ REGISTER_ATTRIBUTE (THUMBNAIL_PATH);
+ REGISTER_ATTRIBUTE (THUMBNAILING_FAILED);
+ REGISTER_ATTRIBUTE (PREVIEW_ICON);
+ REGISTER_ATTRIBUTE (FILESYSTEM_SIZE);
+ REGISTER_ATTRIBUTE (FILESYSTEM_FREE);
+ REGISTER_ATTRIBUTE (FILESYSTEM_TYPE);
+ REGISTER_ATTRIBUTE (FILESYSTEM_READONLY);
+ REGISTER_ATTRIBUTE (FILESYSTEM_USE_PREVIEW);
+ REGISTER_ATTRIBUTE (GVFS_BACKEND);
+ REGISTER_ATTRIBUTE (SELINUX_CONTEXT);
+ REGISTER_ATTRIBUTE (TRASH_ITEM_COUNT);
+ REGISTER_ATTRIBUTE (TRASH_ORIG_PATH);
+ REGISTER_ATTRIBUTE (TRASH_DELETION_DATE);
+
+#undef REGISTER_ATTRIBUTE
+}
+
+static guint32
lookup_namespace (const char *namespace)
{
NSInfo *ns_info;
G_LOCK (attribute_hash);
- if (attribute_hash == NULL)
- {
- ns_hash = g_hash_table_new (g_str_hash, g_str_equal);
- attribute_hash = g_hash_table_new (g_str_hash, g_str_equal);
- }
+ ensure_attribute_hash ();
ns_info = _lookup_namespace (namespace);
id = 0;
static guint32
lookup_attribute (const char *attribute)
{
- guint32 attr_id, id;
- char *ns;
- const char *colon;
- NSInfo *ns_info;
+ guint32 attr_id;
G_LOCK (attribute_hash);
- if (attribute_hash == NULL)
- {
- ns_hash = g_hash_table_new (g_str_hash, g_str_equal);
- attribute_hash = g_hash_table_new (g_str_hash, g_str_equal);
- }
-
- attr_id = GPOINTER_TO_UINT (g_hash_table_lookup (attribute_hash, attribute));
-
- if (attr_id != 0)
- {
- G_UNLOCK (attribute_hash);
- return attr_id;
- }
+ ensure_attribute_hash ();
- colon = strstr (attribute, "::");
- if (colon)
- ns = g_strndup (attribute, colon - attribute);
- else
- ns = g_strdup ("");
-
- ns_info = _lookup_namespace (ns);
- g_free (ns);
-
- id = ++ns_info->attribute_id_counter;
- attributes[ns_info->id] = g_realloc (attributes[ns_info->id], (id + 1) * sizeof (char *));
- attributes[ns_info->id][id] = g_strdup (attribute);
-
- attr_id = MAKE_ATTR_ID (ns_info->id, id);
-
- g_hash_table_insert (attribute_hash, attributes[ns_info->id][id], GUINT_TO_POINTER (attr_id));
+ attr_id = _lookup_attribute (attribute);
G_UNLOCK (attribute_hash);
attrs = (GFileAttribute *)info->attributes->data;
for (i = 0; i < info->attributes->len; i++)
_g_file_attribute_value_clear (&attrs[i].value);
- g_array_free (info->attributes, TRUE);
+ g_array_free (info->attributes, TRUE);
if (info->mask != NO_ATTRIBUTE_MASK)
g_file_attribute_matcher_unref (info->mask);
for (i = 0; i < info->attributes->len; i++)
{
attr = &g_array_index (info->attributes, GFileAttribute, i);
- if (!g_file_attribute_matcher_matches_id (mask,
+ if (!_g_file_attribute_matcher_matches_id (mask,
attr->attribute))
{
_g_file_attribute_value_clear (&attr->value);
*
* Lists the file info structure's attributes.
*
- * Returns: a null-terminated array of strings of all of the
+ * Returns: (array zero-terminated=1) (transfer full): a null-terminated array of strings of all of the
* possible attribute types for the given @name_space, or
* %NULL on error.
**/
* Gets the attribute type for an attribute key.
*
* Returns: a #GFileAttributeType for the given @attribute, or
- * %G_FILE_ATTRIBUTE_TYPE_INVALID if the key is invalid.
+ * %G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set.
**/
GFileAttributeType
g_file_info_get_attribute_type (GFileInfo *info,
* g_file_info_get_attribute_data:
* @info: a #GFileInfo
* @attribute: a file attribute key
- * @type: return location for the attribute type, or %NULL
- * @value_pp: return location for the attribute value, or %NULL
- * @status: return location for the attribute status, or %NULL
+ * @type: (out) (allow-none): return location for the attribute type, or %NULL
+ * @value_pp: (out) (allow-none): return location for the attribute value, or %NULL
+ * @status: (out) (allow-none): return location for the attribute status, or %NULL
*
* Gets the attribute type, value and status for an attribute key.
*
- * Returns: %TRUE if @info has an attribute named @attribute,
+ * Returns: (transfer none): %TRUE if @info has an attribute named @attribute,
* %FALSE otherwise.
*/
gboolean
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), FALSE);
+ g_return_val_if_fail (attribute != NULL && *attribute != '\0', FALSE);
+
+ 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,
* Gets the value of a #GObject attribute. If the attribute does
* not contain a #GObject, %NULL will be returned.
*
- * Returns: a #GObject associated with the given @attribute, or
+ * Returns: (transfer none): a #GObject associated with the given @attribute, or
* %NULL otherwise.
**/
GObject *
*
* Returns: the contents of the @attribute value as a stringv, or
* %NULL otherwise. Do not free.
+ *
+ * Since: 2.22
**/
char **
g_file_info_get_attribute_stringv (GFileInfo *info,
int i;
if (info->mask != NO_ATTRIBUTE_MASK &&
- !g_file_attribute_matcher_matches_id (info->mask, attr_id))
+ !_g_file_attribute_matcher_matches_id (info->mask, attr_id))
return NULL;
i = g_file_info_find_place (info, attr_id);
}
}
-static GFileAttributeValue *
-g_file_info_create_value_by_name (GFileInfo *info,
- const char *attribute)
+void
+_g_file_info_set_attribute_by_id (GFileInfo *info,
+ guint32 attribute,
+ GFileAttributeType type,
+ gpointer value_p)
{
- guint32 attr_id;
+ GFileAttributeValue *value;
- attr_id = lookup_attribute (attribute);
+ value = g_file_info_create_value (info, attribute);
- return g_file_info_create_value (info, attr_id);
+ if (value)
+ _g_file_attribute_value_set_from_pointer (value, type, value_p, TRUE);
}
/**
GFileAttributeType type,
gpointer value_p)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
+ _g_file_info_set_attribute_by_id (info, lookup_attribute (attribute), type, value_p);
+}
+void
+_g_file_info_set_attribute_object_by_id (GFileInfo *info,
+ guint32 attribute,
+ GObject *attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_from_pointer (value, type, value_p, TRUE);
+ _g_file_attribute_value_set_object (value, attr_value);
}
/**
const char *attribute,
GObject *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 (G_IS_OBJECT (attr_value));
- value = g_file_info_create_value_by_name (info, attribute);
+ _g_file_info_set_attribute_object_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_stringv_by_id (GFileInfo *info,
+ guint32 attribute,
+ char **attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_object (value, attr_value);
+ _g_file_attribute_value_set_stringv (value, attr_value);
}
/**
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);
+ _g_file_info_set_attribute_stringv_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_string_by_id (GFileInfo *info,
+ guint32 attribute,
+ const char *attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_stringv (value, attr_value);
+ _g_file_attribute_value_set_string (value, attr_value);
}
/**
const char *attribute,
const 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);
+ _g_file_info_set_attribute_string_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_byte_string_by_id (GFileInfo *info,
+ guint32 attribute,
+ const char *attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_string (value, attr_value);
+ _g_file_attribute_value_set_byte_string (value, attr_value);
}
/**
const char *attribute,
const 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);
+ _g_file_info_set_attribute_byte_string_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_boolean_by_id (GFileInfo *info,
+ guint32 attribute,
+ gboolean attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_byte_string (value, attr_value);
+ _g_file_attribute_value_set_boolean (value, attr_value);
}
/**
const char *attribute,
gboolean attr_value)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
+ _g_file_info_set_attribute_boolean_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_uint32_by_id (GFileInfo *info,
+ guint32 attribute,
+ guint32 attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_boolean (value, attr_value);
+ _g_file_attribute_value_set_uint32 (value, attr_value);
}
/**
const char *attribute,
guint32 attr_value)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
- if (value)
- _g_file_attribute_value_set_uint32 (value, attr_value);
+ _g_file_info_set_attribute_uint32_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
}
+void
+_g_file_info_set_attribute_int32_by_id (GFileInfo *info,
+ guint32 attribute,
+ gint32 attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
+ if (value)
+ _g_file_attribute_value_set_int32 (value, attr_value);
+}
/**
* g_file_info_set_attribute_int32:
const char *attribute,
gint32 attr_value)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
+ _g_file_info_set_attribute_int32_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_uint64_by_id (GFileInfo *info,
+ guint32 attribute,
+ guint64 attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_int32 (value, attr_value);
+ _g_file_attribute_value_set_uint64 (value, attr_value);
}
/**
const char *attribute,
guint64 attr_value)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
+ _g_file_info_set_attribute_uint64_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
+}
+
+void
+_g_file_info_set_attribute_int64_by_id (GFileInfo *info,
+ guint32 attribute,
+ gint64 attr_value)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_create_value (info, attribute);
if (value)
- _g_file_attribute_value_set_uint64 (value, attr_value);
+ _g_file_attribute_value_set_int64 (value, attr_value);
}
/**
const char *attribute,
gint64 attr_value)
{
- GFileAttributeValue *value;
-
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
- value = g_file_info_create_value_by_name (info, attribute);
- if (value)
- _g_file_attribute_value_set_int64 (value, attr_value);
+ _g_file_info_set_attribute_int64_by_id (info,
+ lookup_attribute (attribute),
+ attr_value);
}
/* Helper getters */
*
* Gets the icon for a file.
*
- * Returns: #GIcon for the given @info.
+ * Returns: (transfer none): #GIcon for the given @info.
**/
GIcon *
g_file_info_get_icon (GFileInfo *info)
g_array_append_val (matcher->more_sub_matchers, s);
}
+GType
+g_file_attribute_matcher_get_type (void)
+{
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_define_type_id__volatile))
+ {
+ GType g_define_type_id =
+ g_boxed_type_register_static (I_("GFileAttributeMatcher"),
+ (GBoxedCopyFunc) g_file_attribute_matcher_ref,
+ (GBoxedFreeFunc) g_file_attribute_matcher_unref);
+
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
/**
* g_file_attribute_matcher_new:
* @attributes: an attribute string to match.
return FALSE;
}
-static gboolean
-g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher,
- guint32 id)
+gboolean
+_g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher,
+ guint32 id)
{
/* We return a NULL matcher for an empty match string, so handle this */
if (matcher == NULL)
return get_attribute_for_id (sub_matcher->id);
}
}
-
-#define __G_FILE_INFO_C__
-#include "gioaliasdef.c"