[emerillon] Save and restore the window size
- From: Łukasz Jernaś <ljernas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [emerillon] Save and restore the window size
- Date: Tue, 4 May 2010 10:08:48 +0000 (UTC)
commit e88e2226b4b6a621d4252443683f0e0444687695
Author: Simon Wenner <simon wenner ch>
Date: Sun May 2 17:13:22 2010 +0200
Save and restore the window size
data/emerillon.schemas.in | 22 ++++++++++++++++++++++
emerillon/config-keys.h | 2 ++
emerillon/window.c | 20 +++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/data/emerillon.schemas.in b/data/emerillon.schemas.in
index 1d862d5..e8ff11b 100644
--- a/data/emerillon.schemas.in
+++ b/data/emerillon.schemas.in
@@ -34,6 +34,28 @@
</schema>
<schema>
+ <key>/schemas/apps/emerillon/ui/window_width</key>
+ <applyto>/apps/emerillon/ui/window_width</applyto>
+ <owner>emerillon</owner>
+ <type>int</type>
+ <default>640</default>
+ <locale name="C">
+ <short>Window width in pixels.</short>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/emerillon/ui/window_height</key>
+ <applyto>/apps/emerillon/ui/window_height</applyto>
+ <owner>emerillon</owner>
+ <type>int</type>
+ <default>450</default>
+ <locale name="C">
+ <short>Window height in pixels.</short>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/emerillon/plugins/active-plugins</key>
<applyto>/apps/emerillon/plugins/active-plugins</applyto>
<owner>emerillon</owner>
diff --git a/emerillon/config-keys.h b/emerillon/config-keys.h
index a994cb5..6a9ad29 100644
--- a/emerillon/config-keys.h
+++ b/emerillon/config-keys.h
@@ -24,6 +24,8 @@
#define EMERILLON_CONF_UI_TOOLBAR "/apps/emerillon/ui/toolbar"
#define EMERILLON_CONF_UI_STATUSBAR "/apps/emerillon/ui/statusbar"
#define EMERILLON_CONF_UI_SIDEBAR "/apps/emerillon/ui/sidebar"
+#define EMERILLON_CONF_UI_WINDOW_WIDTH "/apps/emerillon/ui/window_width"
+#define EMERILLON_CONF_UI_WINDOW_HEIGHT "/apps/emerillon/ui/window_height"
#define EMERILLON_CONF_PLUGINS_ACTIVE_PLUGINS "/apps/emerillon/plugins/active-plugins"
#endif /* __EMERILLON_CONFIG_KEYS_H__ */
diff --git a/emerillon/window.c b/emerillon/window.c
index 202db4b..de04d0a 100644
--- a/emerillon/window.c
+++ b/emerillon/window.c
@@ -141,6 +141,7 @@ emerillon_window_init (EmerillonWindow *self)
GeoclueMaster *master;
GeoclueMasterClient *client;
GeocluePosition *position;
+ gint width, height;
self->priv = EMERILLON_WINDOW_GET_PRIVATE (self);
@@ -156,7 +157,16 @@ emerillon_window_init (EmerillonWindow *self)
gtk_window_set_geometry_hints (GTK_WINDOW (self), GTK_WIDGET (self),
&geometry,GDK_HINT_MIN_SIZE);
- gtk_window_set_default_size (GTK_WINDOW (self), 640, 450);
+ /* Set the window size */
+ width = gconf_client_get_int (self->priv->client,
+ EMERILLON_CONF_UI_WINDOW_WIDTH, NULL);
+ height = gconf_client_get_int (self->priv->client,
+ EMERILLON_CONF_UI_WINDOW_HEIGHT, NULL);
+
+ if (width > 0 && height > 0)
+ gtk_window_set_default_size (GTK_WINDOW (self), width, height);
+ else
+ gtk_window_set_default_size (GTK_WINDOW (self), 640, 450);
/* Current position. */
master = geoclue_master_get_default ();
@@ -183,6 +193,14 @@ static void
emerillon_window_dispose (GObject *object)
{
EmerillonWindow *self = EMERILLON_WINDOW (object);
+ gint width, height;
+
+ /* Save the window size */
+ gtk_window_get_size (GTK_WINDOW (self), &width, &height);
+ width = gconf_client_set_int (self->priv->client,
+ EMERILLON_CONF_UI_WINDOW_WIDTH, width, NULL);
+ height = gconf_client_set_int (self->priv->client,
+ EMERILLON_CONF_UI_WINDOW_HEIGHT, height, NULL);
if (self->priv->main_actions != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]