Make freeze_updates() and thaw_updates() static functions
They were in the semi-public API of GtkFileSystemModel, but never actually used outside of it. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
@ -204,6 +204,9 @@ struct _GtkFileSystemModelClass
|
|||||||
void (*finished_loading) (GtkFileSystemModel *model, GError *error);
|
void (*finished_loading) (GtkFileSystemModel *model, GError *error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void freeze_updates (GtkFileSystemModel *model);
|
||||||
|
static void thaw_updates (GtkFileSystemModel *model);
|
||||||
|
|
||||||
static guint node_get_for_file (GtkFileSystemModel *model,
|
static guint node_get_for_file (GtkFileSystemModel *model,
|
||||||
GFile *file);
|
GFile *file);
|
||||||
|
|
||||||
@ -1120,7 +1123,7 @@ thaw_func (gpointer data)
|
|||||||
{
|
{
|
||||||
GtkFileSystemModel *model = data;
|
GtkFileSystemModel *model = data;
|
||||||
|
|
||||||
_gtk_file_system_model_thaw_updates (model);
|
thaw_updates (model);
|
||||||
model->dir_thaw_source = 0;
|
model->dir_thaw_source = 0;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1142,7 +1145,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
|
|||||||
{
|
{
|
||||||
if (model->dir_thaw_source == 0)
|
if (model->dir_thaw_source == 0)
|
||||||
{
|
{
|
||||||
_gtk_file_system_model_freeze_updates (model);
|
freeze_updates (model);
|
||||||
model->dir_thaw_source = gdk_threads_add_timeout_full (IO_PRIORITY + 1,
|
model->dir_thaw_source = gdk_threads_add_timeout_full (IO_PRIORITY + 1,
|
||||||
50,
|
50,
|
||||||
thaw_func,
|
thaw_func,
|
||||||
@ -1191,7 +1194,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
|
|||||||
{
|
{
|
||||||
g_source_remove (model->dir_thaw_source);
|
g_source_remove (model->dir_thaw_source);
|
||||||
model->dir_thaw_source = 0;
|
model->dir_thaw_source = 0;
|
||||||
_gtk_file_system_model_thaw_updates (model);
|
thaw_updates (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0, error);
|
g_signal_emit (model, file_system_model_signals[FINISHED_LOADING], 0, error);
|
||||||
@ -1462,14 +1465,14 @@ gtk_file_system_model_refilter_all (GtkFileSystemModel *model)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gtk_file_system_model_freeze_updates (model);
|
freeze_updates (model);
|
||||||
|
|
||||||
/* start at index 1, don't change the editable */
|
/* start at index 1, don't change the editable */
|
||||||
for (i = 1; i < model->files->len; i++)
|
for (i = 1; i < model->files->len; i++)
|
||||||
node_compute_visibility_and_filters (model, i);
|
node_compute_visibility_and_filters (model, i);
|
||||||
|
|
||||||
model->filter_on_thaw = FALSE;
|
model->filter_on_thaw = FALSE;
|
||||||
_gtk_file_system_model_thaw_updates (model);
|
thaw_updates (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1991,17 +1994,16 @@ _gtk_file_system_model_remove_editable (GtkFileSystemModel *model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _gtk_file_system_model_freeze_updates:
|
* freeze_updates:
|
||||||
* @model: a #GtkFileSystemModel
|
* @model: a #GtkFileSystemModel
|
||||||
*
|
*
|
||||||
* Freezes most updates on the model, so that performing multiple
|
* Freezes most updates on the model, so that performing multiple operations on
|
||||||
* operations on the files in the model do not cause any events.
|
* the files in the model do not cause any events. Use thaw_updates() to resume
|
||||||
* Use _gtk_file_system_model_thaw_updates() to resume proper
|
* proper operations. It is fine to call this function multiple times as long as
|
||||||
* operations. It is fine to call this function multiple times as
|
* freeze and thaw calls are balanced.
|
||||||
* long as freeze and thaw calls are balanced.
|
|
||||||
**/
|
**/
|
||||||
void
|
static void
|
||||||
_gtk_file_system_model_freeze_updates (GtkFileSystemModel *model)
|
freeze_updates (GtkFileSystemModel *model)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
|
g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
|
||||||
|
|
||||||
@ -2009,14 +2011,13 @@ _gtk_file_system_model_freeze_updates (GtkFileSystemModel *model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _gtk_file_system_model_thaw_updates:
|
* thaw_updates:
|
||||||
* @model: a #GtkFileSystemModel
|
* @model: a #GtkFileSystemModel
|
||||||
*
|
*
|
||||||
* Undoes the effect of a previous call to
|
* Undoes the effect of a previous call to freeze_updates()
|
||||||
* _gtk_file_system_model_freeze_updates()
|
|
||||||
**/
|
**/
|
||||||
void
|
static void
|
||||||
_gtk_file_system_model_thaw_updates (GtkFileSystemModel *model)
|
thaw_updates (GtkFileSystemModel *model)
|
||||||
{
|
{
|
||||||
gboolean stuff_added;
|
gboolean stuff_added;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user