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.
This commit is contained in:
Přemysl Eric Janouch 2022-06-02 11:37:08 +02:00
parent 51ea785d83
commit b6315482b7
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 8 additions and 2 deletions

10
fiv.c
View File

@ -722,13 +722,19 @@ on_filtering_toggled(GtkToggleButton *button, G_GNUC_UNUSED gpointer user_data)
static void static void
on_sort_field(G_GNUC_UNUSED GtkMenuItem *item, gpointer data) 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 static void
on_sort_direction(G_GNUC_UNUSED GtkMenuItem *item, gpointer data) 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 static void