Patch for message read window size



This patch adds a checkbox to prefs to allow the user to either select
automatic window sizing (still a FIXME) or use the size of the last window
closed when a new one is opened.
I prefer it that way, because I don't like narrow, tall windows and I work
with a relatively fixed desktop layout where I like to have all windows of
the same kind to have the same size initially.

The default of the new option, Autosize, will do the same thing as always,
bringung up a window of 400 x 500.

diff -r -b -B -u ../balsa/src/balsa-app.h ./src/balsa-app.h
--- ../balsa/src/balsa-app.h	Sun Jul  1 17:11:06 2001
+++ ./src/balsa-app.h	Tue Jul 10 15:47:08 2001
@@ -55,6 +55,13 @@
 #define SUBJECT_DEFAULT_WIDTH 260
 #define DATE_DEFAULT_WIDTH 138
 
+/* default message window size */
+/* FIXME: */
+/* These defaults were taken from message.c and don't make much sense to me */
+#define MESSAGE_WINDOW_DEFAULT_WIDTH 400
+#define MESSAGE_WINDOW_DEFAULT_HEIGHT 500
+#define MESSAGE_WINDOW_DEFAULT_AUTOSIZE 1
+
 /* default width settings for the mailbox list columns, not fully utilized yet */
 #define MBNAME_DEFAULT_WIDTH 80
 
@@ -205,6 +212,10 @@
     gint mw_width;
     gint mw_height;
     gint mblist_width;
+
+	gint message_window_width;
+	gint message_window_height;
+	gint message_window_autosize;
 
     /* file paths */
     gchar *attach_dir;
diff -r -b -B -u ../balsa/src/message-window.c ./src/message-window.c
--- ../balsa/src/message-window.c	Mon Jan 22 18:15:01 2001
+++ ./src/message-window.c	Tue Jul 10 16:13:40 2001
@@ -223,6 +223,8 @@
 	(GTK_CHECK_MENU_ITEM(view_menu[MENU_VIEW_WRAP_POS].widget),
 	 balsa_app.browse_wrap);
 
+	if(balsa_app.message_window_autosize)
+	{
     /* FIXME: set it to the size of the canvas, unless it is
      * bigger than the desktop, in which case it should be at about a
      * 2/3 proportional size based on the size of the desktop and the
@@ -228,8 +230,15 @@
      * 2/3 proportional size based on the size of the desktop and the
      * height and width of the canvas.  [save and restore window size too]
      */
-
     gtk_window_set_default_size(GTK_WINDOW(mw->window), 400, 500);
+	}
+	else
+	{
+		/* Use saved settings */
+		gtk_window_set_default_size(GTK_WINDOW(mw->window),
+				balsa_app.message_window_width,
+				balsa_app.message_window_height);
+	}
 
     gtk_widget_show(mw->bmessage);
     gtk_widget_show(mw->window);
@@ -241,6 +250,9 @@
 destroy_message_window(GtkWidget * widget, gpointer data)
 {
     MessageWindow *mw = (MessageWindow *) data;
+
+	balsa_app.message_window_width=widget->allocation.width;
+	balsa_app.message_window_height=widget->allocation.height;
 
     g_hash_table_remove(displayed_messages, mw->message);
 
diff -r -b -B -u ../balsa/src/pref-manager.c ./src/pref-manager.c
--- ../balsa/src/pref-manager.c	Fri Jul  6 18:38:04 2001
+++ ./src/pref-manager.c	Tue Jul 10 15:46:48 2001
@@ -110,6 +110,8 @@
     GtkWidget *spell_check_sig;
     GtkWidget *spell_check_quoted;
 
+	/* Window sizes */
+    GtkWidget *message_window_autosize;
 } PropertyUI;
 
 
@@ -271,6 +273,9 @@
     gtk_signal_connect(GTK_OBJECT(pui->alternative_layout), "toggled",
 		       GTK_SIGNAL_FUNC(properties_modified_cb),
 		       property_box);
