Debian Codegraph @

src/window_size.rs

raw symbols SCIP
1 /*
2 * Copyright 2020-2024 Andrey Kutejko <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * For more details see the file COPYING.
18 */
19
20 use gtk::gio::{self, prelude::*};
21
22 const KEY_WINDOW_WIDTH: &str = "window-width";
23 const KEY_WINDOW_HEIGHT: &str = "window-height";
24 const KEY_WINDOW_IS_MAXIMIZED: &str = "window-is-maximized";
25
26 pub fn remember_window_size(window: &gtk::Window, settings: &gio::Settings) {
27 settings
28 .bind(KEY_WINDOW_WIDTH, window, "default-width")
29 .build();
30 settings
31 .bind(KEY_WINDOW_HEIGHT, window, "default-height")
32 .build();
33 settings
34 .bind(KEY_WINDOW_IS_MAXIMIZED, window, "maximized")
35 .build();
36 }