]> Pileus Git - ~andy/gtk/commitdiff
Don't construct errors from the GTK_FILE_SYSTEM_ERROR domain. Partial fix
authorMatthias Clasen <mclasen@redhat.com>
Wed, 5 Jan 2005 17:18:01 +0000 (17:18 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 5 Jan 2005 17:18:01 +0000 (17:18 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c

index bdb42524a4a45b440cccbf0bd987ab3345f74ff6..72d776f7b9c36a342a86ff0842d169ce81e4d42e 100644 (file)
--- 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  <sandmann@redhat.com>
 
index bdb42524a4a45b440cccbf0bd987ab3345f74ff6..72d776f7b9c36a342a86ff0842d169ce81e4d42e 100644 (file)
@@ -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  <sandmann@redhat.com>
 
index bdb42524a4a45b440cccbf0bd987ab3345f74ff6..72d776f7b9c36a342a86ff0842d169ce81e4d42e 100644 (file)
@@ -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  <sandmann@redhat.com>
 
index bdb42524a4a45b440cccbf0bd987ab3345f74ff6..72d776f7b9c36a342a86ff0842d169ce81e4d42e 100644 (file)
@@ -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  <sandmann@redhat.com>
 
index 6e29c0c4cc4ad9a671a692a1ff32c6fb3cb993cb..bf8722aa4051e1dd277dceba7fcb41640c4be1c1 100644 (file)
@@ -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));