X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fgnome%2Fmodest-msg-view-window.c;h=000f0901dc875e9c3be822e6911d77fc51bf28a7;hp=e766ab0e9fc642023fe07c872e9c811b233bff0a;hb=8f4797391e5962158a0a085646f1d24da887ee3d;hpb=1f49ac9df5635e0427ef1c2e1b2cc0c30c7c0cd2 diff --git a/src/gnome/modest-msg-view-window.c b/src/gnome/modest-msg-view-window.c index e766ab0..000f090 100644 --- a/src/gnome/modest-msg-view-window.c +++ b/src/gnome/modest-msg-view-window.c @@ -65,6 +65,7 @@ struct _ModestMsgViewWindowPrivate { GtkWidget *msg_view; gchar *msg_uid; + TnyMimePart *other_body; }; #define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ @@ -153,11 +154,12 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj) 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; @@ -167,7 +169,12 @@ init_window (ModestMsgViewWindow *obj, TnyMsg *msg) 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); @@ -191,6 +198,11 @@ modest_msg_view_window_finalize (GObject *obj) 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); } @@ -204,11 +216,23 @@ on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self) } +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; @@ -280,12 +304,23 @@ modest_msg_view_window_new_for_attachment (TnyMsg *msg, 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); @@ -331,6 +366,17 @@ modest_msg_view_window_new_for_attachment (TnyMsg *msg, 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) @@ -368,6 +414,15 @@ modest_msg_view_window_get_message_uid (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, @@ -379,7 +434,7 @@ modest_msg_view_window_new_with_header_model (TnyMsg *msg, /* 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); } @@ -388,32 +443,32 @@ modest_msg_view_window_new_with_header_model (TnyMsg *msg, 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 * @@ -461,28 +516,28 @@ modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window) 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; } @@ -493,21 +548,21 @@ modest_msg_view_window_get_attachments (ModestMsgViewWindow *win) 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; } @@ -515,7 +570,7 @@ static void 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; } @@ -525,3 +580,29 @@ modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self) modest_ui_actions_on_add_to_contacts (NULL, MODEST_WINDOW (self)); } +void +modest_msg_view_window_fetch_images (ModestMsgViewWindow *self) +{ + ModestMsgViewWindowPrivate *priv; + priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self); + + modest_msg_view_request_fetch_images (MODEST_MSG_VIEW (priv->msg_view)); +} + +gboolean +modest_msg_view_window_has_blocked_external_images (ModestMsgViewWindow *self) +{ + ModestMsgViewWindowPrivate *priv; + priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self); + + g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self), FALSE); + + 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; +}