GUI keyboard and focus patch



Hello!

Sorry for my poor english but here is a patch for balsa.

This patch fixes some focus issues when using keyboard instead of the mouse.

features is:

* Make sure messagebox window has focus on balsa startup
* <RETURN> key on messagebox is same as doubleclick on mouse (open messagebox)
* Added new option to preferences -> Display: 
  "hide msgbox window when open a messagebox"
* Added a new menuoption to the mailboxes -> list: 
  this will show and set focus to Messagebox window
* When open a new messagebox the focus is always set to messagelist window
* When open a new message focus is always set to messagewindow
  TODO: There is a drawback with this because if you want to select
  multiple messages with Keyboard it will not work :-/
  This is because move with PageUp/PageDown in CList will open message :-/
  and focus is set to message window. should we change the code like this: 
  * Doubleclick mousebutton or <RETURN> open message?
  * Tripleclick mousebutton or <CONTROL> + <RETURN> 
    open message in a new message window?
  * Add popupmenu options "open message"/"open message in new window"

Please test my patch and give feedbacks :-)


Greatings:

MikeH


---

Check out my homepage at (under heavy reconstruction): 
http://www.bahnhof.se/~mikeh	

Email: mikeh@bahnhof.se
international Phone 46-44-126995
Sweden Phone: 044-126995
ICQ: Error fix later
diff -u --recursive /usr/local/src/balsa/src/balsa-app.c balsa/src/balsa-app.c
--- /usr/local/src/balsa/src/balsa-app.c	Wed Dec  1 02:16:27 1999
+++ balsa/src/balsa-app.c	Wed Dec  1 09:13:06 1999
@@ -114,6 +114,8 @@
 
   balsa_app.debug = FALSE;
   balsa_app.previewpane = TRUE;
+  balsa_app.msgindex_hide=FALSE;
+  balsa_app.mblist_hide=FALSE;
 
   /* GUI settings */
   balsa_app.mw_width = MW_DEFAULT_WIDTH;
diff -u --recursive /usr/local/src/balsa/src/balsa-app.h balsa/src/balsa-app.h
--- /usr/local/src/balsa/src/balsa-app.h	Wed Dec  1 02:16:27 1999
+++ balsa/src/balsa-app.h	Wed Dec  1 09:12:37 1999
@@ -101,7 +101,9 @@
 
   GtkToolbarStyle toolbar_style;
   GnomeMDIMode mdi_style;
-  
+
+  gboolean mblist_hide;  
+  gboolean msgindex_hide;
   gboolean previewpane;
   gboolean debug;
   gboolean smtp;
diff -u --recursive /usr/local/src/balsa/src/balsa-index-page.c balsa/src/balsa-index-page.c
--- /usr/local/src/balsa/src/balsa-index-page.c	Wed Dec  1 02:16:28 1999
+++ balsa/src/balsa-index-page.c	Sat Dec 11 11:54:55 1999
@@ -55,6 +55,7 @@
 static void index_select_cb (GtkWidget * widget, Message * message, GdkEventButton *, gpointer data);
 static GtkWidget *create_menu (BalsaIndex * bindex);
 static void index_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer data);
+static void index_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data);
 
 /* menu item callbacks */
 
@@ -144,6 +145,8 @@
   
   gtk_signal_connect(GTK_OBJECT (index), "button_press_event",
 		     (GtkSignalFunc) index_button_press_cb, bip);
+  gtk_signal_connect(GTK_OBJECT (index), "key_press_event",
+		     (GtkSignalFunc) index_key_press_cb, bip);
   
   /* setup the dnd stuff for the messages */
   gtk_object_set(GTK_OBJECT(index), "use_drag_icons", FALSE, NULL);
@@ -275,22 +278,25 @@
 
 static gint handler = 0;
 
