summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2023-01-11 17:01:20 -0800
committerAntónio Fernandes <antoniof@gnome.org>2023-03-05 00:03:43 +0000
commit236827527d419bd949c0a14d97949fd790e958f2 (patch)
tree4ccb593407b283a6c9fcd4d5682f1bbc79dcc66d
parent5aeb898869fc7a3d4107802dc5b95bee6f50cb13 (diff)
downloadnautilus-236827527d419bd949c0a14d97949fd790e958f2.tar.gz
file: Don't emit files_changed in file_class_init
In nautilus_file_class_init, we are calling thumbnail_limit_changed_callback() and show_thumbnails_changed_callback() in order to cache the initial values for the static variables cached_thumbnail_limit and show_file_thumbs. This has the unintended side effect of also calling emit_change_signals_for_all_files_in_all_directories () which doesn't make sense at a point in time when there are no NautilusFile's and NautilusDirectory may not even be ready. Split out the updating of the setting from the emission of all files changed.
-rw-r--r--src/nautilus-file.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 58139c93c..92d4f0641 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -8944,13 +8944,19 @@ nautilus_file_list_cancel_call_when_ready (NautilusFileListHandle *handle)
}
static void
-thumbnail_limit_changed_callback (gpointer user_data)
+update_thumbnail_limit (void)
{
cached_thumbnail_limit = g_settings_get_uint64 (nautilus_preferences,
NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT);
/*Converts the obtained limit in MB to bytes */
cached_thumbnail_limit *= MEGA_TO_BASE_RATE;
+}
+
+static void
+thumbnail_limit_changed_callback (gpointer user_data)
+{
+ update_thumbnail_limit ();
/* Tell the world that icons might have changed. We could invent a narrower-scope
* signal to mean only "thumbnails might have changed" if this ends up being slow
@@ -8960,9 +8966,15 @@ thumbnail_limit_changed_callback (gpointer user_data)
}
static void
-show_thumbnails_changed_callback (gpointer user_data)
+update_show_thumbnails (void)
{
show_file_thumbs = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS);
+}
+
+static void
+show_thumbnails_changed_callback (gpointer user_data)
+{
+ update_show_thumbnails ();
/* Tell the world that icons might have changed. We could invent a narrower-scope
* signal to mean only "thumbnails might have changed" if this ends up being slow
@@ -9156,12 +9168,12 @@ nautilus_file_class_init (NautilusFileClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- thumbnail_limit_changed_callback (NULL);
+ update_thumbnail_limit ();
g_signal_connect_swapped (nautilus_preferences,
"changed::" NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT,
G_CALLBACK (thumbnail_limit_changed_callback),
NULL);
- show_thumbnails_changed_callback (NULL);
+ update_show_thumbnails ();
g_signal_connect_swapped (nautilus_preferences,
"changed::" NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS,
G_CALLBACK (show_thumbnails_changed_callback),