diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 84916500be..5621e7b625 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -197,7 +197,6 @@ match_func (GtkEntryCompletion *compl, * current file filter (e.g. just jpg files) here. */ if (chooser_entry->current_filter != NULL) { - GFile *file; GFileInfo *info; file = _gtk_file_system_model_get_file (GTK_FILE_SYSTEM_MODEL (chooser_entry->completion_store), @@ -209,8 +208,7 @@ match_func (GtkEntryCompletion *compl, if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR) return TRUE; - if (!g_file_info_has_attribute (info, "standard::file")) - g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file)); + g_assert (g_file_info_has_attribute (info, "standard::file")); return gtk_filter_match (GTK_FILTER (chooser_entry->current_filter), info); } diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index 06fa65808a..9989c23534 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -366,8 +366,7 @@ node_should_be_filtered_out (GtkFileSystemModel *model, guint id) if (model->filter == NULL) return FALSE; - if (!g_file_info_has_attribute (node->info, "standard::file")) - g_file_info_set_attribute_object (node->info, "standard::file", G_OBJECT (node->file)); + g_assert (g_file_info_has_attribute (node->info, "standard::file")); return !gtk_filter_match (GTK_FILTER (model->filter), node->info); } @@ -1612,7 +1611,10 @@ add_file (GtkFileSystemModel *model, node = g_slice_alloc0 (model->node_size); node->file = g_object_ref (file); if (info) - node->info = g_object_ref (info); + { + g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file)); + node->info = g_object_ref (info); + } node->frozen_add = model->frozen ? TRUE : FALSE; g_array_append_vals (model->files, node, 1); @@ -1722,6 +1724,8 @@ _gtk_file_system_model_update_file (GtkFileSystemModel *model, g_value_unset (&node->values[i]); } + g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file)); + if (node->visible) emit_row_changed_for_node (model, id); }