-
 static gboolean
 idle_handler_cb(GtkWidget * widget)
 {
+  GdkEventKey *kevent;
   GdkEventButton *bevent;
   BalsaMessage *bmsg;
   Message *message;
   gpointer data;
 
   bevent = gtk_object_get_data(GTK_OBJECT (widget), "bevent");
+  kevent = gtk_object_get_data(GTK_OBJECT (widget), "kevent");
   message = gtk_object_get_data(GTK_OBJECT (widget), "message");
   data = gtk_object_get_data(GTK_OBJECT (widget), "data");
 
+ if(!data)
+   	return TRUE;
+ 
   /* get the preview pane from the index page's BalsaWindow parent */
   bmsg = BALSA_MESSAGE(BALSA_WINDOW(BALSA_INDEX_PAGE(data)->window)->preview);
-
   if (bevent && bevent->button == 3)
   {
     gtk_menu_popup (GTK_MENU(create_menu(BALSA_INDEX(widget))),
@@ -303,11 +309,14 @@
       }
   }
 
+
   handler = 0;
 
+  gtk_object_remove_data (GTK_OBJECT (widget), "kevent");
   gtk_object_remove_data (GTK_OBJECT (widget), "bevent");
   gtk_object_remove_data (GTK_OBJECT (widget), "message");
   gtk_object_remove_data (GTK_OBJECT (widget), "data");
+
   return FALSE;
 }
 
@@ -320,7 +329,7 @@
     g_return_if_fail (widget != NULL);
     g_return_if_fail (BALSA_IS_INDEX (widget));
     g_return_if_fail (message != NULL);
-    
+
     set_imap_username (message->mailbox);
 
     gtk_object_set_data (GTK_OBJECT (widget), "message", message);
@@ -333,6 +342,23 @@
     }
 }
 
+static void
+index_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+  gint row;
+  GList *list;
+  Message *current_message;
+
+  current_message=0;
+  row=0;
+  
+  gtk_object_set_data (GTK_OBJECT (widget), "kevent", event);
+    if (!handler) {
+	handler = gtk_idle_add ((GtkFunction) idle_handler_cb, widget);
+    }
+
+  return ;
+}
 
 static void
 index_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer data)
@@ -341,14 +367,14 @@
   guint row, column;
   Message *current_message;
   GtkCList *clist;
-  Mailbox *mailbox;
+/*  Mailbox *mailbox;*/
 
   clist = GTK_CLIST(widget);
   on_message=gtk_clist_get_selection_info (clist, event->x, event->y, &row, &column);
   
   if (on_message)
   {
-    mailbox = gtk_clist_get_row_data (clist, row);
+/*    mailbox = gtk_clist_get_row_data (clist, row);*/
     current_message = (Message *) gtk_clist_get_row_data (clist, row);
     if (event && event->type == GDK_2BUTTON_PRESS)
     {
@@ -447,7 +473,7 @@
   message_unread (message);
   /* balsa_index_select_next (BALSA_INDEX (mainwindow->index)); */
 }
-
+ 
 static void
 message_status_set_read_cb (GtkWidget * widget, Message * message)
 {
diff -u --recursive /usr/local/src/balsa/src/balsa-index.c balsa/src/balsa-index.c
--- /usr/local/src/balsa/src/balsa-index.c	Wed Dec  1 02:16:30 1999
+++ balsa/src/balsa-index.c	Wed Dec  1 04:58:28 1999
@@ -248,6 +248,7 @@
 		      GTK_SIGNAL_FUNC (clist_click_column),
 		      NULL);
 
+
   gtk_clist_set_selection_mode (clist, GTK_SELECTION_EXTENDED);
   gtk_clist_set_column_justification (clist, 0, GTK_JUSTIFY_RIGHT);
   gtk_clist_set_column_justification (clist, 1, GTK_JUSTIFY_CENTER);
diff -u --recursive /usr/local/src/balsa/src/balsa-mblist.c balsa/src/balsa-mblist.c
--- /usr/local/src/balsa/src/balsa-mblist.c	Wed Dec  1 02:16:35 1999
+++ balsa/src/balsa-mblist.c	Wed Dec  1 04:09:01 1999
@@ -48,6 +48,7 @@
 static void button_event_press_cb(GtkCTree * ctree, GdkEventButton * event,
 				  gpointer data);
 
+
 static BalsaMBListClass *parent_class = NULL;
 
 
@@ -59,7 +60,6 @@
 static void balsa_mblist_set_arg(GtkObject * object, GtkArg * arg, guint arg_id);
 static void balsa_mblist_get_arg(GtkObject * object, GtkArg * arg, guint arg_id);
 
-
 static void mailbox_tree_expand(GtkCTree *, GtkCTreeNode *, gpointer);
 static void mailbox_tree_collapse(GtkCTree *, GtkCTreeNode *, gpointer);
 
@@ -224,6 +224,8 @@
   gtk_ctree_set_expander_style (GTK_CTREE (tree), GTK_CTREE_EXPANDER_CIRCULAR);
   gtk_clist_set_row_height (GTK_CLIST (tree), 16);
   gtk_clist_set_column_width (GTK_CLIST (tree), 0, 80);
+  gtk_clist_set_selection_mode(GTK_CLIST(tree),GTK_SELECTION_BROWSE);	
+
 #ifdef BALSA_SHOW_INFO
   if (tree->display_content_info)
     {
@@ -448,19 +450,18 @@
   }
 }
 
