pika-first-setup/src/save_window_size.rs

20 lines
591 B
Rust
Raw Normal View History

2024-01-30 21:33:07 +01:00
// GTK crates
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::prelude::*;
use gtk::*;
use adw::prelude::*;
use adw::*;
use glib::*;
use gdk::Display;
// Save current window size to glib
pub fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Settings) {
let size = window.default_size();
glib_settings.set_int("window-width", size.0);
glib_settings.set_int("window-height", size.1);
glib_settings.set_boolean("is-maximized", window.is_maximized());
}