From b6315482b78a7d51d9dd45374567040e256b427f Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Thu, 2 Jun 2022 11:37:08 +0200 Subject: Fix sort changes taking way too much time All thumbnails were reloaded five times on each change. GTK+/GObject's behaviour doesn't make a lot of sense, but such is life. --- fiv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fiv.c b/fiv.c index 03db9f7..524070b 100644 --- a/fiv.c +++ b/fiv.c @@ -722,13 +722,19 @@ on_filtering_toggled(GtkToggleButton *button, G_GNUC_UNUSED gpointer user_data) static void on_sort_field(G_GNUC_UNUSED GtkMenuItem *item, gpointer data) { - g_object_set(g.model, "sort-field", (gint) (intptr_t) data, NULL); + int old = -1, new = (int) (intptr_t) data; + g_object_get(g.model, "sort-field", &old, NULL); + if (old != new) + g_object_set(g.model, "sort-field", new, NULL); } static void on_sort_direction(G_GNUC_UNUSED GtkMenuItem *item, gpointer data) { - g_object_set(g.model, "sort-descending", (gboolean) (intptr_t) data, NULL); + gboolean old = FALSE, new = (gboolean) (intptr_t) data; + g_object_get(g.model, "sort-descending", &old, NULL); + if (old != new) + g_object_set(g.model, "sort-descending", new, NULL); } static void -- cgit v1.2.3-70-g09d2