From 0476071164c36b41de5b19e3e8a768feb422f27f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 13 Oct 2026 23:00:56 +0200 Subject: Fourth commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- events.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'events.c') diff --git a/events.c b/events.c index 4c5910e..7a45d66 100644 --- a/events.c +++ b/events.c @@ -26,16 +26,14 @@ transform(enum transformation augment) static void set_zoom_fit(GtkToggleAction *action, enum zoom_mode mode) { - GdkPixbuf *image; - + struct image image; if (gtk_toggle_action_get_active(action)) { zoom_mode = mode; - if ((image = get_image())) - set_zoom_and_recentre(calculate_zoom_mode(image, zoom_mode)); + if (get_image(&image)) + set_zoom_and_recentre(calculate_zoom_mode(&image, zoom_mode)); } else if (zoom_mode == mode) { zoom_mode = ZOOM_CUSTOM; /* deselect zoom */ } - clear_toggles(GROUP_ZOOM, action); } @@ -70,9 +68,11 @@ reload_action(GtkAction *action, void *user) void print_action(GtkAction *action, void *user) { + struct image image; (void) action; (void) user; - open_print(get_image()); + if (get_image(&image)) + open_print(&image); } void @@ -83,6 +83,28 @@ properties_action(GtkAction *action, void *user) open_properties(get_file()); } +void +preferences_action(GtkAction *action, void *user) +{ + (void) action; + (void) user; + open_preferences(); +} + +void +property_pane_action(GtkToggleAction *action, void *user) +{ + (void) user; + set_property_pane_visible(gtk_toggle_action_get_active(action)); +} + +void +collection_pane_action(GtkToggleAction *action, void *user) +{ + (void) user; + set_collection_pane_visible(gtk_toggle_action_get_active(action)); +} + void close_action(GtkAction *action, void *user) { @@ -278,6 +300,9 @@ key_pressed(GtkWidget *widget, GdkEventKey *event, void *user) if (event->state & GDK_CONTROL_MASK) return 0; + if (gtk_window_get_focus(GTK_WINDOW(window)) != display_area) + return 0; + amount = (event->state & GDK_MOD1_MASK) ? 1 : SCROLL_AMOUNT; hamount = (double)amount; vamount = (double)amount; -- cgit v1.3.1