-
 static void
 select_mailbox (GtkCTree * ctree, GtkCTreeNode * row, gint column)
 {
   BalsaMBList *bmbl;
-  GdkEventButton *bevent = (GdkEventButton *) gtk_get_current_event ();
   Mailbox *mailbox;
+  GdkEventButton *bevent = (GdkEventButton *) gtk_get_current_event ();
 
   bmbl = BALSA_MBLIST(ctree);
 
   mailbox = gtk_ctree_node_get_row_data (ctree, row);
 
-  if (mailbox->ismbnode)
+  if (!mailbox || mailbox->ismbnode)
     return;
 
   if (bevent && bevent->button == 1)
diff -u --recursive /usr/local/src/balsa/src/balsa-message.c balsa/src/balsa-message.c
--- /usr/local/src/balsa/src/balsa-message.c	Wed Dec  1 02:16:36 1999
+++ balsa/src/balsa-message.c	Wed Dec  1 09:16:43 1999
@@ -406,6 +406,7 @@
 				  (x2 > alloc->width) ? x2 : alloc->width,
 				  (y2 > alloc->height) ? y2 : alloc->height);
 
+	gtk_widget_grab_focus(bmessage);
 }
 
 static GnomeCanvasItem *
diff -u --recursive /usr/local/src/balsa/src/main-window.c balsa/src/main-window.c
--- /usr/local/src/balsa/src/main-window.c	Wed Dec  1 02:16:44 1999
+++ balsa/src/main-window.c	Wed Dec  1 09:20:06 1999
@@ -95,6 +95,8 @@
 /* callbacks */
 static void check_new_messages_cb (GtkWidget *, gpointer data);
 
+static void mblist_menu_list_cb(GtkWidget* widget, gpointer data);
+static void mblist_menu_listheaders_cb(GtkWidget* widget, gpointer data);
 static void new_message_cb (GtkWidget * widget, gpointer data);
 static void replyto_message_cb (GtkWidget * widget, gpointer data);
 static void replytoall_message_cb (GtkWidget * widget, gpointer data);
