diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/interface.cpp | 3 | ||||
-rw-r--r-- | src/org.mate.system-monitor.gschema.xml.in | 4 | ||||
-rw-r--r-- | src/procman.cpp | 22 | ||||
-rw-r--r-- | src/procman.h | 1 |
4 files changed, 24 insertions, 6 deletions
diff --git a/src/interface.cpp b/src/interface.cpp index ca18c63..1a851aa 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -727,6 +727,9 @@ create_main_window (ProcData *procdata) gtk_window_set_default_size (GTK_WINDOW (app), width, height); gtk_window_move(GTK_WINDOW (app), xpos, ypos); gtk_window_set_resizable (GTK_WINDOW (app), TRUE); + if (procdata->config.maximized) { + gtk_window_maximize(GTK_WINDOW(app)); + } /* create the menubar */ procdata->uimanager = gtk_ui_manager_new (); diff --git a/src/org.mate.system-monitor.gschema.xml.in b/src/org.mate.system-monitor.gschema.xml.in index aa694a9..3c301c8 100644 --- a/src/org.mate.system-monitor.gschema.xml.in +++ b/src/org.mate.system-monitor.gschema.xml.in @@ -5,6 +5,10 @@ <default>(700, 500, 50, 50)</default> <summary>Main window size and position in the form (width, height, xpos, ypos)</summary> </key> + <key name="maximized" type="b"> + <default>false</default> + <summary>If TRUE, main window will open maximized, and saved size and position values are ignored.</summary> + </key> <key name="show-tree" type="b"> <default>false</default> <summary>Show process dependencies in tree form</summary> 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); } diff --git a/src/procman.h b/src/procman.h index 388f0e6..d3db85c 100644 --- a/src/procman.h +++ b/src/procman.h @@ -88,6 +88,7 @@ struct ProcConfig gint height; gint xpos; gint ypos; + gboolean maximized; gboolean show_kill_warning; gboolean show_tree; gboolean show_all_fs; |