mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 04:15:49 +01:00
gio: Add some missing file info attribute checks in gio-list and gio-tree
Further fallout from #2907. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2948
This commit is contained in:
parent
e979fd9a15
commit
4ba3470269
@ -157,7 +157,8 @@ show_info (GFile *file, GFileInfo *info)
|
|||||||
GUnixMountEntry *entry;
|
GUnixMountEntry *entry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
name = g_file_info_get_display_name (info);
|
name = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME) ?
|
||||||
|
g_file_info_get_display_name (info) : NULL;
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
/* Translators: This is a noun and represents and attribute of a file */
|
/* Translators: This is a noun and represents and attribute of a file */
|
||||||
@ -166,7 +167,8 @@ show_info (GFile *file, GFileInfo *info)
|
|||||||
g_free (flatten);
|
g_free (flatten);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = g_file_info_get_edit_name (info);
|
name = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) ?
|
||||||
|
g_file_info_get_edit_name (info) : NULL;
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
/* Translators: This is a noun and represents and attribute of a file */
|
/* Translators: This is a noun and represents and attribute of a file */
|
||||||
|
@ -54,10 +54,12 @@ show_file_listing (GFileInfo *info, GFile *parent)
|
|||||||
gboolean first_attr;
|
gboolean first_attr;
|
||||||
GFile *child;
|
GFile *child;
|
||||||
|
|
||||||
if ((g_file_info_get_is_hidden (info)) && !show_hidden)
|
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
|
||||||
|
g_file_info_get_is_hidden (info) &&
|
||||||
|
!show_hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (print_display_names)
|
if (print_display_names && g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME))
|
||||||
name = g_file_info_get_display_name (info);
|
name = g_file_info_get_display_name (info);
|
||||||
else
|
else
|
||||||
name = g_file_info_get_name (info);
|
name = g_file_info_get_name (info);
|
||||||
@ -71,7 +73,8 @@ show_file_listing (GFileInfo *info, GFile *parent)
|
|||||||
g_object_unref (child);
|
g_object_unref (child);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = g_file_info_get_size (info);
|
size = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE) ?
|
||||||
|
g_file_info_get_size (info) : 0;
|
||||||
type = file_type_to_string (g_file_info_get_file_type (info));
|
type = file_type_to_string (g_file_info_get_file_type (info));
|
||||||
if (show_long)
|
if (show_long)
|
||||||
g_print ("%s\t%"G_GUINT64_FORMAT"\t(%s)", print_uris? uri: name, (guint64)size, type);
|
g_print ("%s\t%"G_GUINT64_FORMAT"\t(%s)", print_uris? uri: name, (guint64)size, type);
|
||||||
|
@ -95,7 +95,9 @@ do_tree (GFile *f, unsigned int level, guint64 pattern)
|
|||||||
info_list = NULL;
|
info_list = NULL;
|
||||||
while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL)
|
while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL)
|
||||||
{
|
{
|
||||||
if (g_file_info_get_is_hidden (info) && !show_hidden)
|
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) &&
|
||||||
|
g_file_info_get_is_hidden (info) &&
|
||||||
|
!show_hidden)
|
||||||
{
|
{
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
@ -151,7 +153,8 @@ do_tree (GFile *f, unsigned int level, guint64 pattern)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_file_info_get_is_symlink (info))
|
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK) &&
|
||||||
|
g_file_info_get_is_symlink (info))
|
||||||
{
|
{
|
||||||
const char *target;
|
const char *target;
|
||||||
target = g_file_info_get_symlink_target (info);
|
target = g_file_info_get_symlink_target (info);
|
||||||
@ -162,7 +165,9 @@ do_tree (GFile *f, unsigned int level, guint64 pattern)
|
|||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
|
|
||||||
if ((type & G_FILE_TYPE_DIRECTORY) &&
|
if ((type & G_FILE_TYPE_DIRECTORY) &&
|
||||||
(follow_symlinks || !g_file_info_get_is_symlink (info)))
|
(follow_symlinks ||
|
||||||
|
!(g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK) &&
|
||||||
|
g_file_info_get_is_symlink (info))))
|
||||||
{
|
{
|
||||||
guint64 new_pattern;
|
guint64 new_pattern;
|
||||||
GFile *child;
|
GFile *child;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user