@@ -207,12 +209,17 @@
 
 static GnomeUIInfo mailbox_menu[] =
 {
-#if 0
+
   {
-    GNOME_APP_UI_ITEM, N_ ("List"), NULL, mblist_window_cb, NULL,
-    NULL, GNOME_APP_PIXMAP_NONE, GNOME_STOCK_MENU_PROP, 'C', 0, NULL
+    GNOME_APP_UI_ITEM, N_ ("List"), NULL, mblist_menu_list_cb, NULL,
+    NULL, GNOME_APP_PIXMAP_NONE, GNOME_STOCK_MENU_PROP, 'L', 0, NULL
   },
-#endif
+  /* TODO move this me nu item to a better place */
+  {
+    GNOME_APP_UI_ITEM, N_ ("List message headers"), NULL, mblist_menu_listheaders_cb, NULL,
+    NULL, GNOME_APP_PIXMAP_NONE, GNOME_STOCK_MENU_PROP, 'S', 0, NULL
+  },
+
   GNOMEUIINFO_ITEM_STOCK (N_ ("_Open"), N_("Open the selected mailbox"),
 			  mblist_menu_open_cb, GNOME_STOCK_MENU_OPEN),
   GNOMEUIINFO_ITEM_STOCK (N_ ("_Close"), N_("Close the selected mailbox"),
@@ -397,9 +404,6 @@
   BalsaWindow *window;
   GnomeAppBar *appbar;
   GtkWidget *preview;
-  GtkWidget *hpaned;
-  GtkWidget *vpaned;
-
 
   window = gtk_type_new (BALSA_TYPE_WINDOW);
   gnome_app_construct(GNOME_APP(window), "balsa", "Balsa");
@@ -426,8 +430,8 @@
   gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
   gtk_window_set_default_size(GTK_WINDOW(window), balsa_app.mw_width, balsa_app.mw_height);
 
-  vpaned = gtk_vpaned_new();
-  hpaned = gtk_hpaned_new();
+  window->vpaned = gtk_vpaned_new();
+  window->hpaned = gtk_hpaned_new();
   window->notebook = gtk_notebook_new();
   gtk_notebook_set_show_border(GTK_NOTEBOOK(window->notebook), FALSE);
   gtk_signal_connect( GTK_OBJECT(window->notebook), "size_allocate", 
@@ -435,26 +439,27 @@
   /* this call will set window->preview */
   preview = balsa_window_create_preview_pane(window);
 
-  gnome_app_set_contents(GNOME_APP(window), hpaned);
+  gnome_app_set_contents(GNOME_APP(window), window->hpaned);
 
   // XXX
   window->mblist = balsa_mailbox_list_window_new(window);
-  gtk_paned_pack1(GTK_PANED(hpaned), window->mblist, TRUE, TRUE);
-  gtk_paned_pack2(GTK_PANED(hpaned), vpaned, TRUE, TRUE);
+  gtk_paned_pack1(GTK_PANED(window->hpaned), window->mblist, TRUE, TRUE);
+  gtk_paned_pack2(GTK_PANED(window->hpaned), window->vpaned, TRUE, TRUE);
   /*PKGW: do it this way, without the usizes.*/
-  gtk_paned_set_position( GTK_PANED(hpaned), balsa_app.mblist_width );
+  gtk_paned_set_position( GTK_PANED(window->hpaned), balsa_app.mblist_width );
 
-  gtk_paned_pack1(GTK_PANED(vpaned), window->notebook, TRUE, TRUE);
-  gtk_paned_pack2(GTK_PANED(vpaned), preview, TRUE, TRUE);
+  gtk_paned_pack1(GTK_PANED(window->vpaned), window->notebook, TRUE, TRUE);
+  gtk_paned_pack2(GTK_PANED(window->vpaned), preview, TRUE, TRUE);
   /*PKGW: do it this way, without the usizes.*/
-  gtk_paned_set_position( GTK_PANED(vpaned), balsa_app.notebook_height );
+  gtk_paned_set_position( GTK_PANED(window->vpaned), balsa_app.notebook_height );
 
-  gtk_widget_show(vpaned);
-  gtk_widget_show(hpaned);
+  gtk_widget_show(window->vpaned);
+  gtk_widget_show(window->hpaned);
   gtk_widget_show(window->notebook);
   gtk_widget_show(window->mblist);
   gtk_widget_show(preview);
 
+  
   return GTK_WIDGET (window);
 }
 
@@ -520,6 +525,13 @@
   /* change the page to the newly selected notebook item */
   gtk_notebook_set_page(GTK_NOTEBOOK(window->notebook),
 			gtk_notebook_page_num(GTK_NOTEBOOK(window->notebook), GTK_WIDGET(BALSA_INDEX_PAGE(page)->sw)));
+
+  if(balsa_app.mblist_hide)
+	  gtk_paned_set_position( GTK_PANED(window->hpaned), 0 );
+
+
+  gtk_widget_grab_focus(GTK_WIDGET(BALSA_INDEX_PAGE(page)->index));
+  gtk_window_set_focus(GTK_WINDOW(window),GTK_WIDGET(BALSA_INDEX_PAGE(page)->index));
 }
 
 static void balsa_window_real_close_mailbox(BalsaWindow *window, Mailbox *mailbox)
@@ -869,6 +881,43 @@
   return GTK_WIDGET(BALSA_INDEX_PAGE(page)->index);
 }
 
