aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-message-browser.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-03 01:17:40 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-03 01:17:40 +0800
commit5a0b4c6c41dfd9b9d73109b15b6b5f223dbf36b1 (patch)
tree850e70cec2eb41713cb0bb5cd9cb2786a6d3a4df /mail/em-message-browser.c
parentbf713af029d3e4411367a0dd26f9e343853a32ae (diff)
downloadgsoc2013-evolution-5a0b4c6c41dfd9b9d73109b15b6b5f223dbf36b1.tar.gz
gsoc2013-evolution-5a0b4c6c41dfd9b9d73109b15b6b5f223dbf36b1.tar.zst
gsoc2013-evolution-5a0b4c6c41dfd9b9d73109b15b6b5f223dbf36b1.zip
Fix for bug #52941
2004-02-02 Jeffrey Stedfast <fejj@ximian.com> Fix for bug #52941 * em-message-browser.c (em_message_browser_window_new): Set window size based on previous size; load from gconf if necessary. (window_size_allocate): Save window size changes. svn path=/trunk/; revision=24569
Diffstat (limited to 'mail/em-message-browser.c')
-rw-r--r--mail/em-message-browser.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c
index 6ee5a62b0f..4595db789d 100644
--- a/mail/em-message-browser.c
+++ b/mail/em-message-browser.c
@@ -28,6 +28,8 @@
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkbutton.h>
+#include <gconf/gconf-client.h>
+
#include <camel/camel-folder.h>
#include <bonobo/bonobo-main.h>
@@ -42,6 +44,10 @@
#include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */
+
+#define DEFAULT_WIDTH 600
+#define DEFAULT_HEIGHT 400
+
struct _EMMessageBrowserPrivate {
GtkWidget *preview; /* container for message display */
};
@@ -131,6 +137,23 @@ em_message_browser_get_type(void)
return type;
}
+static GtkAllocation window_size = { 0, 0, 0, 0 };
+
+static void
+window_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+{
+ GConfClient *gconf;
+
+ /* save to in-memory variable for current session access */
+ window_size = *allocation;
+
+ /* save the setting across sessions */
+ gconf = gconf_client_get_default ();
+ gconf_client_set_int (gconf, "/apps/evolution/mail/message_window/width", window_size.width, NULL);
+ gconf_client_set_int (gconf, "/apps/evolution/mail/message_window/height", window_size.height, NULL);
+ g_object_unref (gconf);
+}
+
GtkWidget *em_message_browser_new(void)
{
EMMessageBrowser *emmb = g_object_new(em_message_browser_get_type(), 0);
@@ -155,10 +178,32 @@ GtkWidget *em_message_browser_window_new(void)
bonobo_ui_component_set_container(uic, BONOBO_OBJREF(uicont), NULL);
em_folder_view_activate((EMFolderView *)emmb, uic, TRUE);
-
- /* FIXME: keep track of size changes for next instantation */
- gtk_window_set_default_size((GtkWindow *)emmb->window, 600, 400);
-
+
+ if (window_size.width == 0) {
+ /* initialize @window_size with the previous session's size */
+ GConfClient *gconf;
+ GError *err = NULL;
+
+ gconf = gconf_client_get_default ();
+
+ window_size.width = gconf_client_get_int (gconf, "/apps/evolution/mail/message_window/width", &err);
+ if (err != NULL) {
+ window_size.width = DEFAULT_WIDTH;
+ g_clear_error (&err);
+ }
+
+ window_size.height = gconf_client_get_int (gconf, "/apps/evolution/mail/message_window/height", &err);
+ if (err != NULL) {
+ window_size.height = DEFAULT_HEIGHT;
+ g_clear_error (&err);
+ }
+
+ g_object_unref (gconf);
+ }
+
+ gtk_window_set_default_size ((GtkWindow *) emmb->window, window_size.width, window_size.height);
+ g_signal_connect (emmb->window, "size-allocate", G_CALLBACK (window_size_allocate), NULL);
+
/* cleanup? */
return (GtkWidget *)emmb;