[gnome-games] aisleriot: Port window state persistence to gsettings



commit 8f926e1fc5802db1604e4872944187d76fd305c2
Author: Christian Persch <chpe gnome org>
Date:   Tue Sep 7 15:41:57 2010 +0200

    aisleriot: Port window state persistence to gsettings

 aisleriot/sol.c    |    4 ++++
 aisleriot/window.c |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/aisleriot/sol.c b/aisleriot/sol.c
index cd3aa06..81be3af 100644
--- a/aisleriot/sol.c
+++ b/aisleriot/sol.c
@@ -419,6 +419,10 @@ cleanup:
   }
 #endif /* HAVE_MAEMO */
 
+#if GLIB_CHECK_VERSION (2, 25, 15)
+  g_settings_sync ();
+#endif
+
   games_runtime_shutdown ();
 }
 
diff --git a/aisleriot/window.c b/aisleriot/window.c
index aeefbe3..7fbf5f1 100644
--- a/aisleriot/window.c
+++ b/aisleriot/window.c
@@ -50,6 +50,10 @@
 #include <libgames-support/games-atk-utils.h>
 #endif
 
+#if GLIB_CHECK_VERSION (2, 25, 15)
+#include <libgames-support/games-settings.h>
+#endif
+
 #ifdef HAVE_CLUTTER
 #include "ar-clutter-embed.h"
 #include "ar-style.h"
@@ -103,6 +107,9 @@
 #define LEAVE_FULLSCREEN_BUTTON
 #endif
 
+#define AR_SETTINGS_PATH_PREFIX "/org/gnome/solitaire/"
+#define AR_SETTINGS_WINDOW_STATE_PATH AR_SETTINGS_PATH_PREFIX "window-state/"
+
 enum
 {
   ACTION_UNDO_MOVE,
@@ -2762,7 +2769,11 @@ aisleriot_window_init (AisleriotWindow *window)
   gtk_window_set_default_size (GTK_WINDOW (window), MIN_WIDTH, MIN_HEIGHT);
 
   /* Restore window state */
+#if GLIB_CHECK_VERSION (2, 25, 15)
+  games_settings_bind_window_state (AR_SETTINGS_WINDOW_STATE_PATH, GTK_WINDOW (window));
+#else
   games_conf_add_window (GTK_WINDOW (window), NULL);
+#endif
 
   /* Initial focus is in the board */
   gtk_widget_grab_focus (GTK_WIDGET (priv->board));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]