GtkWidget *msg_view;
gchar *msg_uid;
+ TnyMimePart *other_body;
};
#define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->menubar = NULL;
priv->msg_view = NULL;
priv->msg_uid = NULL;
+ priv->other_body = NULL;
}
static void
-init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
+init_window (ModestMsgViewWindow *obj, TnyMsg *msg, TnyMimePart *other_body)
{
GtkWidget *main_vbox, *scrolled_window;
ModestMsgViewWindowPrivate *priv;
parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
priv->msg_view = GTK_WIDGET (tny_platform_factory_new_msg_view (modest_tny_platform_factory_get_instance ()));
- tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
+ if (other_body) {
+ priv->other_body = g_object_ref (other_body);
+ modest_msg_view_set_msg_with_other_body (MODEST_MSG_VIEW (priv->msg_view), msg, other_body);
+ } else {
+ tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
+ }
main_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 0);
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+ if (priv->other_body != NULL) {
+ g_object_unref (priv->other_body);
+ priv->other_body = NULL;
+ }
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
}
+gboolean
+modest_msg_view_window_is_other_body (ModestMsgViewWindow *self)
+{
+ ModestMsgViewWindowPrivate *priv = NULL;
+
+ g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self), FALSE);
+ priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
+
+ return (priv->other_body != NULL);
+}
+
ModestWindow *
-modest_msg_view_window_new_for_attachment (TnyMsg *msg,
- const gchar *modest_account_name,
- const gchar *mailbox, /* ignored */
- const gchar *msg_uid)
+modest_msg_view_window_new_with_other_body (TnyMsg *msg,
+ TnyMimePart *other_body,
+ const gchar *modest_account_name,
+ const gchar *mailbox, /* ignored */
+ const gchar *msg_uid)
{
GObject *obj;
ModestMsgViewWindowPrivate *priv;
gtk_toolbar_set_tooltips (GTK_TOOLBAR (priv->toolbar), TRUE);
/* Init window */
- init_window (MODEST_MSG_VIEW_WINDOW(obj), msg);
+ init_window (MODEST_MSG_VIEW_WINDOW(obj), msg, other_body);
restore_settings (MODEST_WINDOW(obj));
header = tny_msg_get_header (msg);
- if (header)
- subject = tny_header_dup_subject (header);
+ if (other_body) {
+ gchar *description;
+
+ description = modest_tny_mime_part_get_header_value (other_body, "Content-Description");
+ if (description) {
+ g_strstrip (description);
+ subject = description;
+ }
+ } else {
+ if (header)
+ subject = tny_header_dup_subject (header);
+ }
+
if (subject != NULL)
gtk_window_set_title (GTK_WINDOW (obj), subject);
return MODEST_WINDOW(obj);
}
+ModestWindow *
+modest_msg_view_window_new_for_attachment (TnyMsg *msg,
+ const gchar *modest_account_name,
+ const gchar *mailbox, /* ignored */
+ const gchar *msg_uid)
+{
+
+ return modest_msg_view_window_new_with_other_body (msg, NULL, modest_account_name, mailbox, msg_uid);
+
+}
+
TnyMsg*
modest_msg_view_window_get_message (ModestMsgViewWindow *self)
return modest_msg_view_has_blocked_external_images (MODEST_MSG_VIEW (priv->msg_view));
}
+
+void
+modest_msg_view_window_reload (ModestMsgViewWindow *self)
+{
+ /* Not implemented */
+ return;
+}