forked from AuroraMiddleware/gtk
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:
parent
c13c0a01d8
commit
f2f12b9aae
36
ChangeLog
36
ChangeLog
@ -1,3 +1,39 @@
|
||||
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.
|
||||
|
||||
Fri Jan 16 00:04:43 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtknotebook.h:
|
||||
|
@ -1,3 +1,39 @@
|
||||
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.
|
||||
|
||||
Fri Jan 16 00:04:43 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtknotebook.h:
|
||||
|
@ -1,3 +1,39 @@
|
||||
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.
|
||||
|
||||
Fri Jan 16 00:04:43 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtknotebook.h:
|
||||
|
@ -1,3 +1,39 @@
|
||||
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.
|
||||
|
||||
Fri Jan 16 00:04:43 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtknotebook.h:
|
||||
|
@ -1,3 +1,39 @@
|
||||
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.
|
||||
|
||||
Fri Jan 16 00:04:43 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtknotebook.h:
|
||||
|
@ -93,6 +93,7 @@ struct _GtkFileChooserDefault
|
||||
|
||||
guint bookmarks_changed_id;
|
||||
|
||||
GtkFilePath *current_volume_path;
|
||||
GtkFilePath *current_folder;
|
||||
GtkFilePath *preview_path;
|
||||
|
||||
@ -787,7 +788,6 @@ static void
|
||||
shortcuts_append_bookmarks (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GSList *bookmarks;
|
||||
|
||||
gtk_tree_store_append (impl->shortcuts_model, &iter, NULL);
|
||||
gtk_tree_store_set (impl->shortcuts_model, &iter,
|
||||
@ -982,15 +982,6 @@ create_folder_tree (GtkFileChooserDefault *impl)
|
||||
gtk_container_add (GTK_CONTAINER (impl->tree_scrollwin), impl->tree);
|
||||
gtk_widget_show (impl->tree);
|
||||
|
||||
/* Model */
|
||||
|
||||
impl->tree_model = _gtk_file_system_model_new (impl->file_system, NULL, -1,
|
||||
GTK_FILE_INFO_DISPLAY_NAME);
|
||||
_gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
|
||||
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
|
||||
GTK_TREE_MODEL (impl->tree_model));
|
||||
|
||||
/* Column */
|
||||
|
||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0,
|
||||
@ -1336,6 +1327,7 @@ create_file_list (GtkFileChooserDefault *impl)
|
||||
/* Tree/list view */
|
||||
|
||||
impl->list = gtk_tree_view_new ();
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->list), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (impl->list_scrollwin), impl->list);
|
||||
g_signal_connect (impl->list, "row_activated",
|
||||
G_CALLBACK (list_row_activated), impl);
|
||||
@ -1878,6 +1870,7 @@ set_list_model (GtkFileChooserDefault *impl)
|
||||
GTK_FILE_INFO_IS_FOLDER |
|
||||
GTK_FILE_INFO_SIZE |
|
||||
GTK_FILE_INFO_MODIFICATION_TIME);
|
||||
_gtk_file_system_model_set_show_hidden (impl->list_model, impl->show_hidden);
|
||||
install_list_model_filter (impl);
|
||||
|
||||
impl->sort_model = (GtkTreeModelSort *)gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (impl->list_model));
|
||||
@ -1898,6 +1891,40 @@ set_list_model (GtkFileChooserDefault *impl)
|
||||
GTK_FILE_SYSTEM_MODEL_DISPLAY_NAME);
|
||||
}
|
||||
|
||||
/* Gets rid of the old folder tree model and creates a new one for the volume
|
||||
* corresponding to the specified path.
|
||||
*/
|
||||
static void
|
||||
set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path)
|
||||
{
|
||||
GtkFileSystemVolume *volume;
|
||||
GtkFilePath *volume_path;
|
||||
|
||||
volume = gtk_file_system_get_volume_for_path (impl->file_system, path);
|
||||
volume_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
|
||||
|
||||
if (impl->current_volume_path && gtk_file_path_compare (volume_path, impl->current_volume_path) == 0)
|
||||
goto out;
|
||||
|
||||
if (impl->tree_model)
|
||||
g_object_unref (impl->tree_model);
|
||||
|
||||
impl->current_volume_path = gtk_file_path_copy (volume_path);
|
||||
|
||||
impl->tree_model = _gtk_file_system_model_new (impl->file_system, impl->current_volume_path, -1,
|
||||
GTK_FILE_INFO_DISPLAY_NAME);
|
||||
_gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
|
||||
_gtk_file_system_model_set_show_hidden (impl->tree_model, impl->show_hidden);
|
||||
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
|
||||
GTK_TREE_MODEL (impl->tree_model));
|
||||
|
||||
out:
|
||||
|
||||
gtk_file_path_free (volume_path);
|
||||
gtk_file_system_volume_free (impl->file_system, volume);
|
||||
}
|
||||
|
||||
static void
|
||||
update_chooser_entry (GtkFileChooserDefault *impl)
|
||||
{
|
||||
@ -1943,11 +1970,12 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
|
||||
gtk_label_set_text (GTK_LABEL (impl->folder_label), str);
|
||||
g_free (str);
|
||||
|
||||
/* Notify the folder tree */
|
||||
/* Update the folder tree */
|
||||
|
||||
if (!impl->changing_folder)
|
||||
{
|
||||
impl->changing_folder = TRUE;
|
||||
set_tree_model (impl, impl->current_folder);
|
||||
_gtk_file_system_model_path_do (impl->tree_model, path,
|
||||
expand_and_select_func, impl);
|
||||
impl->changing_folder = FALSE;
|
||||
|
@ -454,13 +454,6 @@ gtk_file_system_base_init (gpointer g_class)
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
g_signal_new ("roots-changed",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkFileSystemIface, roots_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
g_signal_new ("bookmarks-changed",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
@ -481,27 +474,6 @@ gtk_file_system_list_volumes (GtkFileSystem *file_system)
|
||||
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->list_volumes (file_system);
|
||||
}
|
||||
|
||||
GSList *
|
||||
gtk_file_system_list_roots (GtkFileSystem *file_system)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
|
||||
|
||||
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->list_roots (file_system);
|
||||
}
|
||||
|
||||
GtkFileInfo *
|
||||
gtk_file_system_get_root_info (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path,
|
||||
GtkFileInfoType types,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_root_info (file_system, path, types, error);
|
||||
}
|
||||
|
||||
GtkFileFolder *
|
||||
gtk_file_system_get_folder (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path,
|
||||
@ -527,6 +499,26 @@ gtk_file_system_create_folder(GtkFileSystem *file_system,
|
||||
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->create_folder (file_system, path, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_file_system_get_volume_for_path:
|
||||
* @file_system: a #GtkFileSystem
|
||||
* @path: a #GtkFilePath
|
||||
*
|
||||
* Queries the file system volume that corresponds to a specific path.
|
||||
*
|
||||
* Return value: the #GtkFileSystemVolume that corresponds to the specified
|
||||
* @path. You should free this value with gtk_file_system_volume_free().
|
||||
**/
|
||||
GtkFileSystemVolume *
|
||||
gtk_file_system_get_volume_for_path (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
|
||||
return GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_volume_for_path (file_system, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_file_system_volume_free:
|
||||
* @file_system: a #GtkFileSystem
|
||||
@ -1016,7 +1008,7 @@ gtk_file_paths_sort (GSList *paths)
|
||||
|
||||
/**
|
||||
* gtk_file_paths_copy:
|
||||
* @paths: A #GSList of 3GtkFilePath structures.
|
||||
* @paths: A #GSList of #GtkFilePath structures.
|
||||
*
|
||||
* Copies a list of #GtkFilePath structures.
|
||||
*
|
||||
|
@ -144,13 +144,9 @@ struct _GtkFileSystemIface
|
||||
|
||||
/* Methods
|
||||
*/
|
||||
GSList * (*list_volumes) (GtkFileSystem *file_system);
|
||||
GSList * (*list_roots) (GtkFileSystem *file_system);
|
||||
|
||||
GtkFileInfo * (*get_root_info) (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path,
|
||||
GtkFileInfoType types,
|
||||
GError **error);
|
||||
GSList * (*list_volumes) (GtkFileSystem *file_system);
|
||||
GtkFileSystemVolume * (*get_volume_for_path) (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path);
|
||||
|
||||
GtkFileFolder * (*get_folder) (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path,
|
||||
@ -226,18 +222,15 @@ struct _GtkFileSystemIface
|
||||
/* Signals
|
||||
*/
|
||||
void (*volumes_changed) (GtkFileSystem *file_system);
|
||||
void (*roots_changed) (GtkFileSystem *file_system);
|
||||
void (*bookmarks_changed) (GtkFileSystem *file_system);
|
||||
};
|
||||
|
||||
GType gtk_file_system_get_type (void);
|
||||
|
||||
GSList * gtk_file_system_list_volumes (GtkFileSystem *file_system);
|
||||
GSList * gtk_file_system_list_roots (GtkFileSystem *file_system);
|
||||
GtkFileInfo * gtk_file_system_get_root_info (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path,
|
||||
GtkFileInfoType types,
|
||||
GError **error);
|
||||
|
||||
GtkFileSystemVolume *gtk_file_system_get_volume_for_path (GtkFileSystem *file_system,
|
||||
const GtkFilePath *path);
|
||||
|
||||
void gtk_file_system_volume_free (GtkFileSystem *file_system,
|
||||
GtkFileSystemVolume *volume);
|
||||
|
@ -45,6 +45,7 @@ struct _GtkFileSystemModel
|
||||
GtkFileInfoType types;
|
||||
FileModelNode *roots;
|
||||
GtkFileFolder *root_folder;
|
||||
GtkFilePath *root_path;
|
||||
|
||||
GtkFileSystemModelFilter filter_func;
|
||||
gpointer filter_data;
|
||||
@ -143,8 +144,10 @@ static void file_model_node_clear (GtkFileSystemModel *mode
|
||||
static FileModelNode * file_model_node_get_children (GtkFileSystemModel *model,
|
||||
FileModelNode *node);
|
||||
|
||||
#if 0
|
||||
static void roots_changed_callback (GtkFileSystem *file_system,
|
||||
GtkFileSystemModel *model);
|
||||
#endif
|
||||
|
||||
static void deleted_callback (GtkFileFolder *folder,
|
||||
FileModelNode *node);
|
||||
@ -539,9 +542,7 @@ gtk_file_system_model_unref_node (GtkTreeModel *tree_model,
|
||||
/**
|
||||
* _gtk_file_system_model_new:
|
||||
* @file_system: an object implementing #GtkFileSystem
|
||||
* @root_path: the path of root of the file system to display,
|
||||
* or %NULL to display starting from the
|
||||
* root or roots of the fielsystem.
|
||||
* @root_path: the path of root of the file system to display
|
||||
* @max_depth: the maximum depth from the children of @root_path
|
||||
* or the roots of the file system to display in
|
||||
* the file selector). A depth of 0 displays
|
||||
@ -571,6 +572,7 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
|
||||
GSList *tmp_list;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
|
||||
g_return_val_if_fail (root_path != NULL, NULL);
|
||||
|
||||
model = g_object_new (GTK_TYPE_FILE_SYSTEM_MODEL, NULL);
|
||||
model->file_system = g_object_ref (file_system);
|
||||
@ -583,7 +585,8 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
|
||||
if (root_path)
|
||||
{
|
||||
GSList *child_paths;
|
||||
|
||||
|
||||
model->root_path = gtk_file_path_copy (root_path);
|
||||
model->root_folder = gtk_file_system_get_folder (file_system, root_path,
|
||||
model->types,
|
||||
NULL); /* NULL-GError */
|
||||
@ -605,12 +608,14 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
|
||||
G_CALLBACK (root_files_removed_callback), model, 0);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
roots = gtk_file_system_list_roots (file_system);
|
||||
g_signal_connect_object (file_system, "roots-changed",
|
||||
G_CALLBACK (roots_changed_callback), model, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
roots = gtk_file_paths_sort (roots);
|
||||
|
||||
@ -859,16 +864,14 @@ find_and_ref_path (GtkFileSystemModel *model,
|
||||
FileModelNode *child_node;
|
||||
GtkFileFolder *folder;
|
||||
|
||||
if (!gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
|
||||
if (gtk_file_path_compare (path, model->root_path) == 0
|
||||
|| !gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
|
||||
return NULL;
|
||||
|
||||
if (parent_path)
|
||||
{
|
||||
parent_node = find_and_ref_path (model, parent_path, cleanups);
|
||||
gtk_file_path_free (parent_path);
|
||||
|
||||
if (!parent_node)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
parent_node = NULL;
|
||||
@ -1023,6 +1026,7 @@ file_model_node_get_info (GtkFileSystemModel *model,
|
||||
node->path,
|
||||
NULL); /* NULL-GError */
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
node->info = gtk_file_system_get_root_info (model->file_system,
|
||||
@ -1030,6 +1034,7 @@ file_model_node_get_info (GtkFileSystemModel *model,
|
||||
model->types,
|
||||
NULL); /* NULL-GError */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return node->info;
|
||||
@ -1557,6 +1562,7 @@ do_files_removed (GtkFileSystemModel *model,
|
||||
g_slist_free (sorted_paths);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
roots_changed_callback (GtkFileSystem *file_system,
|
||||
GtkFileSystemModel *model)
|
||||
@ -1653,6 +1659,7 @@ roots_changed_callback (GtkFileSystem *file_system,
|
||||
g_slist_free (new_roots);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
deleted_callback (GtkFileFolder *folder,
|
||||
|
@ -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 *
|
||||
|
Loading…
Reference in New Issue
Block a user