summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-01-05 17:18:01 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-01-05 17:18:01 +0000
commit9359ede29b24d2cea33f864397f2e004a390b0e0 (patch)
tree0164d4f94dc67679d947d093e57c271537dd9115 /gtk
parent7794fa7f5731ad62b89117fa3ac7c9db9fc01992 (diff)
downloadgtk+-9359ede29b24d2cea33f864397f2e004a390b0e0.tar.gz
Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix
2005-01-05 Matthias Clasen <mclasen@redhat.com> * 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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkfilechooserdefault.c35
1 files changed, 27 insertions, 8 deletions
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));