diff options
author | Morten Welinder <terra@gnome.org> | 2004-03-01 19:48:28 +0000 |
---|---|---|
committer | Morten Welinder <mortenw@src.gnome.org> | 2004-03-01 19:48:28 +0000 |
commit | 8ddff5b09887801c07b38f666a6091fb46225de6 (patch) | |
tree | 5b12755ad77093f03ec573c5115e31d016d18d9c /gtk/gtkfilesystemmodel.c | |
parent | 945e6c4ecbbd49f41939ffb7c8a38bb4c6d0cb61 (diff) | |
download | gdk-pixbuf-8ddff5b09887801c07b38f666a6091fb46225de6.tar.gz |
Simplify semantics and check for errors.
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.
* gtk/gtkpathbar.c (gtk_path_bar_set_path): Propagate errors.
* gtk/gtkfilefilter.c (gtk_file_filter_filter): Don't crash if
display_name is NULL.
Diffstat (limited to 'gtk/gtkfilesystemmodel.c')
-rw-r--r-- | gtk/gtkfilesystemmodel.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index d1575007d..15bb974d6 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -1228,24 +1228,32 @@ static gboolean file_model_node_is_visible (GtkFileSystemModel *model, FileModelNode *node) { - if (model->show_hidden && model->show_folders && model->show_files) - return TRUE; - else + if (model->show_folders != model->show_files || + !model->show_hidden || + model->filter_func) { const GtkFileInfo *info = file_model_node_get_info (model, node); - gboolean is_folder = gtk_file_info_get_is_folder (info); - if (!model->show_folders && is_folder) - return FALSE; - if (!model->show_files && !is_folder) + if (!info) + { + /* File probably disappeared underneath us or resides in a + directory where we have only partial access rights. */ + return FALSE; + } + + if (model->show_folders != model->show_files && + model->show_folders != gtk_file_info_get_is_folder (info)) return FALSE; + if (!model->show_hidden && gtk_file_info_get_is_hidden (info)) return FALSE; - if (model->filter_func && !model->filter_func (model, node->path, info, model->filter_data)) - return FALSE; - return TRUE; + if (model->filter_func && + !model->filter_func (model, node->path, info, model->filter_data)) + return FALSE; } + + return TRUE; } static void |