From 3b628ac25b6209d414d1f8964a743e0a2b0a29f9 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Tue, 21 Sep 2021 19:19:31 -0700 Subject: window: Clean up window sizing code GTK4 drops a few of the events used, and we don't need to get the whole window state. --- src/baobab-window.vala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/baobab-window.vala b/src/baobab-window.vala index 26c5ff5..fb978a1 100644 --- a/src/baobab-window.vala +++ b/src/baobab-window.vala @@ -150,8 +150,7 @@ namespace Baobab { enable_drop (); // Setup window geometry saving - Gdk.WindowState window_state = (Gdk.WindowState) ui_settings.get_int ("window-state"); - if (Gdk.WindowState.MAXIMIZED in window_state) { + if (ui_settings.get_boolean ("is-maximized")) { maximize (); } @@ -159,17 +158,13 @@ namespace Baobab { ui_settings.get ("window-size", "(ii)", out width, out height); resize (width, height); - window_state_event.connect ((event) => { - ui_settings.set_int ("window-state", event.new_window_state); - return false; - }); + ui_settings.bind ("is-maximized", this, "is-maximized", GLib.SettingsBindFlags.SET); - configure_event.connect ((event) => { - if (!(Gdk.WindowState.MAXIMIZED in get_window ().get_state ())) { + size_allocate.connect ((_) => { + if (!is_maximized) { get_size (out width, out height); ui_settings.set ("window-size", "(ii)", width, height); } - return false; }); destroy.connect (() => { -- cgit v1.2.1