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 priv->msg_uid;
}
+ModestWindow *
+modest_msg_view_window_new_from_uid (const gchar *modest_account_name,
+ const gchar *mailbox,
+ const gchar *msg_uid)
+{
+ /* NOT IMPLEMENTED */
+ return NULL;
+}
+
ModestWindow*
modest_msg_view_window_new_with_header_model (TnyMsg *msg,
const gchar *modest_account_name,
/* Currently we simply redirect to new constructor. It should store a
reference to the header list model, to enable next/prev message
actions */
- g_message ("partially implemented %s", __FUNCTION__);
+ g_debug ("partially implemented %s", __FUNCTION__);
return modest_msg_view_window_new_for_attachment (msg, modest_account_name, NULL, msg_uid);
}
gboolean
modest_msg_view_window_select_next_message (ModestMsgViewWindow *window)
{
- g_message ("not implemented %s", __FUNCTION__);
+ g_warning ("not implemented %s", __FUNCTION__);
return FALSE;
}
gboolean
modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window)
{
- g_message ("not implemented %s", __FUNCTION__);
+ g_warning ("not implemented %s", __FUNCTION__);
return FALSE;
}
void
modest_msg_view_window_view_attachment (ModestMsgViewWindow *window, TnyMimePart *mime_part)
{
- g_message ("not implemented %s", __FUNCTION__);
+ g_warning ("not implemented %s", __FUNCTION__);
}
void
modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts)
{
- g_message ("not implemented %s", __FUNCTION__);
+ g_warning ("not implemented %s", __FUNCTION__);
}
void
modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean get_all)
{
- g_message ("not implemented %s", __FUNCTION__);
+ g_warning ("not implemented %s", __FUNCTION__);
}
TnyHeader *
gboolean
modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return TRUE;
}
gboolean
modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return TRUE;
}
gboolean
modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return FALSE;
}
gboolean
modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return FALSE;
}
TnyList *result;
result = tny_simple_list_new ();
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return result;
}
gboolean
modest_msg_view_window_is_search_result (ModestMsgViewWindow *window)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return FALSE;
}
gboolean
modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return FALSE;
}
modest_msg_view_window_toggle_find_toolbar (GtkToggleAction *toggle,
gpointer data)
{
- g_message ("NOT IMPLEMENTED %s", __FUNCTION__);
+ g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
return FALSE;
}