aboutsummaryrefslogtreecommitdiff
path: root/fastiv.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-21 20:46:50 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-21 20:47:07 +0100
commit5fea2245f119029f6b2699dda11aaf8f5e461e4e (patch)
tree4c16a0f855dab1b4a7d818a3cdeb874a2ce28167 /fastiv.c
parent2b17ed838afb1ac1d63ca6e4d60945844263ca40 (diff)
downloadfiv-5fea2245f119029f6b2699dda11aaf8f5e461e4e.tar.gz
fiv-5fea2245f119029f6b2699dda11aaf8f5e461e4e.tar.xz
fiv-5fea2245f119029f6b2699dda11aaf8f5e461e4e.zip
Remove insanity
Diffstat (limited to 'fastiv.c')
-rw-r--r--fastiv.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/fastiv.c b/fastiv.c
index bfc8432..f7e174f 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -335,20 +335,14 @@ on_open_location(G_GNUC_UNUSED GtkPlacesSidebar *sidebar, GFile *location,
static void
on_toolbar_zoom(G_GNUC_UNUSED GtkButton *button, gpointer user_data)
{
- FastivIoThumbnailSize size = FASTIV_IO_THUMBNAIL_SIZE_MIN;
+ FastivIoThumbnailSize size = FASTIV_IO_THUMBNAIL_SIZE_COUNT;
g_object_get(g.browser, "thumbnail-size", &size, NULL);
- gintptr position = -1, count = 0, adjustment = (gintptr) user_data;
- while (fastiv_io_thumbnail_sizes[count].size) {
- if (fastiv_io_thumbnail_sizes[count].size == size)
- position = count;
- count++;
- }
+ size += (gintptr) user_data;
+ g_return_if_fail(size >= FASTIV_IO_THUMBNAIL_SIZE_MIN &&
+ size <= FASTIV_IO_THUMBNAIL_SIZE_MAX);
- position += adjustment;
- g_return_if_fail(position >= 0 && position < count);
- g_object_set(g.browser, "thumbnail-size",
- fastiv_io_thumbnail_sizes[position].size, NULL);
+ g_object_set(g.browser, "thumbnail-size", size, NULL);
}
static void