* Added simple/split view mode persistence for ModestMainWindow
authorSergio Villar Senin <svillar@igalia.com>
Fri, 13 Apr 2007 17:15:12 +0000 (17:15 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 13 Apr 2007 17:15:12 +0000 (17:15 +0000)
pmo-trunk-r1559

src/maemo/modest-main-window.c
src/modest-widget-memory-priv.h
src/modest-widget-memory.c

index ea986a3..c4d2559 100644 (file)
@@ -248,6 +248,8 @@ restore_sizes (ModestMainWindow *self)
                                      "modest-main-paned");
        modest_widget_memory_restore (conf, G_OBJECT(priv->header_view),
                                      "header-view");
+       modest_widget_memory_restore (conf, G_OBJECT(self), 
+                                     "modest-main-window");
 }
 
 
@@ -526,7 +528,7 @@ modest_main_window_set_style (ModestMainWindow *self,
        }
 
        /* Show changes */
-       gtk_widget_show (GTK_WIDGET (priv->main_vbox));
+       gtk_widget_show_all (GTK_WIDGET (priv->main_vbox));
 }
 
 ModestMainWindowStyle
index 8666ad5..2a9f686 100644 (file)
@@ -39,6 +39,7 @@ G_BEGIN_DECLS
 #define MODEST_WIDGET_MEMORY_PARAM_WIDTH         "width"
 #define MODEST_WIDGET_MEMORY_PARAM_POS           "pos"
 #define MODEST_WIDGET_MEMORY_PARAM_COLUMN_WIDTH  "column-width"
+#define MODEST_WIDGET_MEMORY_PARAM_WINDOW_STYLE  "window-style"
 
 /* private functions, only for use in modest-widget-memory and modest-init */
 gchar* _modest_widget_memory_get_keyname           (const gchar *name, const gchar *param);
index 323bf6d..9044e1e 100644 (file)
@@ -35,6 +35,7 @@
 #include <widgets/modest-header-view.h>
 #include <widgets/modest-msg-view.h>
 #include <widgets/modest-folder-view.h>
+#include "widgets/modest-main-window.h"
 #include <string.h>
 
 gchar*
@@ -154,6 +155,15 @@ save_settings_window (ModestConf *conf, GtkWindow *win, const gchar *name)
        key = _modest_widget_memory_get_keyname (name, MODEST_WIDGET_MEMORY_PARAM_WIDTH);
        modest_conf_set_int (conf, key, width, NULL);
        g_free (key);
+
+       /* Save also the main window style */
+       if (MODEST_IS_MAIN_WINDOW (win)) {
+               ModestMainWindowStyle style = modest_main_window_get_style (MODEST_MAIN_WINDOW (win));
+
+               key = _modest_widget_memory_get_keyname (name, MODEST_WIDGET_MEMORY_PARAM_WINDOW_STYLE);
+               modest_conf_set_int (conf, key, style, NULL);
+               g_free (key);
+       }
        
        return TRUE;
 }
@@ -181,6 +191,18 @@ restore_settings_window (ModestConf *conf, GtkWindow *win, const gchar *name)
        if (height && width)
                gtk_window_set_default_size (win, width, height);
 
+       /* Restore also the main window style */
+       if (MODEST_IS_MAIN_WINDOW (win)) {
+               ModestMainWindowStyle style;
+
+               key = _modest_widget_memory_get_keyname (name, MODEST_WIDGET_MEMORY_PARAM_WINDOW_STYLE);
+               if (modest_conf_key_exists (conf, key, NULL))
+                       style = (ModestMainWindowStyle) modest_conf_get_int (conf, key, NULL);  
+               g_free (key);
+
+               modest_main_window_set_style (MODEST_MAIN_WINDOW (win), style);
+       }
+
        return TRUE;
 }