+static void
+mblist_menu_list_cb(GtkWidget *widget, gpointer data)
+{
+  g_return_if_fail (data != NULL);
+	/* the only thing this code is doing is to set focus to the mailbox window */
+   /* so the user can scroll with keyboard */
+  /* this is because I hate using the mouse in a mail application :-) */
+
+    /* maybe we should have a option to show/hide(set_hpaned??) */
+   /* mailbox window then this callback should also show the widget */
+   
+  /*looks like BALSA_WINDOW has no acces to the tree widget */
+  /* BALSA_WINDOW has only acces to the scrollwindow */
+  /* so I added a gtk_object_set_data("ctree") to BALSA_WINDOW->mblist */
+  /* else we cant set focus to ctree... */
+ 
+/* TODO hardcoded position FIXLATER */
+
+  gtk_paned_set_position( GTK_PANED(BALSA_WINDOW(data)->hpaned), 150);
+  
+	gtk_widget_grab_focus(GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(BALSA_WINDOW(data)->mblist),"ctree")));
+}
+
+void 
+mblist_menu_listheaders_cb(GtkWidget *widget, gpointer data)
+{
+ GtkWidget *index;
+
+  g_return_if_fail (data != NULL);
+
+   index = balsa_window_find_current_index(BALSA_WINDOW(data));
+
+/* TODO hardcoded position FIXLATER */
+  gtk_paned_set_position( GTK_PANED(BALSA_WINDOW(data)->vpaned), 180 );
+
+	gtk_widget_grab_focus(index);
+}
 
 static void
 new_message_cb (GtkWidget * widget, gpointer data)
diff -u --recursive /usr/local/src/balsa/src/main-window.h balsa/src/main-window.h
--- /usr/local/src/balsa/src/main-window.h	Wed Dec  1 02:16:44 1999
+++ balsa/src/main-window.h	Wed Dec  1 08:29:30 1999
@@ -34,6 +34,9 @@
 {
   GnomeApp window;
 
+  GtkWidget *hpaned;
+  GtkWidget *vpaned;
+
   GtkWidget *progress_bar;
   GtkWidget *mblist;
   GtkWidget *notebook;
diff -u --recursive /usr/local/src/balsa/src/mblist-window.c balsa/src/mblist-window.c
--- /usr/local/src/balsa/src/mblist-window.c	Wed Dec  1 02:16:45 1999
+++ balsa/src/mblist-window.c	Wed Dec  1 06:44:47 1999
@@ -68,6 +68,7 @@
 void mblist_close_mailbox (Mailbox * mailbox);
 static void mailbox_select_cb (BalsaMBList *, Mailbox *, GtkCTreeNode *, GdkEventButton *);
 static gint mblist_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer data);
+static gint mblist_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data);
 /*PKGW*/
 static void size_allocate_cb( GtkWidget *widget, GtkAllocation *alloc );
 
@@ -95,6 +96,9 @@
   balsa_app.mblist = BALSA_MBLIST (mblw->ctree);
   gtk_container_add(GTK_CONTAINER(widget), GTK_WIDGET(mblw->ctree));
 
+  gtk_object_set_data(GTK_OBJECT(widget),"ctree",mblw->ctree);
+  gtk_window_set_focus(GTK_WINDOW(window),GTK_WIDGET(mblw->ctree));
+
   gtk_widget_pop_colormap ();
   gtk_widget_pop_visual ();
   
