Home | History | Annotate | Download | only in gio

Lines Matching refs:attr

110  * about extended user attributes. See attr(5). The "user." prefix of the
117 * See attr(5). Note that this information is only available if GLib
215 * @attr: a #GFileAttributeValue.
217 * Frees the memory used by @attr.
221 _g_file_attribute_value_free (GFileAttributeValue *attr)
223 g_return_if_fail (attr != NULL);
225 _g_file_attribute_value_clear (attr);
226 g_free (attr);
231 * @attr: a #GFileAttributeValue.
233 * Clears the value of @attr and sets its type to
238 _g_file_attribute_value_clear (GFileAttributeValue *attr)
240 g_return_if_fail (attr != NULL);
242 if (attr->type == G_FILE_ATTRIBUTE_TYPE_STRING ||
243 attr->type == G_FILE_ATTRIBUTE_TYPE_BYTE_STRING)
244 g_free (attr->u.string);
246 if (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT &&
247 attr->u.obj != NULL)
248 g_object_unref (attr->u.obj);
250 attr->type = G_FILE_ATTRIBUTE_TYPE_INVALID;
255 * @attr: a #GFileAttributeValue to set the value in.
261 _g_file_attribute_value_set (GFileAttributeValue *attr,
264 g_return_if_fail (attr != NULL);
267 _g_file_attribute_value_clear (attr);
268 *attr = *new_value;
270 if (attr->type == G_FILE_ATTRIBUTE_TYPE_STRING ||
271 attr
272 attr->u.string = g_strdup (attr->u.string);
274 if (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT &&
275 attr->u.obj != NULL)
276 g_object_ref (attr->u.obj);
289 GFileAttributeValue *attr;
291 attr = g_new (GFileAttributeValue, 1);
292 attr->type = G_FILE_ATTRIBUTE_TYPE_INVALID;
293 return attr;
297 _g_file_attribute_value_peek_as_pointer (GFileAttributeValue *attr)
299 switch (attr->type) {
302 return attr->u.string;
304 return attr->u.obj;
306 return (gpointer) &attr->u;
321 GFileAttributeValue *attr;
325 attr = g_new (GFileAttributeValue, 1);
326 attr->type = G_FILE_ATTRIBUTE_TYPE_INVALID;
327 _g_file_attribute_value_set (attr, other);
328 return attr;
400 * @attr: a #GFileAttributeValue.
405 * Returns: a string from the @attr, %NULL on error, or "<invalid>"
406 * if @attr is of type %G_FILE_ATTRIBUTE_TYPE_INVALID.
409 _g_file_attribute_value_as_string (const GFileAttributeValue *attr)
413 g_return_val_if_fail (attr != NULL, NULL);
415 switch (attr->type)
418 str = g_strdup (attr->u.string);
421 str = escape_byte_string (attr->u.string);
424 str = g_strdup_printf ("%s", attr->u.boolean?"TRUE":"FALSE");
427 str = g_strdup_printf ("%u", (unsigned int)attr->u.uint32);
430 str = g_strdup_printf ("%i", (int)attr->u.int32);
433 str = g_strdup_printf ("%"G_GUINT64_FORMAT, attr->u.uint64);
436 str = g_strdup_printf ("%"G_GINT64_FORMAT, attr->u.int64);
440 ((GTypeInstance *) attr->u.obj),
441 attr->u.obj);
454 * @attr: a #GFileAttributeValue.
462 _g_file_attribute_value_get_string (const GFileAttributeValue *attr)
464 if (attr == NULL)
467 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_STRING, NULL);
469 return attr->u.string;
474 * @attr: a #GFileAttributeValue.
482 _g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr)
484 if (attr == NULL)
487 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, NULL);
489 return attr->u.string;
494 * @attr: a #GFileAttributeValue.
502 _g_file_attribute_value_get_boolean (const GFileAttributeValue *attr)
504 if (attr == NULL)
507 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_BOOLEAN, FALSE);
509 return attr->u.boolean;
514 * @attr: a #GFileAttributeValue.
522 _g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr)
524 if (attr == NULL)
527 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_UINT32, 0);
529 return attr->u.uint32;
534 * @attr: a #GFileAttributeValue.
542 _g_file_attribute_value_get_int32 (const GFileAttributeValue *attr)
544 if (attr == NULL)
547 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_INT32, 0);
549 return attr->u.int32;
554 * @attr: a #GFileAttributeValue.
562 _g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr)
564 if (attr == NULL)
567 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_UINT64, 0);
569 return attr->u.uint64;
574 * @attr: a #GFileAttributeValue.
582 _g_file_attribute_value_get_int64 (const GFileAttributeValue *attr)
584 if (attr == NULL)
587 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_INT64, 0);
589 return attr->u.int64;
594 * @attr: a #GFileAttributeValue.
602 _g_file_attribute_value_get_object (const GFileAttributeValue *attr)
604 if (attr == NULL)
607 g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT, NULL);
609 return attr->u.obj;
665 * @attr: a #GFileAttributeValue.
671 _g_file_attribute_value_set_string (GFileAttributeValue *attr,
674 g_return_if_fail (attr != NULL);
677 _g_file_attribute_value_clear (attr);
678 attr->type = G_FILE_ATTRIBUTE_TYPE_STRING;
679 attr->u.string = g_strdup (string);
684 * @attr: a #GFileAttributeValue.
690 _g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
693 g_return_if_fail (attr != NULL);
696 _g_file_attribute_value_clear (attr);
697 attr->type = G_FILE_ATTRIBUTE_TYPE_BYTE_STRING;
698 attr->u.string = g_strdup (string);
703 * @attr: a #GFileAttributeValue.
709 _g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
712 g_return_if_fail (attr != NULL);
714 _g_file_attribute_value_clear (attr);
715 attr->type = G_FILE_ATTRIBUTE_TYPE_BOOLEAN;
716 attr->u.boolean = !!value;
721 * @attr: a #GFileAttributeValue.
727 _g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
730 g_return_if_fail (attr != NULL);
732 _g_file_attribute_value_clear (attr);
733 attr->type = G_FILE_ATTRIBUTE_TYPE_UINT32;
734 attr->u.uint32 = value;
739 * @attr: a #GFileAttributeValue.
745 _g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
748 g_return_if_fail (attr != NULL);
750 _g_file_attribute_value_clear (attr);
751 attr->type = G_FILE_ATTRIBUTE_TYPE_INT32;
752 attr->u.int32 = value;
757 * @attr: a #GFileAttributeValue.
763 _g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
766 g_return_if_fail (attr != NULL);
768 _g_file_attribute_value_clear (attr);
769 attr->type = G_FILE_ATTRIBUTE_TYPE_UINT64;
770 attr->u.uint64 = value;
775 * @attr: a #GFileAttributeValue.
781 _g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
784 g_return_if_fail (attr != NULL);
786 _g_file_attribute_value_clear (attr);
787 attr->type = G_FILE_ATTRIBUTE_TYPE_INT64;
788 attr->u.int64 = value;
793 * @attr: a #GFileAttributeValue.
797 * The @attr references the GObject internally.
800 _g_file_attribute_value_set_object (GFileAttributeValue *attr,
803 g_return_if_fail (attr != NULL);
806 _g_file_attribute_value_clear (attr);
807 attr->type = G_FILE_ATTRIBUTE_TYPE_OBJECT;
808 attr->u.obj = g_object_ref (obj);