diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c index ad196d0ec..ca42add8e 100644 --- a/gio/gfileinfo.c +++ b/gio/gfileinfo.c @@ -1838,6 +1838,7 @@ g_file_info_get_modification_time (GFileInfo *info, if (G_UNLIKELY (value == NULL)) { g_critical ("GFileInfo created without " G_FILE_ATTRIBUTE_TIME_MODIFIED); + result->tv_sec = result->tv_usec = 0; g_return_if_reached (); } diff --git a/gio/gio-tool-info.c b/gio/gio-tool-info.c index d51edb47b..749bd2d13 100644 --- a/gio/gio-tool-info.c +++ b/gio/gio-tool-info.c @@ -157,7 +157,8 @@ show_info (GFile *file, GFileInfo *info) GUnixMountEntry *entry; #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) { /* 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); } - 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) { /* Translators: This is a noun and represents and attribute of a file */ diff --git a/gio/gio-tool-list.c b/gio/gio-tool-list.c index 24e3dac3c..0da86269d 100644 --- a/gio/gio-tool-list.c +++ b/gio/gio-tool-list.c @@ -54,10 +54,12 @@ show_file_listing (GFileInfo *info, GFile *parent) gboolean first_attr; 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; - 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); else name = g_file_info_get_name (info); @@ -71,7 +73,8 @@ show_file_listing (GFileInfo *info, GFile *parent) 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)); if (show_long) g_print ("%s\t%"G_GUINT64_FORMAT"\t(%s)", print_uris? uri: name, (guint64)size, type); diff --git a/gio/gio-tool-tree.c b/gio/gio-tool-tree.c index 071588240..28fad051f 100644 --- a/gio/gio-tool-tree.c +++ b/gio/gio-tool-tree.c @@ -95,7 +95,9 @@ do_tree (GFile *f, unsigned int level, guint64 pattern) info_list = 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); } @@ -151,7 +153,8 @@ do_tree (GFile *f, unsigned int level, guint64 pattern) } 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; target = g_file_info_get_symlink_target (info); @@ -162,7 +165,9 @@ do_tree (GFile *f, unsigned int level, guint64 pattern) g_print ("\n"); 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; GFile *child; diff --git a/gio/gpollfilemonitor.c b/gio/gpollfilemonitor.c index c4dfd9913..2a8473630 100644 --- a/gio/gpollfilemonitor.c +++ b/gio/gpollfilemonitor.c @@ -94,7 +94,9 @@ calc_event_type (GFileInfo *last, g_strcmp0 (g_file_info_get_etag (last), g_file_info_get_etag (new)) != 0) return G_FILE_MONITOR_EVENT_CHANGED; - if (g_file_info_get_size (last) != g_file_info_get_size (new)) + if (g_file_info_has_attribute (last, G_FILE_ATTRIBUTE_STANDARD_SIZE) && + g_file_info_has_attribute (new, G_FILE_ATTRIBUTE_STANDARD_SIZE) && + g_file_info_get_size (last) != g_file_info_get_size (new)) return G_FILE_MONITOR_EVENT_CHANGED; return -1;