forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
945e6c4ecb
commit
8ddff5b098
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
||||
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Based on patch by Alex Larsson
|
||||
|
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
||||
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Based on patch by Alex Larsson
|
||||
|
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
||||
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Based on patch by Alex Larsson
|
||||
|
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
||||
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Based on patch by Alex Larsson
|
||||
|
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
||||
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
Based on patch by Alex Larsson
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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 = " / ";
|
||||
|
Loading…
Reference in New Issue
Block a user