From 2ab629886e8850257ffe7681fcfdf73648278b4b Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 31 Mar 2004 17:00:24 +0000 Subject: Save/restore the subscribe dialog's window size. Fixes bug #56230. 2004-03-31 Jeffrey Stedfast * em-subscribe-editor.c (em_subscribe_editor_new): Save/restore the subscribe dialog's window size. Fixes bug #56230. svn path=/trunk/; revision=25266 --- mail/ChangeLog | 5 ++++ mail/em-subscribe-editor.c | 52 ++++++++++++++++++++++++++++++++++++--- mail/evolution-mail.schemas.in.in | 26 ++++++++++++++++++++ mail/subscribe-dialog.glade | 4 ++- 4 files changed, 82 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 30031c0ccd..81a63cccc9 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2004-03-31 Jeffrey Stedfast + + * em-subscribe-editor.c (em_subscribe_editor_new): Save/restore + the subscribe dialog's window size. Fixes bug #56230. + 2004-03-31 Not Zed * mail.h: REMOVED! And there was much rejoicing. diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index fa7b1bec07..f975e02c59 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -795,6 +795,27 @@ static void sub_editor_busy(EMSubscribeEditor *se, int dir) } } + +#define DEFAULT_WIDTH 600 +#define DEFAULT_HEIGHT 400 + +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/subscribe_window/width", window_size.width, NULL); + gconf_client_set_int (gconf, "/apps/evolution/mail/subscribe_window/height", window_size.height, NULL); + g_object_unref (gconf); +} + GtkDialog *em_subscribe_editor_new(void) { EMSubscribeEditor *se; @@ -813,7 +834,7 @@ GtkDialog *em_subscribe_editor_new(void) } se->dialog = (GtkDialog *)glade_xml_get_widget (xml, "subscribe_dialog"); g_signal_connect(se->dialog, "destroy", G_CALLBACK(sub_editor_destroy), se); - + gtk_widget_realize ((GtkWidget *)se->dialog); gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->action_area, 12); gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->vbox, 0); @@ -872,8 +893,31 @@ GtkDialog *em_subscribe_editor_new(void) gtk_option_menu_set_menu((GtkOptionMenu *)se->optionmenu, menu); g_signal_connect(se->optionmenu, "changed", G_CALLBACK(sub_editor_menu_changed), se); - - gtk_window_set_default_size((GtkWindow *)se->dialog, 350, 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/subscribe_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/subscribe_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 *) se->dialog, window_size.width, window_size.height); + g_signal_connect (se->dialog, "size-allocate", G_CALLBACK (window_size_allocate), NULL); + return se->dialog; } diff --git a/mail/evolution-mail.schemas.in.in b/mail/evolution-mail.schemas.in.in index e3040bd930..69fb8424a8 100644 --- a/mail/evolution-mail.schemas.in.in +++ b/mail/evolution-mail.schemas.in.in @@ -472,6 +472,32 @@ + + + + /schemas/apps/evolution/mail/subscribe_window/width + /apps/evolution/mail/subscribe_window/width + evolution-mail + int + 600 + + Subscribe dialog default width + Default width of the Subscribe dialog + + + + + /schemas/apps/evolution/mail/subscribe_window/height + /apps/evolution/mail/subscribe_window/height + evolution-mail + int + 400 + + Subscribe dialog default hight + Default height of the Subscribe dialog + + + diff --git a/mail/subscribe-dialog.glade b/mail/subscribe-dialog.glade index 95ee676ae0..6f8238efa4 100644 --- a/mail/subscribe-dialog.glade +++ b/mail/subscribe-dialog.glade @@ -2,13 +2,15 @@ + - True Folder Subscriptions GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False + 600 + 400 True False False -- cgit v1.2.3