forked from AuroraMiddleware/gtk
filesystemmodel: Always set standard::file attribute
This will help us greatly when porting GtkFileSystemModel to GtkDirectoryList.
This commit is contained in:
parent
8a24fdea38
commit
4e3fbd0b0f
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user