From 503c3ec04da7cb295fdaf79ac4fe236ae499ec56 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 17 Dec 2022 09:30:12 -0300 Subject: [PATCH] filesystemmodel: Make function private to gtkfilesystemmodel.c The _gtk_file_system_model_update_file() function is not used outside GtkFileSystemModel, so no need to expose it in the header. Shuffle it around in code, and remove it from the header. --- gtk/gtkfilesystemmodel.c | 64 ++++++++++++++++++++-------------------- gtk/gtkfilesystemmodel.h | 3 -- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index 5143216a57..d911c5e081 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -484,6 +484,32 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da } } +static void +_gtk_file_system_model_update_file (GtkFileSystemModel *model, + GFile *file, + GFileInfo *info) +{ + FileModelNode *node; + guint id; + + g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model)); + g_return_if_fail (G_IS_FILE (file)); + g_return_if_fail (G_IS_FILE_INFO (info)); + + id = node_get_for_file (model, file); + if (id == 0) + { + add_file (model, file, info); + id = node_get_for_file (model, file); + } + + node = get_node (model, id); + + g_set_object (&node->info, info); + + g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file)); +} + /* Helper for gtk_file_system_model_query_done and * gtk_file_system_model_one_query_done */ static void @@ -954,41 +980,15 @@ remove_file (GtkFileSystemModel *model, } /** - * _gtk_file_system_model_update_file: + * _gtk_file_system_model_update_files: * @model: the model - * @file: the file - * @info: the new file info + * @files: the files + * @infos: the new file infos * - * Tells the file system model that the file changed and that the - * new @info should be used for it now. If the file is not part of - * @model, it will get added automatically. + * Tells the file system model that the files changed and that the + * new @infos should be used for it now. If these files are not + * part of @model, it will get added automatically. **/ -void -_gtk_file_system_model_update_file (GtkFileSystemModel *model, - GFile *file, - GFileInfo *info) -{ - FileModelNode *node; - guint id; - - g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model)); - g_return_if_fail (G_IS_FILE (file)); - g_return_if_fail (G_IS_FILE_INFO (info)); - - id = node_get_for_file (model, file); - if (id == 0) - { - add_file (model, file, info); - id = node_get_for_file (model, file); - } - - node = get_node (model, id); - - g_set_object (&node->info, info); - - g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file)); -} - void _gtk_file_system_model_update_files (GtkFileSystemModel *model, GList *files, diff --git a/gtk/gtkfilesystemmodel.h b/gtk/gtkfilesystemmodel.h index 57cbf4d68f..f71df16882 100644 --- a/gtk/gtkfilesystemmodel.h +++ b/gtk/gtkfilesystemmodel.h @@ -46,9 +46,6 @@ void _gtk_file_system_model_add_and_query_file (GtkFileSystemMod void _gtk_file_system_model_add_and_query_files (GtkFileSystemModel *model, GList *files, const char *attributes); -void _gtk_file_system_model_update_file (GtkFileSystemModel *model, - GFile *file, - GFileInfo *info); void _gtk_file_system_model_update_files (GtkFileSystemModel *model, GList *files, GList *infos);