New get_volume_for_path() method. (struct _GtkFileSystemIface): Finally

2004-01-16  Federico Mena Quintero  <federico@ximian.com>

	* gtk/gtkfilesystem.h (struct _GtkFileSystemIface): New
	get_volume_for_path() method.
	(struct _GtkFileSystemIface): Finally removed the list_roots() and
	get_root_info() methods, and the "roots-changed" signal.

	* gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): New
	function.
	(gtk_file_system_list_roots): Removed.
	(gtk_file_system_get_root_info): Removed.

	* gtk/gtkfilesystemunix.c
	(gtk_file_system_unix_get_volume_for_path): Implement.
	(get_root_volume): New helper function.
	(gtk_file_system_unix_list_volumes): Use get_root_volume().
	(gtk_file_system_unix_list_roots): Removed.
	(gtk_file_system_unix_get_root_info): Removed.

	* gtk/gtkfilesystemmodel.c (_gtk_file_system_model_new): Don't
	accept a NULL root_path.
	(struct _GtkFileSystemModel): Add a field to remember the
	root_path.
	(_gtk_file_system_model_new): Store the root_path in the model
	structure.
	(find_and_ref_path): Stop going up the hierarchy at the root_path
	of the model.  Also, don't return prematurely when walking up the
	hierarchy.

	* gtk/gtkfilechooserdefault.c (create_file_list): Sigh, restore
	the rules_hint.
	(struct _GtkFileChooserDefault): Added a current_volume_path field.
	(set_tree_model): New function; create the folder tree model here.
	(create_folder_tree): Don't create the model here.
	(set_list_model): Set the show_hidden flag on the list model.
This commit is contained in:
Federico Mena Quintero
2004-01-16 03:35:33 +00:00
committed by Federico Mena Quintero
parent c13c0a01d8
commit f2f12b9aae
10 changed files with 278 additions and 86 deletions

View File

@ -83,12 +83,10 @@ static void gtk_file_system_unix_iface_init (GtkFileSystemIface *iface);
static void gtk_file_system_unix_init (GtkFileSystemUnix *impl);
static void gtk_file_system_unix_finalize (GObject *object);
static GSList * gtk_file_system_unix_list_volumes (GtkFileSystem *file_system);
static GSList * gtk_file_system_unix_list_roots (GtkFileSystem *file_system);
static GtkFileInfo * gtk_file_system_unix_get_root_info (GtkFileSystem *file_system,
const GtkFilePath *path,
GtkFileInfoType types,
GError **error);
static GSList * gtk_file_system_unix_list_volumes (GtkFileSystem *file_system);
static GtkFileSystemVolume *gtk_file_system_unix_get_volume_for_path (GtkFileSystem *file_system,
const GtkFilePath *path);
static GtkFileFolder *gtk_file_system_unix_get_folder (GtkFileSystem *file_system,
const GtkFilePath *path,
GtkFileInfoType types,
@ -243,9 +241,8 @@ static void
gtk_file_system_unix_iface_init (GtkFileSystemIface *iface)
{
iface->list_volumes = gtk_file_system_unix_list_volumes;
iface->list_roots = gtk_file_system_unix_list_roots;
iface->get_volume_for_path = gtk_file_system_unix_get_volume_for_path;
iface->get_folder = gtk_file_system_unix_get_folder;
iface->get_root_info = gtk_file_system_unix_get_root_info;
iface->create_folder = gtk_file_system_unix_create_folder;
iface->volume_free = gtk_file_system_unix_volume_free;
iface->volume_get_base_path = gtk_file_system_unix_volume_get_base_path;
@ -277,29 +274,24 @@ gtk_file_system_unix_finalize (GObject *object)
system_parent_class->finalize (object);
}
/* Returns our single root volume */
static GtkFileSystemVolume *
get_root_volume (void)
{
return (GtkFileSystemVolume *) gtk_file_path_new_dup ("/");
}
static GSList *
gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
{
return g_slist_append (NULL, gtk_file_path_new_dup ("/"));
return g_slist_append (NULL, get_root_volume ());
}
static GSList *
gtk_file_system_unix_list_roots (GtkFileSystem *file_system)
static GtkFileSystemVolume *
gtk_file_system_unix_get_volume_for_path (GtkFileSystem *file_system,
const GtkFilePath *path)
{
return g_slist_append (NULL, gtk_file_path_new_dup ("/"));
}
static GtkFileInfo *
gtk_file_system_unix_get_root_info (GtkFileSystem *file_system,
const GtkFilePath *path,
GtkFileInfoType types,
GError **error)
{
const gchar *filename = gtk_file_path_get_string (path);
g_return_val_if_fail (strcmp (filename, "/") == 0, NULL);
return filename_get_info ("/", types, error);
return get_root_volume ();
}
static GtkFileFolder *