summaryrefslogtreecommitdiff
path: root/src/procman.cpp
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-02-29 17:43:05 +0300
committermonsta <[email protected]>2016-02-29 17:43:05 +0300
commit5fc85dd404ee822eef15bae2726d859f23e1a8af (patch)
treefa7a2659984ca63c17e31e467a35e0661146b1a8 /src/procman.cpp
parent19090fe133ceb383535070216471f995690f64c8 (diff)
downloadmate-system-monitor-5fc85dd404ee822eef15bae2726d859f23e1a8af.tar.bz2
mate-system-monitor-5fc85dd404ee822eef15bae2726d859f23e1a8af.tar.xz
main window: save maximized state in gsettings on exit
and load it on startup adapted from https://git.gnome.org/browse/gnome-system-monitor/commit/?id=edf4163bb2e9ad1dd9b8a5b7c7244ccd8753d4b5
Diffstat (limited to 'src/procman.cpp')
-rw-r--r--src/procman.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/procman.cpp b/src/procman.cpp
index 7f851cb..65502ce 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -253,6 +253,8 @@ procman_data_new (GSettings *settings)
&pd->config.width, &pd->config.height,
&pd->config.xpos, &pd->config.ypos);
+ pd->config.maximized = g_settings_get_boolean(settings, "maximized");
+
pd->config.show_tree = g_settings_get_boolean (settings, "show-tree");
g_signal_connect (G_OBJECT(settings), "changed::show-tree", G_CALLBACK(tree_changed_cb), pd);
@@ -511,13 +513,21 @@ procman_save_config (ProcData *data)
g_assert(data);
- data->config.width = gdk_window_get_width(gtk_widget_get_window(data->app));
- data->config.height = gdk_window_get_height(gtk_widget_get_window(data->app));
- gtk_window_get_position(GTK_WINDOW(data->app), &data->config.xpos, &data->config.ypos);
+ data->config.maximized = gdk_window_get_state(gtk_widget_get_window (data->app)) & GDK_WINDOW_STATE_MAXIMIZED;
+ if (!data->config.maximized) {
+ // we only want to store/overwrite size and position info with non-maximized state info
+ data->config.width = gdk_window_get_width(gtk_widget_get_window(data->app));
+ data->config.height = gdk_window_get_height(gtk_widget_get_window(data->app));
+
+ gtk_window_get_position(GTK_WINDOW(data->app), &data->config.xpos, &data->config.ypos);
+
+ g_settings_set (settings, "window-state", "(iiii)",
+ data->config.width, data->config.height,
+ data->config.xpos, data->config.ypos);
+ }
+
+ g_settings_set_boolean (settings, "maximized", data->config.maximized);
- g_settings_set (settings, "window-state", "(iiii)",
- data->config.width, data->config.height,
- data->config.xpos, data->config.ypos);
g_settings_set_int (settings, "current-tab", data->config.current_tab);
}