revert earlier change to insert_path so that we test that the directory

Thu Mar 11 16:18:51 2004  Jonathan Blandford  <jrb@redhat.com>

        * gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
        earlier change to insert_path so that we test that the directory
        exists.

        * gtk/gtkfilechooserdialog.c
        (gtk_file_chooser_dialog_constructor): move focus.
This commit is contained in:
Jonathan Blandford 2004-03-11 21:23:16 +00:00 committed by Jonathan Blandford
parent c20280810a
commit 865d3dd267
7 changed files with 64 additions and 29 deletions

View File

@ -1,3 +1,12 @@
Thu Mar 11 16:18:51 2004 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
earlier change to insert_path so that we test that the directory
exists.
* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): move focus.
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de> Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same * gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same

View File

@ -1,3 +1,12 @@
Thu Mar 11 16:18:51 2004 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
earlier change to insert_path so that we test that the directory
exists.
* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): move focus.
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de> Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same * gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same

View File

@ -1,3 +1,12 @@
Thu Mar 11 16:18:51 2004 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
earlier change to insert_path so that we test that the directory
exists.
* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): move focus.
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de> Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same * gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same

View File

@ -1,3 +1,12 @@
Thu Mar 11 16:18:51 2004 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
earlier change to insert_path so that we test that the directory
exists.
* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): move focus.
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de> Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same * gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same

View File

@ -1,3 +1,12 @@
Thu Mar 11 16:18:51 2004 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkfilechooserdefault.c (shortcuts_insert_path): revert
earlier change to insert_path so that we test that the directory
exists.
* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): move focus.
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de> Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same * gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same

View File

@ -878,6 +878,8 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean nam
GtkFileFolder *parent_folder; GtkFileFolder *parent_folder;
GtkFileInfo *info; GtkFileInfo *info;
info = NULL;
if (!gtk_file_system_get_parent (file_system, path, &parent_path, error)) if (!gtk_file_system_get_parent (file_system, path, &parent_path, error))
return NULL; return NULL;
@ -890,17 +892,11 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean nam
error); error);
gtk_file_path_free (parent_path); gtk_file_path_free (parent_path);
if (parent_folder) if (!parent_folder)
{ return NULL;
info = gtk_file_folder_get_info (parent_folder, path, error);
g_object_unref (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; return info;
} }
@ -923,10 +919,6 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
gpointer data; gpointer data;
GtkTreeIter iter; GtkTreeIter iter;
/* Note: currently this function cannot fail. If you ever change
* it so it can, go check callers and their callers.
*/
if (is_volume) if (is_volume)
{ {
data = volume; data = volume;
@ -936,14 +928,18 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
} }
else 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) if (label)
label_copy = g_strdup (label); label_copy = g_strdup (label);
else else
{ label_copy = g_strdup (gtk_file_info_get_display_name (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);
gtk_file_info_free (info);
}
data = gtk_file_path_copy (path); data = gtk_file_path_copy (path);
pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
@ -3940,15 +3936,8 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
{ {
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
gboolean result; gboolean result;
GtkFileInfo *info;
int pos; 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); pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error); result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);

View File

@ -331,19 +331,20 @@ gtk_file_chooser_dialog_constructor (GType type,
else else
priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL); priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL);
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
g_signal_connect (priv->widget, "file-activated", g_signal_connect (priv->widget, "file-activated",
G_CALLBACK (file_chooser_widget_file_activated), object); G_CALLBACK (file_chooser_widget_file_activated), object);
g_signal_connect (priv->widget, "default-size-changed", g_signal_connect (priv->widget, "default-size-changed",
G_CALLBACK (file_chooser_widget_default_size_changed), object); G_CALLBACK (file_chooser_widget_default_size_changed), object);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
gtk_widget_show (priv->widget); gtk_widget_show (priv->widget);
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object), _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
GTK_FILE_CHOOSER (priv->widget)); GTK_FILE_CHOOSER (priv->widget));
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
gtk_widget_pop_composite_child (); gtk_widget_pop_composite_child ();
return object; return object;