Modified webpage: now tinymail repository is in gitorious.
[modest] / src / widgets / modest-msg-view-window.c
index f68d07a..91dfcc4 100644 (file)
@@ -283,7 +283,7 @@ static const GtkToggleActionEntry msg_view_toggle_action_entries [] = {
                                                     MODEST_TYPE_MSG_VIEW_WINDOW, \
                                                     ModestMsgViewWindowPrivate))
 /* globals */
-static GtkWindowClass *parent_class = NULL;
+static ModestWindowParentClass *parent_class = NULL;
 
 /* uncomment the following if you have defined any signals */
 static guint signals[LAST_SIGNAL] = {0};
@@ -2228,10 +2228,10 @@ view_msg_cb (ModestMailOperation *mail_op,
        modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (), header);
 
        row_reference = (GtkTreeRowReference *) user_data;
-       if (canceled) {
+       self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
+       if (canceled || !self || MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self)->msg_view == NULL ) {
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
-               self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
                if (self) {
                        /* Restore window title */
                        update_window_title (self);
@@ -2245,7 +2245,6 @@ view_msg_cb (ModestMailOperation *mail_op,
        if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
-               self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
                if (self) {
                        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
                        /* First we check if the parent is a folder window */
@@ -2309,7 +2308,6 @@ view_msg_cb (ModestMailOperation *mail_op,
        }
 
        /* Get the window */ 
-       self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
 
@@ -2777,7 +2775,7 @@ on_decode_to_stream_async_handler (TnyMimePart *mime_part,
                                account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
 
                        msg = tny_camel_msg_new ();
-                       tny_camel_msg_parse (TNY_CAMEL_MSG (msg), file_stream);
+                       tny_camel_msg_parse ((TnyCamelMsg *) msg, file_stream);
 
                        if (priv->top_msg)
                                top_msg = g_object_ref (priv->top_msg);
@@ -3965,9 +3963,9 @@ setup_menu (ModestMsgViewWindow *self)
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW(self));
 
        /* Settings menu buttons */
-       modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), NULL,
-                                  MODEST_WINDOW_MENU_CALLBACK (modest_msg_view_window_show_isearch_toolbar),
-                                  MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_find_in_msg));
+       modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
+                                  MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_msg),
+                                  MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
 
        modest_window_add_to_menu (MODEST_WINDOW (self),
                                   dngettext(GETTEXT_PACKAGE,
@@ -3981,7 +3979,6 @@ setup_menu (ModestMsgViewWindow *self)
        modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_mark_as_read"), NULL,
                                   MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_mark_as_read),
                                   MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_read_msg_in_view));
-
        modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_mark_as_unread"), NULL,
                                   MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_mark_as_unread),
                                   MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_unread_msg_in_view));
@@ -3993,9 +3990,6 @@ setup_menu (ModestMsgViewWindow *self)
                                   MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_remove_attachments),
                                   MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_remove_attachments));
 
-       modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
-                                  MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_msg),
-                                  MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
        modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_addtocontacts"), NULL,
                                   MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_add_to_contacts),
                                   MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts));
@@ -4003,6 +3997,10 @@ setup_menu (ModestMsgViewWindow *self)
        modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_ti_message_properties"), NULL,
                                   MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_details),
                                   MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_details));
+
+       modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), NULL,
+                                  MODEST_WINDOW_MENU_CALLBACK (modest_msg_view_window_show_isearch_toolbar),
+                                  MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_find_in_msg));
 }
 
 void