+2007-12-14 Alexander Larsson <alexl@redhat.com>
+
+ * Makefile.am:
+ * gfileattribute.[ch]:
+ * gfileattribute-priv.h:
+ Move GFileAttributeValue to a private header, as
+ its sort of ugly.
+
+ * gfile.[ch]:
+ Make set_attribute take a type + a pointer instead
+ of a GFileAttributeValue.
+
+ * gfileinfo.[ch]:
+ Fix up for above changes.
+ Add g_file_info_get_attribute_data to get
+ all info in one call, g_file_info_get_attribute_status
+ to get the status and g_file_info_get_attribute_as_string.
+
+ * gio.symbols:
+ * glocalfile.c:
+ * glocalfileinfo.[ch]:
+ Update for changes
+
+ * gunixmounts.c:
+ Make _guess_type static.
+
2007-12-14 Yevgen Muntyan <muntyan@tamu.edu>
* Makefile.am:
gdummyfile.c \
gfile.c \
gfileattribute.c \
+ gfileattribute-priv.h \
gfileenumerator.c \
gfileicon.c \
gfileinfo.c \
#include "gioscheduler.h"
#include <glocalfile.h>
#include "gsimpleasyncresult.h"
+#include "gfileattribute-priv.h"
#include "gpollfilemonitor.h"
#include "glibintl.h"
* g_file_set_attribute:
* @file: input #GFile.
* @attribute: a string containing the attribute's name.
- * @value: a set of #GFileAttributeValue.
+ * @type: The type of the attribute
+ * @value_p: a pointer to the value (or the pointer itself if the type is a pointer type)
* @flags: a set of #GFileQueryInfoFlags.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: a #GError, or %NULL
gboolean
g_file_set_attribute (GFile *file,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error)
return FALSE;
}
- return (* iface->set_attribute) (file, attribute, value, flags, cancellable, error);
+ return (* iface->set_attribute) (file, attribute, type, value_p, flags, cancellable, error);
}
/**
for (i = 0; attributes[i] != NULL; i++)
{
- value = (GFileAttributeValue *)g_file_info_get_attribute (info, attributes[i]);
+ value = _g_file_info_get_attribute_value (info, attributes[i]);
if (value->status != G_FILE_ATTRIBUTE_STATUS_UNSET)
continue;
- if (!g_file_set_attribute (file, attributes[i], value, flags, cancellable, error))
+ if (!g_file_set_attribute (file, attributes[i],
+ value->type, _g_file_attribute_value_peek_as_pointer (value),
+ flags, cancellable, error))
{
value->status = G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING;
res = FALSE;
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_STRING;
- v.u.string = (char *)value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_STRING, (gpointer)value,
+ flags, cancellable, error);
}
/**
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_BYTE_STRING;
- v.u.string = (char *)value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, (gpointer)value,
+ flags, cancellable, error);
}
/**
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_UINT32;
- v.u.uint32 = value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_UINT32, &value,
+ flags, cancellable, error);
}
/**
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_INT32;
- v.u.int32 = value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_INT32, &value,
+ flags, cancellable, error);
}
/**
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_UINT64;
- v.u.uint64 = value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_UINT64, &value,
+ flags, cancellable, error);
}
/**
GCancellable *cancellable,
GError **error)
{
- GFileAttributeValue v;
-
- v.type = G_FILE_ATTRIBUTE_TYPE_INT64;
- v.u.int64 = value;
- return g_file_set_attribute (file, attribute, &v, flags, cancellable, error);
+ return g_file_set_attribute (file, attribute,
+ G_FILE_ATTRIBUTE_TYPE_INT64, &value,
+ flags, cancellable, error);
}
/**
gboolean (*set_attribute) (GFile *file,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error);
GError **error);
gboolean g_file_set_attribute (GFile *file,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error);
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright (C) 2006-2007 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef __G_FILE_ATTRIBUTE_PRIV_H__
+#define __G_FILE_ATTRIBUTE_PRIV_H__
+
+#include "gfileattribute.h"
+#include "gfileinfo.h"
+
+#define G_FILE_ATTRIBUTE_VALUE_INIT {0}
+
+typedef struct {
+ GFileAttributeType type : 8;
+ GFileAttributeStatus status : 8;
+ union {
+ gboolean boolean;
+ gint32 int32;
+ guint32 uint32;
+ gint64 int64;
+ guint64 uint64;
+ char *string;
+ GObject *obj;
+ } u;
+} GFileAttributeValue;
+
+GFileAttributeValue *_g_file_attribute_value_new (void);
+void _g_file_attribute_value_free (GFileAttributeValue *attr);
+void _g_file_attribute_value_clear (GFileAttributeValue *attr);
+void _g_file_attribute_value_set (GFileAttributeValue *attr,
+ const GFileAttributeValue *new_value);
+GFileAttributeValue *_g_file_attribute_value_dup (const GFileAttributeValue *other);
+gpointer _g_file_attribute_value_peek_as_pointer (GFileAttributeValue *attr);
+
+char * _g_file_attribute_value_as_string (const GFileAttributeValue *attr);
+
+const char * _g_file_attribute_value_get_string (const GFileAttributeValue *attr);
+const char * _g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr);
+gboolean _g_file_attribute_value_get_boolean (const GFileAttributeValue *attr);
+guint32 _g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr);
+gint32 _g_file_attribute_value_get_int32 (const GFileAttributeValue *attr);
+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);
+
+void _g_file_attribute_value_set_from_pointer(GFileAttributeValue *attr,
+ GFileAttributeType type,
+ gpointer value_p,
+ gboolean dup);
+void _g_file_attribute_value_set_string (GFileAttributeValue *attr,
+ const char *string);
+void _g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
+ const char *string);
+void _g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
+ gboolean value);
+void _g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
+ guint32 value);
+void _g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
+ gint32 value);
+void _g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
+ guint64 value);
+void _g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
+ gint64 value);
+void _g_file_attribute_value_set_object (GFileAttributeValue *attr,
+ GObject *obj);
+
+
+GFileAttributeValue *_g_file_info_get_attribute_value (GFileInfo *info,
+ const char *attribute);
+
+#endif /* __G_FILE_ATTRIBUTE_PRIV_H__ */
#include <string.h>
#include "gfileattribute.h"
+#include "gfileattribute-priv.h"
#include <glib-object.h>
#include "glibintl.h"
*
**/
-/**
- * g_file_attribute_value_free:
+/*
+ * _g_file_attribute_value_free:
* @attr: a #GFileAttributeValue.
*
* Frees the memory used by @attr.
*
**/
void
-g_file_attribute_value_free (GFileAttributeValue *attr)
+_g_file_attribute_value_free (GFileAttributeValue *attr)
{
g_return_if_fail (attr != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
g_free (attr);
}
-/**
- * g_file_attribute_value_clear:
+/*
+ * _g_file_attribute_value_clear:
* @attr: a #GFileAttributeValue.
*
* Clears the value of @attr and sets its type to
*
**/
void
-g_file_attribute_value_clear (GFileAttributeValue *attr)
+_g_file_attribute_value_clear (GFileAttributeValue *attr)
{
g_return_if_fail (attr != NULL);
attr->type = G_FILE_ATTRIBUTE_TYPE_INVALID;
}
-/**
+/*
* g_file_attribute_value_set:
* @attr: a #GFileAttributeValue to set the value in.
* @new_value: a #GFileAttributeValue to get the value from.
* Sets an attribute's value from another attribute.
**/
void
-g_file_attribute_value_set (GFileAttributeValue *attr,
- const GFileAttributeValue *new_value)
+_g_file_attribute_value_set (GFileAttributeValue *attr,
+ const GFileAttributeValue *new_value)
{
g_return_if_fail (attr != NULL);
g_return_if_fail (new_value != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
*attr = *new_value;
if (attr->type == G_FILE_ATTRIBUTE_TYPE_STRING ||
g_object_ref (attr->u.obj);
}
-/**
- * g_file_attribute_value_new:
+/*
+ * _g_file_attribute_value_new:
*
* Creates a new file attribute.
*
* Returns: a #GFileAttributeValue.
**/
GFileAttributeValue *
-g_file_attribute_value_new (void)
+_g_file_attribute_value_new (void)
{
GFileAttributeValue *attr;
return attr;
}
+gpointer
+_g_file_attribute_value_peek_as_pointer (GFileAttributeValue *attr)
+{
+ switch (attr->type) {
+ case G_FILE_ATTRIBUTE_TYPE_STRING:
+ case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
+ return attr->u.string;
+ case G_FILE_ATTRIBUTE_TYPE_OBJECT:
+ return attr->u.obj;
+ default:
+ return (gpointer) &attr->u;
+ }
+}
-/**
+/*
* g_file_attribute_value_dup:
* @other: a #GFileAttributeValue to duplicate.
*
* Returns: a duplicate of the @other.
**/
GFileAttributeValue *
-g_file_attribute_value_dup (const GFileAttributeValue *other)
+_g_file_attribute_value_dup (const GFileAttributeValue *other)
{
GFileAttributeValue *attr;
attr = g_new (GFileAttributeValue, 1);
attr->type = G_FILE_ATTRIBUTE_TYPE_INVALID;
- g_file_attribute_value_set (attr, other);
+ _g_file_attribute_value_set (attr, other);
return attr;
}
}
}
-/**
+/*
* g_file_attribute_value_as_string:
* @attr: a #GFileAttributeValue.
*
* if @attr is of type %G_FILE_ATTRIBUTE_TYPE_INVALID.
**/
char *
-g_file_attribute_value_as_string (const GFileAttributeValue *attr)
+_g_file_attribute_value_as_string (const GFileAttributeValue *attr)
{
char *str;
return str;
}
-/**
+/*
* g_file_attribute_value_get_string:
* @attr: a #GFileAttributeValue.
*
* Returns: the string value contained within the attribute, or %NULL.
**/
const char *
-g_file_attribute_value_get_string (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_string (const GFileAttributeValue *attr)
{
if (attr == NULL)
return NULL;
return attr->u.string;
}
-/**
+/*
* g_file_attribute_value_get_byte_string:
* @attr: a #GFileAttributeValue.
*
* Returns: the byte string contained within the attribute or %NULL.
**/
const char *
-g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr)
{
if (attr == NULL)
return NULL;
return attr->u.string;
}
-/**
+/*
* g_file_attribute_value_get_boolean:
* @attr: a #GFileAttributeValue.
*
* Returns: the boolean value contained within the attribute, or %FALSE.
**/
gboolean
-g_file_attribute_value_get_boolean (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_boolean (const GFileAttributeValue *attr)
{
if (attr == NULL)
return FALSE;
return attr->u.boolean;
}
-/**
+/*
* g_file_attribute_value_get_uint32:
* @attr: a #GFileAttributeValue.
*
* Returns: the unsigned 32-bit integer from the attribute, or %0.
**/
guint32
-g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr)
{
if (attr == NULL)
return 0;
return attr->u.uint32;
}
-/**
+/*
* g_file_attribute_value_get_int32:
* @attr: a #GFileAttributeValue.
*
* Returns: the signed 32-bit integer from the attribute, or %0.
**/
gint32
-g_file_attribute_value_get_int32 (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_int32 (const GFileAttributeValue *attr)
{
if (attr == NULL)
return 0;
return attr->u.int32;
}
-/**
+/*
* g_file_attribute_value_get_uint64:
* @attr: a #GFileAttributeValue.
*
* Returns: the unsigned 64-bit integer from the attribute, or %0.
**/
guint64
-g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr)
{
if (attr == NULL)
return 0;
return attr->u.uint64;
}
-/**
+/*
* g_file_attribute_value_get_int64:
* @attr: a #GFileAttributeValue.
*
* Returns: the signed 64-bit integer from the attribute, or %0.
**/
gint64
-g_file_attribute_value_get_int64 (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_int64 (const GFileAttributeValue *attr)
{
if (attr == NULL)
return 0;
return attr->u.int64;
}
-/**
+/*
* g_file_attribute_value_get_object:
* @attr: a #GFileAttributeValue.
*
* Returns: the GObject from the attribute, or %0.
**/
GObject *
-g_file_attribute_value_get_object (const GFileAttributeValue *attr)
+_g_file_attribute_value_get_object (const GFileAttributeValue *attr)
{
if (attr == NULL)
return NULL;
return attr->u.obj;
}
+
+
+void
+_g_file_attribute_value_set_from_pointer (GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
+ gboolean dup)
+{
+ _g_file_attribute_value_clear (value);
+ value->type = type;
+ switch (type)
+ {
+ case G_FILE_ATTRIBUTE_TYPE_STRING:
+ case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
+ if (dup)
+ value->u.string = g_strdup (value_p);
+ else
+ value->u.string = value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_OBJECT:
+ if (dup)
+ value->u.obj = g_object_ref (value_p);
+ else
+ value->u.obj = value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
+ value->u.boolean = *(gboolean *)value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_UINT32:
+ value->u.uint32 = *(guint32 *)value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_INT32:
+ value->u.int32 = *(gint32 *)value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_UINT64:
+ value->u.uint64 = *(guint64 *)value_p;
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_INT64:
+ value->u.int64 = *(gint64 *)value_p;
+ break;
+ default:
+ g_warning ("Unknown type specified in g_file_info_set_attribute\n");
+ break;
+ }
+}
-/**
+/*
* g_file_attribute_value_set_string:
* @attr: a #GFileAttributeValue.
* @string: a string to set within the type.
*
**/
void
-g_file_attribute_value_set_string (GFileAttributeValue *attr,
- const char *string)
+_g_file_attribute_value_set_string (GFileAttributeValue *attr,
+ const char *string)
{
g_return_if_fail (attr != NULL);
g_return_if_fail (string != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_STRING;
attr->u.string = g_strdup (string);
}
-/**
+/*
* g_file_attribute_value_set_byte_string:
* @attr: a #GFileAttributeValue.
* @string: a byte string to set within the type.
*
**/
void
-g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
- const char *string)
+_g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
+ const char *string)
{
g_return_if_fail (attr != NULL);
g_return_if_fail (string != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_BYTE_STRING;
attr->u.string = g_strdup (string);
}
-/**
+/*
* g_file_attribute_value_set_boolean:
* @attr: a #GFileAttributeValue.
* @value: a #gboolean to set within the type.
*
**/
void
-g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
- gboolean value)
+_g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
+ gboolean value)
{
g_return_if_fail (attr != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_BOOLEAN;
attr->u.boolean = !!value;
}
-/**
+/*
* g_file_attribute_value_set_uint32:
* @attr: a #GFileAttributeValue.
* @value: a #guint32 to set within the type.
*
**/
void
-g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
- guint32 value)
+_g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
+ guint32 value)
{
g_return_if_fail (attr != NULL);
-
- g_file_attribute_value_clear (attr);
+
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_UINT32;
attr->u.uint32 = value;
}
-/**
+/*
* g_file_attribute_value_set_int32:
* @attr: a #GFileAttributeValue.
* @value: a #gint32 to set within the type.
*
**/
void
-g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
- gint32 value)
+_g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
+ gint32 value)
{
g_return_if_fail (attr != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_INT32;
attr->u.int32 = value;
}
-/**
+/*
* g_file_attribute_value_set_uint64:
* @attr: a #GFileAttributeValue.
* @value: a #guint64 to set within the type.
*
**/
void
-g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
- guint64 value)
+_g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
+ guint64 value)
{
g_return_if_fail (attr != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_UINT64;
attr->u.uint64 = value;
}
-/**
+/*
* g_file_attribute_value_set_int64:
* @attr: a #GFileAttributeValue.
* @value: a #gint64 to set within the type.
*
**/
void
-g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
- gint64 value)
+_g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
+ gint64 value)
{
g_return_if_fail (attr != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_INT64;
attr->u.int64 = value;
}
-/**
+/*
* g_file_attribute_value_set_object:
* @attr: a #GFileAttributeValue.
* @obj: a #GObject.
*
**/
void
-g_file_attribute_value_set_object (GFileAttributeValue *attr,
- GObject *obj)
+_g_file_attribute_value_set_object (GFileAttributeValue *attr,
+ GObject *obj)
{
g_return_if_fail (attr != NULL);
g_return_if_fail (obj != NULL);
- g_file_attribute_value_clear (attr);
+ _g_file_attribute_value_clear (attr);
attr->type = G_FILE_ATTRIBUTE_TYPE_OBJECT;
attr->u.obj = g_object_ref (obj);
}
G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING
} GFileAttributeStatus;
-#define G_FILE_ATTRIBUTE_VALUE_INIT {0}
-
-/**
- * GFileAttributeValue:
- * @type: a #GFileAttributeType.
- * @status: a #GFileAttributeStatus.
- *
- * Contains the value data for the Key-Value pair.
- **/
-typedef struct {
- GFileAttributeType type : 8;
- GFileAttributeStatus status : 8;
- union {
- gboolean boolean;
- gint32 int32;
- guint32 uint32;
- gint64 int64;
- guint64 uint64;
- char *string;
- GQuark quark;
- GObject *obj;
- } u;
-} GFileAttributeValue;
-
/**
* GFileAttributeInfo:
* @name: the name of the attribute.
int n_infos;
} GFileAttributeInfoList;
-GFileAttributeValue *g_file_attribute_value_new (void);
-void g_file_attribute_value_free (GFileAttributeValue *attr);
-void g_file_attribute_value_clear (GFileAttributeValue *attr);
-void g_file_attribute_value_set (GFileAttributeValue *attr,
- const GFileAttributeValue *new_value);
-GFileAttributeValue *g_file_attribute_value_dup (const GFileAttributeValue *other);
-
-char * g_file_attribute_value_as_string (const GFileAttributeValue *attr);
-
-const char * g_file_attribute_value_get_string (const GFileAttributeValue *attr);
-const char * g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr);
-gboolean g_file_attribute_value_get_boolean (const GFileAttributeValue *attr);
-guint32 g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr);
-gint32 g_file_attribute_value_get_int32 (const GFileAttributeValue *attr);
-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);
-
-void g_file_attribute_value_set_string (GFileAttributeValue *attr,
- const char *string);
-void g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
- const char *string);
-void g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
- gboolean value);
-void g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
- guint32 value);
-void g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
- gint32 value);
-void g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
- guint64 value);
-void g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
- gint64 value);
-void g_file_attribute_value_set_object (GFileAttributeValue *attr,
- GObject *obj);
-
GFileAttributeInfoList * g_file_attribute_info_list_new (void);
GFileAttributeInfoList * g_file_attribute_info_list_ref (GFileAttributeInfoList *list);
void g_file_attribute_info_list_unref (GFileAttributeInfoList *list);
#include <string.h>
#include "gfileinfo.h"
+#include "gfileattribute-priv.h"
#include "glibintl.h"
#include "gioalias.h"
GObjectClass parent_class;
};
+
static gboolean g_file_attribute_matcher_matches_id (GFileAttributeMatcher *matcher,
guint32 id);
attrs = (GFileAttribute *)info->attributes->data;
for (i = 0; i < info->attributes->len; i++)
- g_file_attribute_value_clear (&attrs[i].value);
+ _g_file_attribute_value_clear (&attrs[i].value);
g_array_free (info->attributes, TRUE);
if (info->mask != NO_ATTRIBUTE_MASK)
dest = (GFileAttribute *)dest_info->attributes->data;
for (i = 0; i < dest_info->attributes->len; i++)
- g_file_attribute_value_clear (&dest[i].value);
+ _g_file_attribute_value_clear (&dest[i].value);
g_array_set_size (dest_info->attributes,
src_info->attributes->len);
{
dest[i].attribute = source[i].attribute;
dest[i].value.type = G_FILE_ATTRIBUTE_TYPE_INVALID;
- g_file_attribute_value_set (&dest[i].value, &source[i].value);
+ _g_file_attribute_value_set (&dest[i].value, &source[i].value);
}
if (src_info->mask == NO_ATTRIBUTE_MASK)
if (!g_file_attribute_matcher_matches_id (mask,
attr->attribute))
{
- g_file_attribute_value_clear (&attr->value);
+ _g_file_attribute_value_clear (&attr->value);
g_array_remove_index (info->attributes, i);
i--;
}
if (i < info->attributes->len &&
attrs[i].attribute == attr_id)
{
- g_file_attribute_value_clear (&attrs[i].value);
+ _g_file_attribute_value_clear (&attrs[i].value);
g_array_remove_index (info->attributes, i);
}
}
-/**
- * g_file_info_get_attribute:
- * @info: a #GFileInfo.
- * @attribute: a file attribute key.
- *
- * Gets an attribute value from a file info structure.
- *
- * Returns: a #GFileAttributeValue for the given @attribute, or
- * %NULL otherwise.
- **/
+gboolean
+g_file_info_get_attribute_data (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeType *type,
+ gpointer *value_pp,
+ GFileAttributeStatus *status)
+{
+ GFileAttributeValue *value;
+
+ value = g_file_info_find_value_by_name (info, attribute);
+ if (value == NULL)
+ return FALSE;
+
+ if (status)
+ *status = value->status;
+
+ if (type)
+ *type = value->type;
+
+ if (value_pp)
+ *value_pp = _g_file_attribute_value_peek_as_pointer (value);
+
+ return TRUE;
+}
+
+GFileAttributeStatus
+g_file_info_get_attribute_status (GFileInfo *info,
+ const char *attribute)
+{
+ 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)
+ return val->status;
+
+ return 0;
+}
+
+
GFileAttributeValue *
-g_file_info_get_attribute (GFileInfo *info,
- const char *attribute)
+_g_file_info_get_attribute_value (GFileInfo *info,
+ const char *attribute)
{
g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
}
/**
+ * g_file_info_get_attribute_as_string:
+ * @info: a #GFileInfo.
+ * @attribute: a file attribute key.
+ *
+ * Gets the value of a attribute, formated as a string.
+ * This escapes things as needed to make the string valid
+ * utf8.
+ *
+ * Returns: a utf8 string associated with the given @attribute.
+ * When you're done with the string it must be freed.
+ **/
+char *
+g_file_info_get_attribute_as_string (GFileInfo *info,
+ const char *attribute)
+{
+ GFileAttributeValue *val;
+ val = _g_file_info_get_attribute_value (info, attribute);
+ if (val)
+ return _g_file_attribute_value_as_string (val);
+ return NULL;
+}
+
+
+/**
* g_file_info_get_attribute_object:
* @info: a #GFileInfo.
* @attribute: a file attribute key.
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_object (value);
+ return _g_file_attribute_value_get_object (value);
}
/**
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_string (value);
+ return _g_file_attribute_value_get_string (value);
}
/**
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_byte_string (value);
+ return _g_file_attribute_value_get_byte_string (value);
}
/**
g_return_val_if_fail (attribute != NULL && *attribute != '\0', FALSE);
value = g_file_info_find_value_by_name (info, attribute);
- return g_file_attribute_value_get_boolean (value);
+ return _g_file_attribute_value_get_boolean (value);
}
/**
g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
value = g_file_info_find_value_by_name (info, attribute);
- return g_file_attribute_value_get_uint32 (value);
+ return _g_file_attribute_value_get_uint32 (value);
}
/**
g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
value = g_file_info_find_value_by_name (info, attribute);
- return g_file_attribute_value_get_int32 (value);
+ return _g_file_attribute_value_get_int32 (value);
}
/**
g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
value = g_file_info_find_value_by_name (info, attribute);
- return g_file_attribute_value_get_uint64 (value);
+ return _g_file_attribute_value_get_uint64 (value);
}
/**
g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
value = g_file_info_find_value_by_name (info, attribute);
- return g_file_attribute_value_get_int64 (value);
+ return _g_file_attribute_value_get_int64 (value);
}
static GFileAttributeValue *
guint32 attr_id)
{
GFileAttribute *attrs;
- GFileAttribute attr;
int i;
if (info->mask != NO_ATTRIBUTE_MASK &&
return &attrs[i].value;
else
{
+ GFileAttribute attr = { 0 };
attr.attribute = attr_id;
- attr.value.type = G_FILE_ATTRIBUTE_TYPE_INVALID;
g_array_insert_val (info->attributes, i, attr);
attrs = (GFileAttribute *)info->attributes->data;
void
g_file_info_set_attribute (GFileInfo *info,
const char *attribute,
- const GFileAttributeValue *attr_value)
+ GFileAttributeType type,
+ gpointer value_p)
{
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 (value, attr_value);
+ _g_file_attribute_value_set_from_pointer (value, type, value_p, TRUE);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_object (value, attr_value);
+ _g_file_attribute_value_set_object (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_string (value, attr_value);
+ _g_file_attribute_value_set_string (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_byte_string (value, attr_value);
+ _g_file_attribute_value_set_byte_string (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_boolean (value, attr_value);
+ _g_file_attribute_value_set_boolean (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_uint32 (value, attr_value);
+ _g_file_attribute_value_set_uint32 (value, attr_value);
}
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_int32 (value, attr_value);
+ _g_file_attribute_value_set_int32 (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_uint64 (value, attr_value);
+ _g_file_attribute_value_set_uint64 (value, attr_value);
}
/**
value = g_file_info_create_value_by_name (info, attribute);
if (value)
- g_file_attribute_value_set_int64 (value, attr_value);
+ _g_file_attribute_value_set_int64 (value, attr_value);
}
/* Helper getters */
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_TYPE);
value = g_file_info_find_value (info, attr);
- return (GFileType)g_file_attribute_value_get_uint32 (value);
+ return (GFileType)_g_file_attribute_value_get_uint32 (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_IS_HIDDEN);
value = g_file_info_find_value (info, attr);
- return (GFileType)g_file_attribute_value_get_boolean (value);
+ return (GFileType)_g_file_attribute_value_get_boolean (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_IS_BACKUP);
value = g_file_info_find_value (info, attr);
- return (GFileType)g_file_attribute_value_get_boolean (value);
+ return (GFileType)_g_file_attribute_value_get_boolean (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_IS_SYMLINK);
value = g_file_info_find_value (info, attr);
- return (GFileType)g_file_attribute_value_get_boolean (value);
+ return (GFileType)_g_file_attribute_value_get_boolean (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_NAME);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_byte_string (value);
+ return _g_file_attribute_value_get_byte_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_DISPLAY_NAME);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_string (value);
+ return _g_file_attribute_value_get_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_EDIT_NAME);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_string (value);
+ return _g_file_attribute_value_get_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_ICON);
value = g_file_info_find_value (info, attr);
- obj = g_file_attribute_value_get_object (value);
+ obj = _g_file_attribute_value_get_object (value);
if (obj != NULL && G_IS_ICON (obj))
return G_ICON (obj);
return NULL;
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_CONTENT_TYPE);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_string (value);
+ return _g_file_attribute_value_get_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_SIZE);
value = g_file_info_find_value (info, attr);
- return (goffset) g_file_attribute_value_get_uint64 (value);
+ return (goffset) _g_file_attribute_value_get_uint64 (value);
}
/**
}
value = g_file_info_find_value (info, attr_mtime);
- result->tv_sec = g_file_attribute_value_get_uint64 (value);
+ result->tv_sec = _g_file_attribute_value_get_uint64 (value);
value = g_file_info_find_value (info, attr_mtime_usec);
- result->tv_usec = g_file_attribute_value_get_uint32 (value);
+ result->tv_usec = _g_file_attribute_value_get_uint32 (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_SYMLINK_TARGET);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_byte_string (value);
+ return _g_file_attribute_value_get_byte_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_ETAG_VALUE);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_string (value);
+ return _g_file_attribute_value_get_string (value);
}
/**
attr = lookup_attribute (G_FILE_ATTRIBUTE_STD_SORT_ORDER);
value = g_file_info_find_value (info, attr);
- return g_file_attribute_value_get_int32 (value);
+ return _g_file_attribute_value_get_int32 (value);
}
/* Helper setters: */
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_uint32 (value, type);
+ _g_file_attribute_value_set_uint32 (value, type);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_boolean (value, is_hidden);
+ _g_file_attribute_value_set_boolean (value, is_hidden);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_boolean (value, is_symlink);
+ _g_file_attribute_value_set_boolean (value, is_symlink);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_byte_string (value, name);
+ _g_file_attribute_value_set_byte_string (value, name);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_string (value, display_name);
+ _g_file_attribute_value_set_string (value, display_name);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_string (value, edit_name);
+ _g_file_attribute_value_set_string (value, edit_name);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_object (value, G_OBJECT (icon));
+ _g_file_attribute_value_set_object (value, G_OBJECT (icon));
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_string (value, content_type);
+ _g_file_attribute_value_set_string (value, content_type);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_uint64 (value, size);
+ _g_file_attribute_value_set_uint64 (value, size);
}
/**
value = g_file_info_create_value (info, attr_mtime);
if (value)
- g_file_attribute_value_set_uint64 (value, mtime->tv_sec);
+ _g_file_attribute_value_set_uint64 (value, mtime->tv_sec);
value = g_file_info_create_value (info, attr_mtime_usec);
if (value)
- g_file_attribute_value_set_uint32 (value, mtime->tv_usec);
+ _g_file_attribute_value_set_uint32 (value, mtime->tv_usec);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_byte_string (value, symlink_target);
+ _g_file_attribute_value_set_byte_string (value, symlink_target);
}
/**
value = g_file_info_create_value (info, attr);
if (value)
- g_file_attribute_value_set_int32 (value, sort_order);
+ _g_file_attribute_value_set_int32 (value, sort_order);
}
const char *attribute);
char ** g_file_info_list_attributes (GFileInfo *info,
const char *name_space);
+gboolean g_file_info_get_attribute_data (GFileInfo *info,
+ const char *attribute,
+ GFileAttributeType *type,
+ gpointer *value_pp,
+ GFileAttributeStatus *status);
GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info,
const char *attribute);
void g_file_info_remove_attribute (GFileInfo *info,
const char *attribute);
-GFileAttributeValue * g_file_info_get_attribute (GFileInfo *info,
+GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info,
+ const char *attribute);
+char * g_file_info_get_attribute_as_string (GFileInfo *info,
const char *attribute);
const char * g_file_info_get_attribute_string (GFileInfo *info,
const char *attribute);
void g_file_info_set_attribute (GFileInfo *info,
const char *attribute,
- const GFileAttributeValue *attr_value);
+ GFileAttributeType type,
+ gpointer value_p);
void g_file_info_set_attribute_string (GFileInfo *info,
const char *attribute,
const char *attr_value);
#if IN_FILE(__G_DESKTOP_APP_INFO_C__)
g_desktop_app_info_new_from_filename
g_desktop_app_info_new
+g_desktop_app_info_get_type G_GNUC_CONST
g_desktop_app_info_get_is_hidden
#endif
#endif
#if IN_HEADER(__G_FILE_ATTRIBUTE_H__)
#if IN_FILE(__G_FILE_ATTRIBUTE_C__)
-g_file_attribute_value_new
-g_file_attribute_value_free
-g_file_attribute_value_clear
-g_file_attribute_value_set
-g_file_attribute_value_dup
-g_file_attribute_value_as_string
-g_file_attribute_value_get_string
-g_file_attribute_value_get_byte_string
-g_file_attribute_value_get_boolean
-g_file_attribute_value_get_uint32
-g_file_attribute_value_get_int32
-g_file_attribute_value_get_uint64
-g_file_attribute_value_get_int64
-g_file_attribute_value_get_object
-g_file_attribute_value_set_string
-g_file_attribute_value_set_byte_string
-g_file_attribute_value_set_boolean
-g_file_attribute_value_set_uint32
-g_file_attribute_value_set_int32
-g_file_attribute_value_set_uint64
-g_file_attribute_value_set_int64
-g_file_attribute_value_set_object
g_file_attribute_info_list_new
g_file_attribute_info_list_ref
g_file_attribute_info_list_unref
g_file_info_list_attributes
g_file_info_get_attribute_type
g_file_info_remove_attribute
-g_file_info_get_attribute
+g_file_info_get_attribute_status
+g_file_info_get_attribute_data
+g_file_info_get_attribute_as_string
g_file_info_get_attribute_string
g_file_info_get_attribute_byte_string
g_file_info_get_attribute_boolean
static gboolean
g_local_file_set_attribute (GFile *file,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error)
return _g_local_file_info_set_attribute (local->filename,
attribute,
- value,
+ type,
+ value_p,
flags,
cancellable,
error);
#include <glib/gstdio.h>
#include <glib/gchecksum.h>
+#include <gfileattribute-priv.h>
#include "glibintl.h"
gboolean
_g_local_file_info_set_attribute (char *filename,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error)
{
+ GFileAttributeValue value = { 0 };
+
+ _g_file_attribute_value_set_from_pointer (&value, type, value_p, FALSE);
+
if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0)
- return set_unix_mode (filename, value, error);
+ return set_unix_mode (filename, &value, error);
#ifdef HAVE_CHOWN
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_UID) == 0)
- return set_unix_uid_gid (filename, value, NULL, flags, error);
+ return set_unix_uid_gid (filename, &value, NULL, flags, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_GID) == 0)
- return set_unix_uid_gid (filename, NULL, value, flags, error);
+ return set_unix_uid_gid (filename, NULL, &value, flags, error);
#endif
#ifdef HAVE_SYMLINK
else if (strcmp (attribute, G_FILE_ATTRIBUTE_STD_SYMLINK_TARGET) == 0)
- return set_symlink (filename, value, error);
+ return set_symlink (filename, &value, error);
#endif
#ifdef HAVE_UTIMES
else if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_MODIFIED) == 0)
- return set_mtime_atime (filename, value, NULL, NULL, NULL, error);
+ return set_mtime_atime (filename, &value, NULL, NULL, NULL, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC) == 0)
- return set_mtime_atime (filename, NULL, value, NULL, NULL, error);
+ return set_mtime_atime (filename, NULL, &value, NULL, NULL, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_ACCESS) == 0)
- return set_mtime_atime (filename, NULL, NULL, value, NULL, error);
+ return set_mtime_atime (filename, NULL, NULL, &value, NULL, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC) == 0)
- return set_mtime_atime (filename, NULL, NULL, NULL, value, error);
+ return set_mtime_atime (filename, NULL, NULL, NULL, &value, error);
#endif
#ifdef HAVE_XATTR
else if (g_str_has_prefix (attribute, "xattr::"))
- return set_xattr (filename, attribute, value, error);
+ return set_xattr (filename, attribute, &value, error);
else if (g_str_has_prefix (attribute, "xattr-sys::"))
- return set_xattr (filename, attribute, value, error);
+ return set_xattr (filename, attribute, &value, error);
#endif
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
/* Set symlink first, since this recreates the file */
#ifdef HAVE_SYMLINK
- value = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_STD_SYMLINK_TARGET);
+ value = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_STD_SYMLINK_TARGET);
if (value)
{
if (!set_symlink (filename, value, error))
* Change ownership before permissions, since ownership changes can
change permissions (e.g. setuid)
*/
- uid = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_UNIX_UID);
- gid = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_UNIX_GID);
+ uid = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_UNIX_UID);
+ gid = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_UNIX_GID);
if (uid || gid)
{
}
#endif
- value = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE);
+ value = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_UNIX_MODE);
if (value)
{
if (!set_unix_mode (filename, value, error))
* Change times as the last thing to avoid it changing due to metadata changes
*/
- mtime = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
- mtime_usec = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
- atime = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
- atime_usec = g_file_info_get_attribute (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC);
+ mtime = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ mtime_usec = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
+ atime = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
+ atime_usec = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC);
if (mtime || mtime_usec || atime || atime_usec)
{
char * _g_local_file_info_create_etag (struct stat *statbuf);
gboolean _g_local_file_info_set_attribute (char *filename,
const char *attribute,
- const GFileAttributeValue *value,
+ GFileAttributeType type,
+ gpointer value_p,
GFileQueryInfoFlags flags,
GCancellable *cancellable,
GError **error);
*
**/
-/**
+/*
* GUnixMountType:
* @G_UNIX_MOUNT_TYPE_UNKNOWN: Unknown UNIX mount type.
* @G_UNIX_MOUNT_TYPE_FLOPPY: Floppy disk UNIX mount type.
return type;
}
-/**
+/*
* g_unix_mount_guess_type:
* @mount_entry: a #GUnixMount.
*
*
* Returns: a #GUnixMountType.
**/
-GUnixMountType
+static GUnixMountType
g_unix_mount_guess_type (GUnixMountEntry *mount_entry)
{
g_return_val_if_fail (mount_entry != NULL, G_UNIX_MOUNT_TYPE_UNKNOWN);
mount_entry->filesystem_type);
}
-/**
+/*
* g_unix_mount_point_guess_type:
* @mount_point: a #GUnixMountPoint.
*
*
* Returns: a #GUnixMountType.
**/
-GUnixMountType
+static GUnixMountType
g_unix_mount_point_guess_type (GUnixMountPoint *mount_point)
{
g_return_val_if_fail (mount_point != NULL, G_UNIX_MOUNT_TYPE_UNKNOWN);