Commit e4ef01a7 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Use get_file_info() rather than trying get_folder() and checking for an

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 )
parent 2a1e74ae
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-25 Matthias Clasen <mclasen@redhat.com>
* configure.in: Post-release version bump.
......
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-25 Matthias Clasen <mclasen@redhat.com>
* configure.in: Post-release version bump.
......
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-25 Matthias Clasen <mclasen@redhat.com>
* configure.in: Post-release version bump.
......
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-25 Matthias Clasen <mclasen@redhat.com>
* configure.in: Post-release version bump.
......
......@@ -996,22 +996,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)
......@@ -1041,6 +1025,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.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment