diff options
author | Benjamin Otte <otte@gnome.org> | 2009-06-24 22:43:14 +0200 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2009-10-15 22:01:09 +0200 |
commit | 5a31dfd66beabb43206a6c23a699a3297cd9cac3 (patch) | |
tree | ab46eca367a7da6a8c8ca5cbbf8c9754d1e810f3 /gtk/gtkfilesystemmodel.c | |
parent | 390a3910f51fbb101bf6959ff681ab3df9556394 (diff) | |
download | gtk+-5a31dfd66beabb43206a6c23a699a3297cd9cac3.tar.gz |
Convert search to use a GtkFileSystemModel
Replace the list model code with the file system model and use all the
file system model API niceties we get from that.
Also adds the function _gtk_file_system_model_add_and_query_file() which
g_file_query_info()'s the file before adding it, so it gets added with
the right information.
Diffstat (limited to 'gtk/gtkfilesystemmodel.c')
-rw-r--r-- | gtk/gtkfilesystemmodel.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index de89c6001d..300addf0e5 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -1767,3 +1767,30 @@ _gtk_file_system_model_clear_cache (GtkFileSystemModel *model, /* FIXME: resort? */ } +/** + * _gtk_file_system_model_add_and_query_file: + * @model: a #GtkFileSystemModel + * @file: the file to add + * @attributes: attributes to query before adding the file + * + * This is a conenience function that calls g_file_query_info_async() on + * the given file, and when successful, adds it to the model with + * _gtk_file_system_model_add_file(). Upon failure, the @file is discarded. + **/ +void +_gtk_file_system_model_add_and_query_file (GtkFileSystemModel *model, + GFile * file, + const char * attributes) +{ + g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model)); + g_return_if_fail (G_IS_FILE (file)); + g_return_if_fail (attributes != NULL); + + g_file_query_info_async (file, + attributes, + 0, + IO_PRIORITY, + model->cancellable, + gtk_file_system_model_query_done, + model); +} |