+    gtk_signal_connect(GTK_OBJECT(pui->message_window_autosize), "toggled",
+		       GTK_SIGNAL_FUNC(properties_modified_cb),
+		       property_box);
     gtk_signal_connect (GTK_OBJECT (pui->view_message_on_open), "toggled",
                         GTK_SIGNAL_FUNC (properties_modified_cb),
                         property_box);
@@ -476,6 +481,7 @@
     balsa_app.debug = GTK_TOGGLE_BUTTON(pui->debug)->active;
     balsa_app.previewpane = GTK_TOGGLE_BUTTON(pui->previewpane)->active;
     balsa_app.alternative_layout = GTK_TOGGLE_BUTTON(pui->alternative_layout)->active;
+    balsa_app.message_window_autosize = GTK_TOGGLE_BUTTON(pui->message_window_autosize)->active;
     balsa_app.view_message_on_open = GTK_TOGGLE_BUTTON (pui->view_message_on_open)->active;
     
     /* if (balsa_app.alt_layout_is_active != balsa_app.alternative_layout)  */
@@ -670,6 +676,8 @@
 				 balsa_app.previewpane);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->alternative_layout),
 				 balsa_app.alternative_layout);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->message_window_autosize),
+				 balsa_app.message_window_autosize);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->view_message_on_open),
                                  balsa_app.view_message_on_open);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pui->debug),
@@ -1311,6 +1319,7 @@
     GtkWidget *frame8;
     GtkWidget *vbox3;
     GtkWidget *frame9;
+	GtkWidget *frame10;
     GtkWidget *vbox4;
     GSList *group;
     GtkWidget *vbox2;
@@ -1326,6 +1335,7 @@
     GtkWidget *hbox5;
     GtkWidget *mbcolor_frame;
     GtkWidget *vbox9;
+	GtkWidget *vbox10;
     GtkWidget *font_frame;
     GtkWidget *header_frame;
     GtkWidget *table1;
@@ -1358,6 +1368,14 @@
 	_("Use alternative main window layout"), vbox7);
     pui->view_message_on_open = box_start_check(
         _("Automatically view message when mailbox opened"), vbox7);
+
+	frame10 = gtk_frame_new(_("Message window"));
+	gtk_box_pack_start(GTK_BOX(vbox2), frame10, FALSE, FALSE, 0);
+	gtk_container_set_border_width(GTK_CONTAINER(frame10), 5);
+
+	vbox10 = vbox_in_container(frame10);
+	pui->message_window_autosize = box_start_check(
+		_("Size message window automatically"), vbox10);
 
     hbox4 = gtk_hbox_new(TRUE, 0);
     gtk_box_pack_start(GTK_BOX(vbox2), hbox4, FALSE, FALSE, 0);
diff -r -b -B -u ../balsa/src/save-restore.c ./src/save-restore.c
--- ../balsa/src/save-restore.c	Fri Jul  6 18:38:04 2001
+++ ./src/save-restore.c	Tue Jul 10 15:15:17 2001
@@ -400,6 +400,13 @@
     if (balsa_app.notebook_height < 100)
 	balsa_app.notebook_height = 200;
 
+	balsa_app.message_window_width=
+	d_get_gint("MessageWindowWidth", MESSAGE_WINDOW_DEFAULT_WIDTH);
+	balsa_app.message_window_height=
+	d_get_gint("MessageWindowHeight", MESSAGE_WINDOW_DEFAULT_HEIGHT);
+	balsa_app.message_window_autosize=
+	d_get_gint("MessageWindowAutosize", MESSAGE_WINDOW_DEFAULT_AUTOSIZE);
+
     gnome_config_pop_prefix();
 
     /* Message View options ... */
@@ -653,6 +660,13 @@
     /* Section for geometry ... */
     /* FIXME: Saving window sizes is the WM's job?? */
     gnome_config_push_prefix(BALSA_CONFIG_PREFIX "Geometry/");
+
+	gnome_config_set_int("MessageWindowWidth",
+			 balsa_app.message_window_width);
+	gnome_config_set_int("MessageWindowHeight",
+			 balsa_app.message_window_height);
+	gnome_config_set_int("MessageWindowAutosize",
+			 balsa_app.message_window_autosize);
 
     /* ... column width settings */
     gnome_config_set_int("MailboxListNameWidth",


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