@@ -130,6 +134,10 @@
     GTK_SIGNAL_FUNC (mailbox_select_cb), NULL);
   gtk_signal_connect (GTK_OBJECT (mblw->ctree), "button_press_event",
   GTK_SIGNAL_FUNC (mblist_button_press_cb), NULL);
+
+  gtk_signal_connect (GTK_OBJECT (mblw->ctree), "key_press_event",
+  GTK_SIGNAL_FUNC (mblist_key_press_cb), NULL);
+
   /* PKGW: We want to catch size changes for balsa_app.mblist_width */
   gtk_signal_connect( GTK_OBJECT( mblw->ctree ), "size_allocate",
 		      GTK_SIGNAL_FUNC( size_allocate_cb ), NULL );
@@ -205,6 +213,34 @@
     return;
 
   balsa_window_close_mailbox(BALSA_WINDOW(mblw->window), mailbox);
+}
+
+static gint
+mblist_key_press_cb(GtkWidget *widget, GdkEventKey *ev,gpointer data)
+{
+  gint row;
+  GList *list;
+  Mailbox *mailbox;
+
+  mailbox=0;
+  row=0;
+  if(ev->keyval==GDK_Return)	
+  {	
+  	list=GTK_CLIST(widget)->row_list;
+	  while(list)	{
+  		if(GTK_CLIST_ROW(list)->state==GTK_STATE_SELECTED)  
+  		{
+		      mailbox = gtk_clist_get_row_data (GTK_CLIST(widget), row);
+  			if(mailbox && !mailbox->ismbnode){
+  				  mblist_open_mailbox (mailbox);  
+			}
+			break;
+		  }
+	  	list=g_list_next(list);
+  		row++;
+  	};
+  }
+  return FALSE;
 }
  
 
diff -u --recursive /usr/local/src/balsa/src/message-window.c balsa/src/message-window.c
--- /usr/local/src/balsa/src/message-window.c	Wed Dec  1 02:16:45 1999
+++ balsa/src/message-window.c	Wed Dec  1 05:05:42 1999
@@ -113,6 +113,7 @@
 	   * that one.
 	   */
 	  gdk_window_raise(GTK_WIDGET(mw->window)->window);
+
 	  return;
 	}
     }
diff -u --recursive /usr/local/src/balsa/src/pref-manager.c balsa/src/pref-manager.c
--- /usr/local/src/balsa/src/pref-manager.c	Wed Dec  1 02:16:47 1999
+++ balsa/src/pref-manager.c	Sat Dec 11 12:01:47 1999
@@ -43,8 +43,11 @@
     GtkWidget *rb_local_mua, *rb_smtp_server;
 
     GtkWidget *previewpane;
+	GtkWidget *mblist_hide;
+    GtkWidget *msgindex_hide;
     GtkWidget *debug;		/* enable/disable debugging */
 
+
 #ifdef BALSA_SHOW_INFO
     GtkWidget *mblist_show_mb_content_info;
 #endif
@@ -214,6 +217,10 @@
       gtk_signal_connect (GTK_OBJECT (pui->toolbar_type[i]), "clicked",
 			  properties_modified_cb, pui->pbox);
     }
+  gtk_signal_connect (GTK_OBJECT (pui->msgindex_hide), "toggled",
+		      GTK_SIGNAL_FUNC (properties_modified_cb), pui->pbox);
+  gtk_signal_connect (GTK_OBJECT (pui->mblist_hide), "toggled",
+		      GTK_SIGNAL_FUNC (properties_modified_cb), pui->pbox);
 
   gtk_signal_connect (GTK_OBJECT (pui->previewpane), "toggled",
 		      GTK_SIGNAL_FUNC (properties_modified_cb), pui->pbox);
@@ -348,6 +355,8 @@
 	break;
       }
   balsa_app.debug = GTK_TOGGLE_BUTTON (pui->debug)->active;
