diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-02-03 01:17:40 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-02-03 01:17:40 +0800 |
commit | 5a0b4c6c41dfd9b9d73109b15b6b5f223dbf36b1 (patch) | |
tree | 850e70cec2eb41713cb0bb5cd9cb2786a6d3a4df /mail | |
parent | bf713af029d3e4411367a0dd26f9e343853a32ae (diff) | |
download | gsoc2013-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')
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/em-message-browser.c | 53 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in.in | 26 |
3 files changed, 83 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 934836ea96..6b14bf7821 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +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. + 2004-02-02 Not Zed <NotZed@Ximian.com> ** See bug #53549. 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; diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index cdc0dd4745..2e97e01f4c 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -422,6 +422,32 @@ </locale> </schema> + <!-- Message Window --> + + <schema> + <key>/schemas/apps/evolution/mail/message_window/width</key> + <applyto>/apps/evolution/mail/message_window/width</applyto> + <owner>evolution-mail</owner> + <type>int</type> + <default>600</default> + <locale name="C"> + <short>Message Window default width</short> + <long>Default width of the Message Window</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/message_window/height</key> + <applyto>/apps/evolution/mail/message_window/height</applyto> + <owner>evolution-mail</owner> + <type>int</type> + <default>400</default> + <locale name="C"> + <short>Message Window default hight</short> + <long>Default height of the Message Window</long> + </locale> + </schema> + <!-- Filter logging --> <schema> |