summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserdefault.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2004-03-03 00:38:19 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2004-03-03 00:38:19 +0000
commite50fb6876339163a7c57d48742fc019590800334 (patch)
tree36e651ba7f7f6e0ee24bca2bed9ec7d65dff2c52 /gtk/gtkfilechooserdefault.c
parent2169f50919be21b48fe1916af7ab663ac8d0b1a7 (diff)
downloadgdk-pixbuf-e50fb6876339163a7c57d48742fc019590800334.tar.gz
Handle errors in setting the path bar's path. Fixes #136000, based on a
2004-03-02 Federico Mena Quintero <federico@ximian.com> * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_set_current_folder): Handle errors in setting the path bar's path. Fixes #136000, based on a patch by Morten Welinder. * gtk/gtkfilesystemunix.c (gtk_file_system_unix_insert_bookmark): Don't free our own propagated error. * gtk/gtkpathbar.c (gtk_path_bar_set_path): Likewise, and free the parent_path upon error. Fixes #136006, patch by Morten Welinder. (gtk_path_bar_set_path): Unref the file_folder upon error. (gtk_path_bar_set_path): Return a boolean success code.
Diffstat (limited to 'gtk/gtkfilechooserdefault.c')
-rw-r--r--gtk/gtkfilechooserdefault.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 9e4e9df98..ca0d7c1c1 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -468,7 +468,7 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
0);
_gtk_file_chooser_install_properties (gobject_class);
-
+
gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend",
P_("Default file chooser backend"),
P_("Name of the GtkFileChooser backend to use by default"),
@@ -2245,7 +2245,7 @@ set_file_system_backend (GtkFileChooserDefault *impl,
{
GtkSettings *settings = gtk_settings_get_default ();
gchar *default_backend = NULL;
-
+
g_object_get (settings, "gtk-file-chooser-backend", &default_backend, NULL);
if (default_backend)
{
@@ -2837,14 +2837,24 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
const GtkFilePath *path)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
+ GError *error;
- if (impl->current_folder)
- gtk_file_path_free (impl->current_folder);
+ error = NULL;
+ if (!gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, impl->file_system, &error))
+ {
+ error_dialog (impl,
+ _("Could not set current folder: %s"),
+ path, error);
+ return;
+ }
- impl->current_folder = gtk_file_path_copy (path);
+ if (impl->current_folder != path)
+ {
+ if (impl->current_folder)
+ gtk_file_path_free (impl->current_folder);
- /* Change the current folder label */
- gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, impl->file_system, NULL);
+ impl->current_folder = gtk_file_path_copy (path);
+ }
/* Update the widgets that may trigger a folder chnage themselves */
@@ -3362,12 +3372,12 @@ gtk_file_chooser_default_get_resizable_hints (GtkFileChooserEmbed *chooser_embed
g_return_if_fail (resize_horizontally != NULL);
g_return_if_fail (resize_vertically != NULL);
-
+
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed);
*resize_horizontally = TRUE;
*resize_vertically = TRUE;
-
+
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{