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>
|
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
Based on patch by Alex Larsson
|
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>
|
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
Based on patch by Alex Larsson
|
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>
|
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
Based on patch by Alex Larsson
|
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>
|
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
Based on patch by Alex Larsson
|
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>
|
Mon Mar 1 14:16:52 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
Based on patch by Alex Larsson
|
Based on patch by Alex Larsson
|
||||||
|
@ -376,7 +376,8 @@ gtk_file_filter_filter (GtkFileFilter *filter,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
case FILTER_RULE_PATTERN:
|
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;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
case FILTER_RULE_CUSTOM:
|
case FILTER_RULE_CUSTOM:
|
||||||
|
@ -1228,25 +1228,33 @@ static gboolean
|
|||||||
file_model_node_is_visible (GtkFileSystemModel *model,
|
file_model_node_is_visible (GtkFileSystemModel *model,
|
||||||
FileModelNode *node)
|
FileModelNode *node)
|
||||||
{
|
{
|
||||||
if (model->show_hidden && model->show_folders && model->show_files)
|
if (model->show_folders != model->show_files ||
|
||||||
return TRUE;
|
!model->show_hidden ||
|
||||||
else
|
model->filter_func)
|
||||||
{
|
{
|
||||||
const GtkFileInfo *info = file_model_node_get_info (model, node);
|
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)
|
if (!info)
|
||||||
|
{
|
||||||
|
/* File probably disappeared underneath us or resides in a
|
||||||
|
directory where we have only partial access rights. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!model->show_files && !is_folder)
|
}
|
||||||
|
|
||||||
|
if (model->show_folders != model->show_files &&
|
||||||
|
model->show_folders != gtk_file_info_get_is_folder (info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!model->show_hidden && gtk_file_info_get_is_hidden (info))
|
if (!model->show_hidden && gtk_file_info_get_is_hidden (info))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (model->filter_func && !model->filter_func (model, node->path, info, model->filter_data))
|
|
||||||
|
if (model->filter_func &&
|
||||||
|
!model->filter_func (model, node->path, info, model->filter_data))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_model_node_clear (GtkFileSystemModel *model,
|
file_model_node_clear (GtkFileSystemModel *model,
|
||||||
|
@ -676,7 +676,15 @@ gtk_path_bar_set_path (GtkPathBar *path_bar,
|
|||||||
file_folder = gtk_file_system_get_folder (file_system, path,
|
file_folder = gtk_file_system_get_folder (file_system, path,
|
||||||
GTK_FILE_INFO_DISPLAY_NAME, NULL);
|
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);
|
display_name = gtk_file_info_get_display_name (file_info);
|
||||||
if (! strcmp ("/", display_name))
|
if (! strcmp ("/", display_name))
|
||||||
display_name = " / ";
|
display_name = " / ";
|
||||||
|
Loading…
Reference in New Issue
Block a user