Re: nautilus & hidden files



I'm new to GIO so I can't help you too much, but this is what I found.

It seems that the hidden attr is stored in GFileInfo*
info->attributes->data[attr_id].value
and you can set attributes using g_file_info_set_attribute

This is how GIO queries for a hidden file, taken from glib2.0-2.18.1,
file gio/gfileinfo.c

/**
 * g_file_info_get_is_hidden:
 * @info: a #GFileInfo.
 *
 * Checks if a file is hidden.
 *
 * Returns: %TRUE if the file is a hidden file, %FALSE otherwise.
 **/
gboolean
g_file_info_get_is_hidden (GFileInfo *info)
{
  static guint32 attr = 0;
  GFileAttributeValue *value;

  g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE);

  if (attr == 0)
    attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN);

  value = g_file_info_find_value (info, attr);
  return (GFileType)_g_file_attribute_value_get_boolean (value);
}


static GFileAttributeValue *
g_file_info_find_value (GFileInfo *info,
			guint32    attr_id)
{
  GFileAttribute *attrs;
  int i;

  i = g_file_info_find_place (info, attr_id);
  attrs = (GFileAttribute *)info->attributes->data;
  if (i < info->attributes->len &&
      attrs[i].attribute == attr_id)
    return &attrs[i].value;

  return NULL;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]