diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 7 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | gtk/gtkfilechooserdefault.c | 52 |
6 files changed, 66 insertions, 16 deletions
@@ -1,3 +1,10 @@ +2004-08-25 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkfilechooserdefault.c (check_is_folder): Use get_file_info() rather + than trying get_folder() and checking for an error directly because older + versions of the gnome-vfs backend don't return an error + immediately. (#150852, Zack Cerza ) + 2004-08-24 Matthias Clasen <mclasen@redhat.com> * NEWS: Update for 2.4.8 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 33007640a..d4f248bad 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2004-08-25 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkfilechooserdefault.c (check_is_folder): Use get_file_info() rather + than trying get_folder() and checking for an error directly because older + versions of the gnome-vfs backend don't return an error + immediately. (#150852, Zack Cerza ) + 2004-08-24 Matthias Clasen <mclasen@redhat.com> * NEWS: Update for 2.4.8 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 33007640a..d4f248bad 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2004-08-25 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkfilechooserdefault.c (check_is_folder): Use get_file_info() rather + than trying get_folder() and checking for an error directly because older + versions of the gnome-vfs backend don't return an error + immediately. (#150852, Zack Cerza ) + 2004-08-24 Matthias Clasen <mclasen@redhat.com> * NEWS: Update for 2.4.8 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 33007640a..d4f248bad 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2004-08-25 Matthias Clasen <mclasen@redhat.com> + + * gtk/gtkfilechooserdefault.c (check_is_folder): Use get_file_info() rather + than trying get_folder() and checking for an error directly because older + versions of the gnome-vfs backend don't return an error + immediately. (#150852, Zack Cerza ) + 2004-08-24 Matthias Clasen <mclasen@redhat.com> * NEWS: Update for 2.4.8 @@ -2,6 +2,8 @@ Overview of Changes from GTK+ 2.4.7 to GTK+ 2.4.8 ================================================= * GtkFileChooser - Fix some memory leaks [Federico Mena Quintero] + - Make save mode work with old versions of the gnome-vfs + backend. [Zack Cerza] * GtkEntryCompletion - Warn if text column has wrong type [Fernando San Martin Woerner, Gustavo Carneiro] diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index e8df25a1c..f6a371d6d 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -69,6 +69,7 @@ #include "gtkfilesystemwin32.h" #endif +#include <errno.h> #include <string.h> #include <time.h> @@ -990,22 +991,6 @@ shortcuts_find_current_folder (GtkFileChooserDefault *impl) gtk_tree_path_free (path); } -/* Returns whether a path is a folder */ -static gboolean -check_is_folder (GtkFileSystem *file_system, const GtkFilePath *path, GError **error) -{ - GtkFileFolder *folder; - - folder = gtk_file_system_get_folder (file_system, path, - GTK_FILE_INFO_DISPLAY_NAME, - error); - if (!folder) - return FALSE; - - g_object_unref (folder); - return TRUE; -} - /* 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) @@ -1035,6 +1020,41 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean nam return info; } +/* Returns whether a path is a folder */ +static gboolean +check_is_folder (GtkFileSystem *file_system, const GtkFilePath *path, GError **error) +{ + GtkFileInfo *info; + gboolean is_folder; + + /* Use get_file_info() rather than trying get_folder() and checking + * for an error directly because older versions of the gnome-vfs + * backend don't return an error immediately. This way is also + * more efficient if we already have the parent folder. + */ + info = get_file_info (file_system, path, FALSE, error); + + if (!info) + return FALSE; + + is_folder = gtk_file_info_get_is_folder (info); + gtk_file_info_free (info); + + if (!is_folder) + { + g_set_error (error, + GTK_FILE_SYSTEM_ERROR, + GTK_FILE_SYSTEM_ERROR_NOT_FOLDER, + "%s: %s", + gtk_file_info_get_display_name (info), + g_strerror (ENOTDIR)); + + return FALSE; + } + + return TRUE; +} + /* Inserts a path in the shortcuts tree, making a copy of it; alternatively, * inserts a volume. A position of -1 indicates the end of the tree. */ |