diff --git a/ChangeLog b/ChangeLog index 74d0035ddd..bbb58ca612 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-03-01 Morten Welinder + + * 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. + Mon Mar 1 14:16:52 2004 Owen Taylor Based on patch by Alex Larsson diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 74d0035ddd..bbb58ca612 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2004-03-01 Morten Welinder + + * 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. + Mon Mar 1 14:16:52 2004 Owen Taylor Based on patch by Alex Larsson diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 74d0035ddd..bbb58ca612 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +2004-03-01 Morten Welinder + + * 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. + Mon Mar 1 14:16:52 2004 Owen Taylor Based on patch by Alex Larsson diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 74d0035ddd..bbb58ca612 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +2004-03-01 Morten Welinder + + * 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. + Mon Mar 1 14:16:52 2004 Owen Taylor Based on patch by Alex Larsson diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 74d0035ddd..bbb58ca612 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2004-03-01 Morten Welinder + + * 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. + Mon Mar 1 14:16:52 2004 Owen Taylor Based on patch by Alex Larsson diff --git a/gtk/gtkfilefilter.c b/gtk/gtkfilefilter.c index 826c171937..b2d5c394c8 100644 --- a/gtk/gtkfilefilter.c +++ b/gtk/gtkfilefilter.c @@ -376,7 +376,8 @@ gtk_file_filter_filter (GtkFileFilter *filter, return TRUE; break; case FILTER_RULE_PATTERN: - if (_gtk_fnmatch (rule->u.pattern, filter_info->display_name)) + if (filter_info->display_name != NULL && + _gtk_fnmatch (rule->u.pattern, filter_info->display_name)) return TRUE; break; case FILTER_RULE_CUSTOM: diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index d1575007dd..15bb974d6a 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 diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index edbd8f6c58..78e5e4f44b 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -676,7 +676,15 @@ gtk_path_bar_set_path (GtkPathBar *path_bar, file_folder = gtk_file_system_get_folder (file_system, path, GTK_FILE_INFO_DISPLAY_NAME, NULL); - file_info = gtk_file_folder_get_info (file_folder, path, NULL); + file_info = gtk_file_folder_get_info (file_folder, path, &err); + if (!file_info) + { + g_propagate_error (error, err); + g_error_free (err); + gtk_file_path_free (path); + break; + } + display_name = gtk_file_info_get_display_name (file_info); if (! strcmp ("/", display_name)) display_name = " / ";