aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-06-02 11:37:08 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-06-02 11:46:16 +0200
commitb6315482b78a7d51d9dd45374567040e256b427f (patch)
tree49007191b4f1ccefda12d63769eed68ccf8039dc
parent51ea785d838a9d7cb37e21d64479a63ad12565aa (diff)
downloadfiv-b6315482b78a7d51d9dd45374567040e256b427f.tar.gz
fiv-b6315482b78a7d51d9dd45374567040e256b427f.tar.xz
fiv-b6315482b78a7d51d9dd45374567040e256b427f.zip
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.
-rw-r--r--fiv.c10
1 files 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