+  balsa_app.msgindex_hide = GTK_TOGGLE_BUTTON (pui->msgindex_hide)->active;
+  balsa_app.mblist_hide = GTK_TOGGLE_BUTTON (pui->mblist_hide)->active;
   balsa_app.previewpane = GTK_TOGGLE_BUTTON (pui->previewpane)->active;
   balsa_app.smtp = GTK_TOGGLE_BUTTON (pui->rb_smtp_server)->active;
 #ifdef BALSA_SHOW_INFO
@@ -430,7 +439,8 @@
    
   
   gtk_entry_set_text (GTK_ENTRY (pui->mail_directory), balsa_app.local_mail_directory);
-
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->msgindex_hide), balsa_app.msgindex_hide);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->mblist_hide), balsa_app.mblist_hide);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->previewpane), balsa_app.previewpane);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->debug), balsa_app.debug);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->rb_smtp_server), balsa_app.smtp);
@@ -716,7 +726,7 @@
 static GtkWidget *
 create_display_page ()
 {
-  GtkWidget *vbox, *vbox1;
+  GtkWidget *vbox, *vbox1,*vbox2;
   GtkWidget *frame;
   GSList *group;
   gint i;
@@ -745,8 +755,17 @@
   frame = gtk_frame_new (_("Main window"));
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 5);
 
+  vbox2 = gtk_vbox_new (FALSE, 0);
+  gtk_container_add (GTK_CONTAINER (frame), vbox2);
+
   pui->previewpane = gtk_check_button_new_with_label ( _("Use preview pane"));
-  gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (pui->previewpane));
+  pui->mblist_hide = gtk_check_button_new_with_label ( _("Hide messagebox window when open a new messagebox"));
+  pui->msgindex_hide = gtk_check_button_new_with_label ( _("Hide message(subject) list window after open a new message [exprimental]"));
+
+  gtk_box_pack_start (GTK_BOX (vbox2), pui->previewpane, FALSE, FALSE, 5);
+  gtk_box_pack_start (GTK_BOX (vbox2), pui->mblist_hide, FALSE, FALSE, 5);
+  gtk_box_pack_start (GTK_BOX (vbox2), pui->msgindex_hide, FALSE, FALSE, 5);
+
 #ifdef BALSA_SHOW_INFO
   /* mailbox list window */
   frame = gtk_frame_new ("Mailbox list window");
diff -u --recursive /usr/local/src/balsa/src/save-restore.c balsa/src/save-restore.c
--- /usr/local/src/balsa/src/save-restore.c	Wed Dec  1 02:16:49 1999
+++ balsa/src/save-restore.c	Wed Dec  1 09:30:44 1999
@@ -688,6 +688,19 @@
   else
     balsa_app.toolbar_style = atoi (field);
 
+	/* hide mailboxes window after open a new mailbox */
+  if ((field = pl_dict_get_str (globals, "HideMailboxWindow")) == NULL)
+    balsa_app.mblist_hide = FALSE;
+  else
+    balsa_app.mblist_hide = atoi (field);
+
+	/* hide mailheaders window after open a new mail */
+  if ((field = pl_dict_get_str (globals, "HideMailHeaderWindow")) == NULL)
+    balsa_app.msgindex_hide = FALSE;
+  else
+    balsa_app.msgindex_hide = atoi (field);
+
+
   /* use the preview pane */
   if ((field = pl_dict_get_str (globals, "UsePreviewPane")) == NULL)
     balsa_app.previewpane = TRUE;
@@ -835,6 +848,13 @@
 
     snprintf (tmp, sizeof (tmp), "%d", balsa_app.debug);
     pl_dict_add_str_str (globals, "Debug", tmp);
+
+    snprintf (tmp, sizeof (tmp), "%d", balsa_app.msgindex_hide);
+    pl_dict_add_str_str (globals, "HideMailHeaderWindow", tmp);
+
+    snprintf (tmp, sizeof (tmp), "%d", balsa_app.mblist_hide);
+    pl_dict_add_str_str (globals, "HideMailboxWindow", tmp);
+
 
     snprintf (tmp, sizeof (tmp), "%d", balsa_app.previewpane);
     pl_dict_add_str_str (globals, "UsePreviewPane", tmp);


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