From db877ef14b15c2c2f8572954589fc81fcf6d8626 Mon Sep 17 00:00:00 2001 From: infirit Date: Thu, 18 Dec 2014 20:32:15 +0100 Subject: Use a tuple to store window state Taken from GSM commit: d347dd13681b7f57b28bc609d94cbcc597049951 From: Stefano Facchini Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=649398 --- src/org.mate.system-monitor.gschema.xml.in.in | 18 +++--------------- src/procman.cpp | 17 ++++++----------- 2 files changed, 9 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/org.mate.system-monitor.gschema.xml.in.in b/src/org.mate.system-monitor.gschema.xml.in.in index df9e14f..7abcd11 100644 --- a/src/org.mate.system-monitor.gschema.xml.in.in +++ b/src/org.mate.system-monitor.gschema.xml.in.in @@ -1,21 +1,9 @@ - - 440 - <_summary>Main Window width - - - 495 - <_summary>Main Window height - - - 0 - <_summary>Main Window X position - - - 0 - <_summary>Main Window Y position + + (700, 500, 50, 50) + <_summary>Main window size and position in the form (width, height, xpos, ypos) false diff --git a/src/procman.cpp b/src/procman.cpp index 4e8d2ce..6e99dc8 100644 --- a/src/procman.cpp +++ b/src/procman.cpp @@ -249,10 +249,9 @@ procman_data_new (GSettings *settings) pd = ProcData::get_instance(); - pd->config.width = g_settings_get_int (settings, "width"); - pd->config.height = g_settings_get_int (settings, "height"); - pd->config.xpos = g_settings_get_int (settings, "x-position"); - pd->config.ypos = g_settings_get_int (settings, "y-position"); + g_settings_get (settings, "window-state", "(iiii)", + &pd->config.width, &pd->config.height, + &pd->config.xpos, &pd->config.ypos); 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); @@ -526,14 +525,10 @@ procman_save_config (ProcData *data) 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_int (settings, "width", data->config.width); - g_settings_set_int (settings, "height", data->config.height); - g_settings_set_int (settings, "x-position", data->config.xpos); - g_settings_set_int (settings, "y-position", 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_int (settings, "current-tab", data->config.current_tab); - - g_settings_sync (); } static guint32 -- cgit v1.2.1