[gnome-system-monitor] Also remember the window position, not only the size.
- From: Chris KÃhl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Also remember the window position, not only the size.
- Date: Fri, 18 Nov 2011 23:33:31 +0000 (UTC)
commit c123b59145d3b5aa9ba6f65985037b63bcdf2a67
Author: Robert Roth <robert roth off gmail com>
Date: Thu Nov 17 06:14:13 2011 +0200
Also remember the window position, not only the size.
https://bugzilla.gnome.org/show_bug.cgi?id=343861
src/interface.cpp | 5 ++++-
src/org.gnome.gnome-system-monitor.gschema.xml.in | 14 ++++++++++++++
src/procman.cpp | 7 +++++++
src/procman.h | 2 ++
4 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/interface.cpp b/src/interface.cpp
index 1524b09..f8bc857 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -580,7 +580,7 @@ void
create_main_window (ProcData *procdata)
{
gint i;
- gint width, height;
+ gint width, height, xpos, ypos;
GtkWidget *app;
GtkAction *action;
GtkWidget *menubar;
@@ -606,7 +606,10 @@ create_main_window (ProcData *procdata)
width = procdata->config.width;
height = procdata->config.height;
+ xpos = procdata->config.xpos;
+ ypos = procdata->config.ypos;
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);
/* create the menubar */
diff --git a/src/org.gnome.gnome-system-monitor.gschema.xml.in b/src/org.gnome.gnome-system-monitor.gschema.xml.in
index 7336ca6..8477f6b 100644
--- a/src/org.gnome.gnome-system-monitor.gschema.xml.in
+++ b/src/org.gnome.gnome-system-monitor.gschema.xml.in
@@ -15,6 +15,20 @@
</_summary>
</key>
+ <key name="x-position" type="i">
+ <default>0
+ </default>
+ <_summary>Main Window X position
+ </_summary>
+ </key>
+
+ <key name="y-position" type="i">
+ <default>0
+ </default>
+ <_summary>Main Window Y position
+ </_summary>
+ </key>
+
<key name="show-tree" type="b">
<default>false
</default>
diff --git a/src/procman.cpp b/src/procman.cpp
index bf58b79..85789a2 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -233,6 +233,9 @@ procman_data_new (GSettings *settings)
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");
+
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);
@@ -498,9 +501,13 @@ procman_save_config (ProcData *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);
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_int (settings, "current-tab", data->config.current_tab);
g_settings_sync ();
diff --git a/src/procman.h b/src/procman.h
index b0e0143..27c0f6c 100644
--- a/src/procman.h
+++ b/src/procman.h
@@ -74,6 +74,8 @@ struct ProcConfig
{
gint width;
gint height;
+ gint xpos;
+ gint ypos;
gboolean show_kill_warning;
gboolean show_tree;
gboolean show_all_fs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]