diff --git a/ChangeLog b/ChangeLog index bdb42524a4..72d776f7b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * gtk/gtkfilechooserdefault.c: Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix for #162911. + (get_file_info, check_is_folder): Translate errors from + the filesystem into the GTK_FILE_CHOOSER_ERROR domain. Rest + of the fix for #162911, noticed by Murray Cumming. Wed Jan 5 11:42:49 2005 Søren Sandmann diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bdb42524a4..72d776f7b9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -2,6 +2,9 @@ * gtk/gtkfilechooserdefault.c: Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix for #162911. + (get_file_info, check_is_folder): Translate errors from + the filesystem into the GTK_FILE_CHOOSER_ERROR domain. Rest + of the fix for #162911, noticed by Murray Cumming. Wed Jan 5 11:42:49 2005 Søren Sandmann diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index bdb42524a4..72d776f7b9 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -2,6 +2,9 @@ * gtk/gtkfilechooserdefault.c: Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix for #162911. + (get_file_info, check_is_folder): Translate errors from + the filesystem into the GTK_FILE_CHOOSER_ERROR domain. Rest + of the fix for #162911, noticed by Murray Cumming. Wed Jan 5 11:42:49 2005 Søren Sandmann diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index bdb42524a4..72d776f7b9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -2,6 +2,9 @@ * gtk/gtkfilechooserdefault.c: Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix for #162911. + (get_file_info, check_is_folder): Translate errors from + the filesystem into the GTK_FILE_CHOOSER_ERROR domain. Rest + of the fix for #162911, noticed by Murray Cumming. Wed Jan 5 11:42:49 2005 Søren Sandmann diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 6e29c0c4cc..bf8722aa40 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -1080,36 +1080,55 @@ shortcuts_find_current_folder (GtkFileChooserDefault *impl) /* Convenience function to get the display name and icon info for a path */ static GtkFileInfo * -get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean name_only, GError **error) +get_file_info (GtkFileSystem *file_system, + const GtkFilePath *path, + gboolean name_only, + GError **error) { GtkFilePath *parent_path; GtkFileFolder *parent_folder; GtkFileInfo *info; + GError *tmp = NULL; + parent_path = NULL; info = NULL; - if (!gtk_file_system_get_parent (file_system, path, &parent_path, error)) - return NULL; + if (!gtk_file_system_get_parent (file_system, path, &parent_path, &tmp)) + goto out; parent_folder = gtk_file_system_get_folder (file_system, parent_path ? parent_path : path, GTK_FILE_INFO_DISPLAY_NAME | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER), - error); + &tmp); if (!parent_folder) goto out; - info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, error); + info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, &tmp); g_object_unref (parent_folder); out: + if (parent_path) + gtk_file_path_free (parent_path); + + if (tmp) + { + g_set_error (error, + GTK_FILE_CHOOSER_ERROR, + GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, + _("Could not get information about '%s': %s"), + gtk_file_path_get_string (path), + tmp->message); + g_error_free (tmp); + } - gtk_file_path_free (parent_path); return info; } /* Returns whether a path is a folder */ static gboolean -check_is_folder (GtkFileSystem *file_system, const GtkFilePath *path, GError **error) +check_is_folder (GtkFileSystem *file_system, + const GtkFilePath *path, + GError **error) { GtkFileInfo *info; gboolean is_folder; @@ -1129,7 +1148,7 @@ check_is_folder (GtkFileSystem *file_system, const GtkFilePath *path, GError **e if (!is_folder) g_set_error (error, GTK_FILE_CHOOSER_ERROR, - GTK_FILE_COOSER_ERROR_BAD_FILENAME, + GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, "%s: %s", gtk_file_info_get_display_name (info), g_strerror (ENOTDIR));