pika-first-setup/src/save_window_size.rs

19 lines
574 B
Rust
Raw Normal View History

2024-01-30 21:33:07 +01:00
// GTK crates
2024-02-08 22:49:42 +01:00
use adw::prelude::*;
use adw::*;
use gdk::Display;
use glib::*;
2024-01-30 21:33:07 +01:00
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::prelude::*;
use gtk::*;
// Save current window size to glib
pub fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Settings) {
2024-02-08 22:49:42 +01:00
let size = window.default_size();
2024-01-30 21:33:07 +01:00
2024-02-08 22:49:42 +01:00
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());
2024-01-30 21:33:07 +01:00
}