filesystemmodel: Don't expose cache

With this commit we start slowly cleaning up the sattelite code
surrounding GtkFileChooserWidget, so that we eventually drop it
all.
This commit is contained in:
Georges Basile Stavracas Neto
2022-10-08 10:12:41 -03:00
committed by Matthias Clasen
parent 3b53a6b0a9
commit 038cb31d27
3 changed files with 0 additions and 72 deletions

View File

@@ -519,8 +519,6 @@ static void recent_start_loading (GtkFileChooserWidget *impl);
static void recent_clear_model (GtkFileChooserWidget *impl,
gboolean remove_from_treeview);
static gboolean recent_should_respond (GtkFileChooserWidget *impl);
static void clear_model_cache (GtkFileChooserWidget *impl,
int column);
static void set_model_filter (GtkFileChooserWidget *impl,
GtkFileFilter *filter);
static void switch_to_home_dir (GtkFileChooserWidget *impl);
@@ -1587,20 +1585,6 @@ change_sort_directories_first_state (GSimpleAction *action,
impl->sort_order);
}
static void
clear_model_cache (GtkFileChooserWidget *impl,
int column)
{
if (impl->browse_files_model)
_gtk_file_system_model_clear_cache (impl->browse_files_model, column);
if (impl->search_model)
_gtk_file_system_model_clear_cache (impl->search_model, column);
if (impl->recent_model)
_gtk_file_system_model_clear_cache (impl->recent_model, column);
}
static void
set_model_filter (GtkFileChooserWidget *impl,
GtkFileFilter *filter)
@@ -6783,7 +6767,6 @@ set_current_filter (GtkFileChooserWidget *impl,
gtk_drop_down_set_selected (GTK_DROP_DOWN (impl->filter_combo), filter_index);
clear_model_cache (impl, MODEL_COL_IS_SENSITIVE);
set_model_filter (impl, impl->current_filter);
g_object_notify (G_OBJECT (impl), "filter");
}

View File

@@ -2156,59 +2156,6 @@ thaw_updates (GtkFileSystemModel *model)
}
}
/**
* _gtk_file_system_model_clear_cache:
* @model: a `GtkFileSystemModel`
* @column: the column to clear or -1 for all columns
*
* Clears the cached values in the model for the given @column. Use
* this function whenever your get_value function would return different
* values for a column.
* The file chooser uses this for example when the icon theme changes to
* invalidate the cached pixbufs.
**/
void
_gtk_file_system_model_clear_cache (GtkFileSystemModel *model,
int column)
{
guint i;
int start, end;
gboolean changed;
g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
g_return_if_fail (column >= -1 && (guint) column < model->n_columns);
if (column > -1)
{
start = column;
end = column + 1;
}
else
{
start = 0;
end = model->n_columns;
}
for (i = 0; i < model->files->len; i++)
{
FileModelNode *node = get_node (model, i);
changed = FALSE;
for (column = start; column < end; column++)
{
if (!G_VALUE_TYPE (&node->values[column]))
continue;
g_value_unset (&node->values[column]);
changed = TRUE;
}
if (changed && node->visible)
emit_row_changed_for_node (model, i);
}
/* FIXME: resort? */
}
/**
* _gtk_file_system_model_add_and_query_file:
* @model: a `GtkFileSystemModel`

View File

@@ -96,8 +96,6 @@ void _gtk_file_system_model_set_show_files (GtkFileSystemModel
gboolean show_files);
void _gtk_file_system_model_set_filter_folders (GtkFileSystemModel *model,
gboolean show_folders);
void _gtk_file_system_model_clear_cache (GtkFileSystemModel *model,
int column);
void _gtk_file_system_model_set_filter (GtkFileSystemModel *model,
GtkFileFilter *filter);