filesystemmodel: Drop more unused api

Drop all apis that operate on tree iters.
We are no longer a tree model.
This commit is contained in:
Matthias Clasen 2022-10-12 00:38:42 -04:00
parent edd5ed169e
commit c19d0dc9ea
2 changed files with 0 additions and 151 deletions

View File

@ -981,110 +981,6 @@ _gtk_file_system_model_get_cancellable (GtkFileSystemModel *model)
return model->cancellable;
}
/**
* _gtk_file_system_model_iter_is_visible:
* @model: the model
* @iter: a valid iterator
*
* Checks if the iterator is visible. A visible iterator references
* a row that is currently exposed using the `GtkTreeModel` API.
*
* If the iterator is invisible, it references a file that is not shown
* for some reason, such as being filtered out by the current filter or
* being a hidden file.
*
* Returns: %TRUE if the iterator is visible
**/
gboolean
_gtk_file_system_model_iter_is_visible (GtkFileSystemModel *model,
GtkTreeIter *iter)
{
FileModelNode *node;
g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
node = get_node (model, ITER_INDEX (iter));
return node->visible;
}
/**
* _gtk_file_system_model_iter_is_filtered_out:
* @model: the model
* @iter: a valid iterator
*
* Checks if the iterator is filtered out. This is only useful for rows
* that refer to folders, as those are always visible regardless
* of what the current filter says. This function lets you see
* the results of the filter.
*
* Returns: %TRUE if the iterator passed the current filter; %FALSE if the
* filter would not have let the row pass.
**/
gboolean
_gtk_file_system_model_iter_is_filtered_out (GtkFileSystemModel *model,
GtkTreeIter *iter)
{
FileModelNode *node;
g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
node = get_node (model, ITER_INDEX (iter));
return node->filtered_out;
}
/**
* _gtk_file_system_model_get_info:
* @model: a `GtkFileSystemModel`
* @iter: a `GtkTreeIter` pointing to a row of @model
*
* Gets the `GFileInfo` for a particular row
* of @model.
*
* Returns: a `GFileInfo`. This value is owned by @model and must not
* be modified or freed. If you want to keep the information for
* later use, you must take a reference, since the `GFileInfo` may
* be freed on later changes to the file system.
*/
GFileInfo *
_gtk_file_system_model_get_info (GtkFileSystemModel *model,
GtkTreeIter *iter)
{
FileModelNode *node;
g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), NULL);
g_return_val_if_fail (iter != NULL, NULL);
node = get_node (model, ITER_INDEX (iter));
g_assert (node->info == NULL || G_IS_FILE_INFO (node->info));
return node->info;
}
/**
* _gtk_file_system_model_get_file:
* @model: a `GtkFileSystemModel`
* @iter: a `GtkTreeIter` pointing to a row of @model
*
* Gets the file for a particular row in @model.
*
* Returns: the file. This object is owned by @model and
* or freed. If you want to save the path for later use,
* you must take a ref, since the object may be freed
* on later changes to the file system.
**/
GFile *
_gtk_file_system_model_get_file (GtkFileSystemModel *model,
GtkTreeIter *iter)
{
FileModelNode *node;
g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), NULL);
node = get_node (model, ITER_INDEX (iter));
return node->file;
}
static guint
node_get_for_file (GtkFileSystemModel *model,
GFile * file)
@ -1115,41 +1011,6 @@ node_get_for_file (GtkFileSystemModel *model,
return 0;
}
/**
* _gtk_file_system_model_get_iter_for_file:
* @model: the model
* @iter: the iterator to be initialized
* @file: the file to look up
*
* Initializes @iter to point to the row used for @file, if @file is part
* of the model. Note that upon successful return, @iter may point to an
* invisible row in the @model. Use
* _gtk_file_system_model_iter_is_visible() to make sure it is visible to
* the tree view.
*
* Returns: %TRUE if file is part of the model and @iter was initialized
**/
gboolean
_gtk_file_system_model_get_iter_for_file (GtkFileSystemModel *model,
GtkTreeIter *iter,
GFile * file)
{
guint i;
g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
i = node_get_for_file (model, file);
if (i == 0)
return FALSE;
ITER_INIT_FROM_INDEX (model, iter, i);
return TRUE;
}
GFileInfo *
_gtk_file_system_model_get_info_for_file (GtkFileSystemModel *model,
GFile *file)

View File

@ -21,7 +21,6 @@
#include <gio/gio.h>
#include <gtk/gtkfilefilter.h>
#include <gtk/deprecated/gtktreemodel.h>
G_BEGIN_DECLS
@ -52,19 +51,8 @@ GtkFileSystemModel *_gtk_file_system_model_new_for_directory(GFile *
...);
GFile * _gtk_file_system_model_get_directory (GtkFileSystemModel *model);
GCancellable * _gtk_file_system_model_get_cancellable (GtkFileSystemModel *model);
gboolean _gtk_file_system_model_iter_is_visible (GtkFileSystemModel *model,
GtkTreeIter *iter);
gboolean _gtk_file_system_model_iter_is_filtered_out (GtkFileSystemModel *model,
GtkTreeIter *iter);
GFileInfo * _gtk_file_system_model_get_info (GtkFileSystemModel *model,
GtkTreeIter *iter);
gboolean _gtk_file_system_model_get_iter_for_file(GtkFileSystemModel *model,
GtkTreeIter *iter,
GFile *file);
GFileInfo * _gtk_file_system_model_get_info_for_file(GtkFileSystemModel *model,
GFile *file);
GFile * _gtk_file_system_model_get_file (GtkFileSystemModel *model,
GtkTreeIter *iter);
void _gtk_file_system_model_add_and_query_file (GtkFileSystemModel *model,
GFile *file,