Test validity of path here. (shortcuts_insert_path): Don't check here.

2004-03-10  Morten Welinder  <terra@gnome.org>

	* gtk/gtkfilechooserdefault.c
	(gtk_file_chooser_default_add_shortcut_folder): Test validity of
	path here.
	(shortcuts_insert_path): Don't check here.
	(get_file_info): Barf if name-only fails.
This commit is contained in:
Morten Welinder 2004-03-10 17:55:16 +00:00 committed by Morten Welinder
parent 2e49ab24f4
commit 3f5ec9fe02
6 changed files with 53 additions and 15 deletions

View File

@ -1,5 +1,11 @@
2004-03-10 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Test validity of
path here.
(shortcuts_insert_path): Don't check here.
(get_file_info): Barf if name-only fails.
* tests/testfilechooser.c (main): Add support for --multiple.
Wed Mar 10 02:41:05 2004 Jonathan Blandford <jrb@gnome.org>

View File

@ -1,5 +1,11 @@
2004-03-10 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Test validity of
path here.
(shortcuts_insert_path): Don't check here.
(get_file_info): Barf if name-only fails.
* tests/testfilechooser.c (main): Add support for --multiple.
Wed Mar 10 02:41:05 2004 Jonathan Blandford <jrb@gnome.org>

View File

@ -1,5 +1,11 @@
2004-03-10 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Test validity of
path here.
(shortcuts_insert_path): Don't check here.
(get_file_info): Barf if name-only fails.
* tests/testfilechooser.c (main): Add support for --multiple.
Wed Mar 10 02:41:05 2004 Jonathan Blandford <jrb@gnome.org>

View File

@ -1,5 +1,11 @@
2004-03-10 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Test validity of
path here.
(shortcuts_insert_path): Don't check here.
(get_file_info): Barf if name-only fails.
* tests/testfilechooser.c (main): Add support for --multiple.
Wed Mar 10 02:41:05 2004 Jonathan Blandford <jrb@gnome.org>

View File

@ -1,5 +1,11 @@
2004-03-10 Morten Welinder <terra@gnome.org>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_add_shortcut_folder): Test validity of
path here.
(shortcuts_insert_path): Don't check here.
(get_file_info): Barf if name-only fails.
* tests/testfilechooser.c (main): Add support for --multiple.
Wed Mar 10 02:41:05 2004 Jonathan Blandford <jrb@gnome.org>

View File

@ -822,8 +822,6 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean nam
GtkFileFolder *parent_folder;
GtkFileInfo *info;
info = NULL;
if (!gtk_file_system_get_parent (file_system, path, &parent_path, error))
return NULL;
@ -836,11 +834,17 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean nam
error);
gtk_file_path_free (parent_path);
if (!parent_folder)
return NULL;
info = gtk_file_folder_get_info (parent_folder, path, error);
g_object_unref (parent_folder);
if (parent_folder)
{
info = gtk_file_folder_get_info (parent_folder, path, error);
g_object_unref (parent_folder);
}
else
{
info = NULL;
/* Name-only should not fail. */
g_return_val_if_fail (!name_only, NULL);
}
return info;
}
@ -872,17 +876,14 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
}
else
{
/* Always check to make sure that the directory exists. */
GtkFileInfo *info = get_file_info (impl->file_system, path, FALSE, error);
if (info == NULL)
return FALSE;
if (label)
label_copy = g_strdup (label);
else
label_copy = g_strdup (gtk_file_info_get_display_name (info));
gtk_file_info_free (info);
{
GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
label_copy = g_strdup (gtk_file_info_get_display_name (info));
gtk_file_info_free (info);
}
data = gtk_file_path_copy (path);
pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
@ -3402,8 +3403,15 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
gboolean result;
GtkFileInfo *info;
int pos;
/* Test validity of path here. */
info = get_file_info (impl->file_system, path, FALSE, error);
if (!info)
return FALSE;
gtk_file_info_free (info);
pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);