pika-installer-gtk4/src2/save_window_size/mod.rs

19 lines
620 B
Rust
Raw Normal View History

2024-02-14 16:32:01 +01:00
// Use libraries
2024-02-16 22:21:09 +01:00
use adw::prelude::*;
use adw::*;
2024-02-14 16:32:01 +01:00
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
2024-02-17 14:52:07 +01:00
#[allow(unused_imports)]
2024-02-14 16:32:01 +01:00
use gtk::prelude::*;
2024-02-17 14:52:07 +01:00
#[allow(unused_imports)]
2024-02-14 16:32:01 +01:00
use gtk::*;
// Save current window size to glib
pub fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Settings) {
let size = window.default_size();
let _ = glib_settings.set_int("window-width", size.0);
let _ = glib_settings.set_int("window-height", size.1);
let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
}