From e67ddeb519d3bd65887f721fc5f63e498c020653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Drahn=C3=ADk?= Date: Mon, 30 Oct 2023 19:19:04 +0100 Subject: [PATCH] Refactored saving zoom on change via control+scroll to Glib.SimpleAction --- src/MainWindow.vala | 9 ++++----- src/Widgets/TerminalWidget.vala | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 143b170242..f6fdba3249 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -937,7 +937,6 @@ namespace Terminal { terminal_widget.window_title_changed.connect (check_for_tabs_with_same_name); terminal_widget.cwd_changed.connect (cwd_changed); - terminal_widget.zoom_changed.connect (zoom_changed); terminal_widget.set_font (term_font); @@ -1201,18 +1200,22 @@ namespace Terminal { private void action_reload_tab () { current_terminal.reload (); + save_opened_terminal_zoom (current_terminal); } private void action_zoom_in_font () { current_terminal.increment_size (); + save_opened_terminal_zoom (current_terminal); } private void action_zoom_out_font () { current_terminal.decrement_size (); + save_opened_terminal_zoom (current_terminal); } private void action_zoom_default_font () { current_terminal.set_default_font_size (); + save_opened_terminal_zoom() } private void action_next_tab () { @@ -1344,10 +1347,6 @@ namespace Terminal { return; } - private void zoom_changed (TerminalWidget terminal_widget) { - save_opened_terminal_zoom (terminal_widget); - } - private void cwd_changed () { check_for_tabs_with_same_name (); save_opened_terminals (); diff --git a/src/Widgets/TerminalWidget.vala b/src/Widgets/TerminalWidget.vala index 256f656850..72b3220fd2 100644 --- a/src/Widgets/TerminalWidget.vala +++ b/src/Widgets/TerminalWidget.vala @@ -128,8 +128,6 @@ namespace Terminal { public signal void cwd_changed (); - public signal void zoom_changed (TerminalWidget terminal_widget); - public TerminalWidget (MainWindow parent_window) { pointer_autohide = true; @@ -203,11 +201,11 @@ namespace Terminal { if ((event.state & Gdk.ModifierType.CONTROL_MASK) > 0) { switch (event.direction) { case Gdk.ScrollDirection.UP: - increment_size (); + window.get_simple_action (MainWindow.ACTION_ZOOM_IN_FONT).activate (null); return Gdk.EVENT_STOP; case Gdk.ScrollDirection.DOWN: - decrement_size (); + window.get_simple_action (MainWindow.ACTION_ZOOM_OUT_FONT).activate (null); return Gdk.EVENT_STOP; case Gdk.ScrollDirection.SMOOTH: @@ -452,17 +450,14 @@ namespace Terminal { public void increment_size () { font_scale = (font_scale + 0.1).clamp (MIN_SCALE, MAX_SCALE); - zoom_changed (this); } public void decrement_size () { font_scale = (font_scale - 0.1).clamp (MIN_SCALE, MAX_SCALE); - zoom_changed (this); } public void set_default_font_size () { font_scale = 1.0; - zoom_changed (this); } public bool is_init_complete () {