[anjal] Don't let the focus go to the '+' tab.



commit 1ff48ec86aa01778755a02918b004f21a9ef324a
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Sun Mar 22 19:59:38 2009 +0530

    Don't let the focus go to the '+' tab.
---
 src/mail-view.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mail-view.c b/src/mail-view.c
index c80b5bf..0f3599c 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -86,7 +86,7 @@ mv_switch (GtkNotebook     *notebook,GtkNotebookPage *page, guint page_num, gpoi
 {
 	MailView *shell = (MailView *)notebook;
 	MailViewPrivate *priv = shell->priv;
-
+	
 	if (page_num == g_list_length(priv->children) && shell->priv->new) {
 		mail_view_add_page (shell, MAIL_VIEW_FOLDER);
 		gtk_notebook_set_current_page (shell, g_list_length (shell->priv->children)-1);
@@ -196,10 +196,15 @@ static void
 mv_close_mfv (MailFolderView *mfv, MailView *mv)
 {
 	int n = list_data_pos (mv->priv->children, mfv);
-
+	int pos = gtk_notebook_get_current_page (mv);
+	
 	if (g_list_length(mv->priv->children) == 1)
 		return;
+	g_signal_handlers_block_by_func(mv, mv_switch, mv);
 	gtk_notebook_remove_page (mv, n);
+	g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
+	if (pos == g_list_length(mv->priv->children) -1)
+		 gtk_notebook_set_current_page (mv, pos -1);
 	mv->priv->children  = g_list_remove (mv->priv->children, mfv);
 }
 
@@ -224,11 +229,15 @@ static void
 mail_view_close_mcv (MailComposerView *mfv, MailView *mv)
 {
 	int n = list_data_pos (mv->priv->children, mfv);
-
+	int pos = gtk_notebook_get_current_page (mv);
+	
 	if (g_list_length(mv->priv->children) == 1)
 		return;
-
+	g_signal_handlers_block_by_func(mv, mv_switch, mv);
 	gtk_notebook_remove_page (mv, n);
+	g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
+	if (pos == g_list_length(mv->priv->children) -1)
+		 gtk_notebook_set_current_page (mv, pos -1);
 	mv->priv->children  = g_list_remove (mv->priv->children, mfv);
 }
 



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