[anjal: 1/3] Fix crash and make BACKSPACE close tabs



commit 4cbd1a2a39da27ff6dc76f34d23adec2e61194c8
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Wed Apr 1 09:58:02 2009 +0530

    Fix crash and make BACKSPACE close tabs
---
 src/mail-message-view.c |    2 ++
 src/mail-message-view.h |    5 ++++-
 src/mail-view.c         |   14 +++++++++++---
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/mail-message-view.c b/src/mail-message-view.c
index 61c4e08..d9b892a 100644
--- a/src/mail-message-view.c
+++ b/src/mail-message-view.c
@@ -72,6 +72,8 @@ mail_message_view_init (MailMessageView  *shell)
 {
 	shell->priv = g_new0(MailMessageViewPrivate, 1);
 	shell->priv->spinner = NULL;
+	shell->type = MAIL_VIEW_MESSAGE;
+	shell->uri = "mail://";
 }
 
 static void
diff --git a/src/mail-message-view.h b/src/mail-message-view.h
index 47c23a2..336fed3 100644
--- a/src/mail-message-view.h
+++ b/src/mail-message-view.h
@@ -26,6 +26,7 @@
 #include <gtk/gtk.h>
 #include <webkit/webkit.h>
 #include "em-format-webkit-display.h"
+#include "mail-view.h"
 
 #define MAIL_MESSAGE_VIEW_TYPE        (mail_message_view_get_type ())
 #define MAIL_MESSAGE_VIEW(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), MAIL_MESSAGE_VIEW_TYPE, MailFolderView))
@@ -38,7 +39,9 @@ typedef struct _MailMessageViewPrivate MailMessageViewPrivate;
 
 typedef struct _MailMessageView {
 	GtkVBox parent;
-
+	int type;
+	char *uri;
+	 
 	GtkWidget *short_header;
 	GtkWidget *details_event;
 	GtkWidget *more_details;
diff --git a/src/mail-view.c b/src/mail-view.c
index 75c3b2e..23c27d6 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -212,7 +212,7 @@ mv_close_mcv (MailFolderView *mfv, MailView *mv)
 	int n = list_data_pos (mv->priv->children, mfv);
 	int pos = gtk_notebook_get_current_page (mv);
 	MailViewChild *child;
-	
+
 	if (g_list_length(mv->priv->children) == 1)
 		return;
 	g_signal_handlers_block_by_func(mv, mv_switch, mv);
@@ -223,11 +223,12 @@ mv_close_mcv (MailFolderView *mfv, MailView *mv)
 	mv->priv->children  = g_list_remove (mv->priv->children, mfv);
 	pos = gtk_notebook_get_current_page (mv);
 	child = g_list_nth_data(mv->priv->children, pos);
+	mv->priv->current_view = child;
 	if (child->type == MAIL_VIEW_COMPOSER)
 		 mail_composer_view_activate (child, mv->folder_tree, mv->check_mail, mv->sort_by, TRUE);
 	else if (child->type == MAIL_VIEW_MESSAGE)
 		 mail_conv_view_activate (child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
-	else //if (child->type == MAIL_VIEW_FOLDER)  /* For some reason, the child type for mfv isn't getting right: FIXME later*/
+	else if (child->type == MAIL_VIEW_FOLDER)  /* For some reason, the child type for mfv isn't getting right: FIXME later*/
 		 mail_folder_view_activate (child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, TRUE);
 
 	
@@ -367,7 +368,14 @@ mail_view_show_sort_popup (MailView *mv, GtkWidget *button)
 void
 mail_view_show_list (MailView *mv)
 {
-	mail_folder_view_show_list (mv->priv->current_view);
+	 MailViewChild *child = mv->priv->current_view;
+
+	 if (child->type == MAIL_VIEW_MESSAGE || child->type == MAIL_VIEW_COMPOSER)
+		  mv_close_mcv (child, mv);
+	 else
+		  mail_folder_view_show_list (mv->priv->current_view);
+
+		  
 }
 
 static void



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