Fix sparse warnings
[platform/upstream/glib.git] / gio / gfileinfo.c
index 2096b47..264ccf1 100644 (file)
  * @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.
  **/
 
@@ -62,7 +62,6 @@
 #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)
@@ -259,6 +258,8 @@ ensure_attribute_hash (void)
   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
 }
@@ -320,7 +321,7 @@ g_file_info_finalize (GObject *object)
   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);
@@ -616,7 +617,7 @@ g_file_info_has_namespace (GFileInfo  *info,
  * 
  * 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.
  **/
@@ -707,13 +708,13 @@ g_file_info_remove_attribute (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
@@ -792,8 +793,8 @@ g_file_info_set_attribute_status (GFileInfo  *info,
 {
   GFileAttributeValue *val;
 
-  g_return_val_if_fail (G_IS_FILE_INFO (info), 0);
-  g_return_val_if_fail (attribute != NULL && *attribute != '\0', 0);
+  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)
@@ -848,7 +849,7 @@ g_file_info_get_attribute_as_string (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 *
@@ -1602,7 +1603,7 @@ g_file_info_get_edit_name (GFileInfo *info)
  * 
  * 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)
@@ -2146,6 +2147,24 @@ matcher_add (GFileAttributeMatcher *matcher,
   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.
@@ -2479,6 +2498,3 @@ g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher)
        return get_attribute_for_id (sub_matcher->id);
     }
 }
-
-#define __G_FILE_INFO_C__
-#include "gioaliasdef.c"