This is a manual merge of branch drop split view intro trunk.
[modest] / src / widgets / modest-gtkhtml-msg-view.c
index 38e37be..d8ebb46 100644 (file)
 #include <glib/gi18n.h>
 #include <tny-list.h>
 #include <tny-simple-list.h>
+#include <tny-vfs-stream.h>
 
 #include <modest-tny-msg.h>
 #include <modest-text-utils.h>
 #include <widgets/modest-msg-view.h>
-#include <widgets/modest-mail-header-view.h>
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <widgets/modest-compact-mail-header-view.h>
+#include <hildon/hildon-gtk.h>
+#else
+#include <widgets/modest-expander-mail-header-view.h>
+#endif
 #include <widgets/modest-attachments-view.h>
 #include <modest-marshal.h>
 #include <widgets/modest-gtkhtml-mime-part-view.h>
 #include <widgets/modest-gtkhtml-msg-view.h>
 #include <widgets/modest-isearch-view.h>
+#include <widgets/modest-ui-constants.h>
 
 /* FIXNE: we should have no maemo-deps in widgets/ */
-#ifdef MODEST_PLATFORM_MAEMO
+#ifndef MODEST_TOOLKIT_GTK
 #include "maemo/modest-hildon-includes.h"
-#endif /*MODEST_PLATFORM_MAEMO*/
+#endif /*!MODEST_TOOLKIT_GTK*/
 
 
 /* 'private'/'protected' functions */
@@ -69,7 +76,9 @@ static void     get_property (GObject *object, guint prop_id, GValue *value, GPa
 
 /* headers signals */
 static void on_recpt_activated (ModestMailHeaderView *header_view, const gchar *address, ModestGtkhtmlMsgView *msg_view);
+static void on_show_details (ModestMailHeaderView *header_view, ModestGtkhtmlMsgView *msg_view);
 static void on_attachment_activated (ModestAttachmentsView * att_view, TnyMimePart *mime_part, gpointer userdata);
+static void on_view_images_clicked (GtkButton * button, gpointer self);
 
 /* body view signals */
 static gboolean on_activate_link (GtkWidget *widget, const gchar *uri, ModestGtkhtmlMsgView *msg_view);
@@ -79,6 +88,7 @@ static gboolean on_link_hover (GtkWidget *widget, const gchar *uri, ModestGtkhtm
 
 #ifdef MAEMO_CHANGES
 static void     on_tap_and_hold (GtkWidget *widget, gpointer userdata); 
+static gboolean on_tap_and_hold_query (GtkWidget *widget, GdkEvent *event, gpointer userdata); 
 #endif /*MAEMO_CHANGES*/
 
 
@@ -98,6 +108,22 @@ static void disconnect_vadjustment (ModestGtkhtmlMsgView *obj);
 static void disconnect_hadjustment (ModestGtkhtmlMsgView *obj);
 static gboolean idle_readjust_scroll (ModestGtkhtmlMsgView *obj);
 
+/* vertical panning implementation */
+#ifdef MAEMO_CHANGES
+static gboolean motion_notify_event (GtkWidget *widget,
+                                    GdkEventMotion *event,
+                                    gpointer userdata);
+#endif
+
+static gboolean 
+button_press_event (GtkWidget *widget,
+                   GdkEventButton *event,
+                   gpointer userdata);
+static gboolean 
+button_release_event (GtkWidget *widget,
+                     GdkEventButton *event,
+                     gpointer userdata);
+
 /* GtkContainer methods */
 static void forall (GtkContainer *container, gboolean include_internals,
                    GtkCallback callback, gpointer userdata);
@@ -148,8 +174,8 @@ static void modest_gtkhtml_msg_view_set_shadow_type (ModestMsgView *self, GtkSha
 static GtkShadowType modest_gtkhtml_msg_view_get_shadow_type (ModestMsgView *self);
 static TnyHeaderFlags modest_gtkhtml_msg_view_get_priority (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_set_priority (ModestMsgView *self, TnyHeaderFlags flags);
-static GList *modest_gtkhtml_msg_view_get_selected_attachments (ModestMsgView *self);
-static GList *modest_gtkhtml_msg_view_get_attachments (ModestMsgView *self);
+static TnyList *modest_gtkhtml_msg_view_get_selected_attachments (ModestMsgView *self);
+static TnyList *modest_gtkhtml_msg_view_get_attachments (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_grab_focus (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_remove_attachment (ModestMsgView *view, TnyMimePart *attachment);
 static GtkAdjustment *modest_gtkhtml_msg_view_get_vadjustment_default (ModestMsgView *self);
@@ -160,8 +186,8 @@ static void modest_gtkhtml_msg_view_set_shadow_type_default (ModestMsgView *self
 static GtkShadowType modest_gtkhtml_msg_view_get_shadow_type_default (ModestMsgView *self);
 static TnyHeaderFlags modest_gtkhtml_msg_view_get_priority_default (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_set_priority_default (ModestMsgView *self, TnyHeaderFlags flags);
-static GList *modest_gtkhtml_msg_view_get_selected_attachments_default (ModestMsgView *self);
-static GList *modest_gtkhtml_msg_view_get_attachments_default (ModestMsgView *self);
+static TnyList *modest_gtkhtml_msg_view_get_selected_attachments_default (ModestMsgView *self);
+static TnyList *modest_gtkhtml_msg_view_get_attachments_default (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_grab_focus_default (ModestMsgView *self);
 static void modest_gtkhtml_msg_view_remove_attachment_default (ModestMsgView *view, TnyMimePart *attachment);
 
@@ -181,8 +207,8 @@ static void set_shadow_type (ModestGtkhtmlMsgView *self, GtkShadowType type);
 static GtkShadowType get_shadow_type (ModestGtkhtmlMsgView *self);
 static TnyHeaderFlags get_priority (ModestGtkhtmlMsgView *self);
 static void set_priority (ModestGtkhtmlMsgView *self, TnyHeaderFlags flags);
-static GList *get_selected_attachments (ModestGtkhtmlMsgView *self);
-static GList *get_attachments (ModestGtkhtmlMsgView *self);
+static TnyList *get_selected_attachments (ModestGtkhtmlMsgView *self);
+static TnyList *get_attachments (ModestGtkhtmlMsgView *self);
 static void grab_focus (ModestGtkhtmlMsgView *self);
 static void remove_attachment (ModestGtkhtmlMsgView *view, TnyMimePart *attachment);
 
@@ -206,6 +232,7 @@ struct _ModestGtkhtmlMsgViewPrivate {
        GtkWidget   *headers_box;
        GtkWidget   *html_scroll;
        GtkWidget   *attachments_box;
+       GtkWidget   *view_images_button;
 
        /* internal adjustments for set_scroll_adjustments */
        GtkAdjustment *hadj;
@@ -217,6 +244,9 @@ struct _ModestGtkhtmlMsgViewPrivate {
        GdkWindow *headers_window;
        GdkWindow *html_window;
 
+       /* id handler for dragged scroll */
+       guint idle_motion_id;
+
        /* zoom */
        gdouble current_zoom;
 
@@ -1023,6 +1053,8 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
        priv->headers_window = NULL;
        priv->html_window = NULL;
 
+       priv->idle_motion_id = 0;
+
        gtk_widget_push_composite_child ();
        priv->html_scroll = gtk_scrolled_window_new (NULL, NULL);
        gtk_widget_set_composite_name (priv->html_scroll, "contents");
@@ -1032,9 +1064,18 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
        priv->msg                     = NULL;
 
        priv->body_view                 = GTK_WIDGET (g_object_new (MODEST_TYPE_GTKHTML_MIME_PART_VIEW, NULL));
-       priv->mail_header_view        = GTK_WIDGET(modest_mail_header_view_new (TRUE));
+#ifdef MODEST_TOOLKIT_HILDON2
+       priv->mail_header_view        = GTK_WIDGET(modest_compact_mail_header_view_new ());
+#else
+       priv->mail_header_view        = GTK_WIDGET(modest_expander_mail_header_view_new (TRUE));
+#endif
+       priv->view_images_button = gtk_button_new_with_label (_("mail_bd_external_images"));
+#ifdef MODEST_TOOLKIT_HILDON2
+       hildon_gtk_widget_set_theme_size (priv->view_images_button, 
+                                         HILDON_SIZE_HALFSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+#endif
        gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
-
+       gtk_widget_set_no_show_all (priv->view_images_button, TRUE);
        priv->attachments_view        = GTK_WIDGET(modest_attachments_view_new (NULL));
 
        g_signal_connect (G_OBJECT(priv->body_view), "activate_link",
@@ -1043,25 +1084,51 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
                                       G_CALLBACK(on_fetch_url), obj);
        g_signal_connect (G_OBJECT(priv->body_view), "link_hover",
                                       G_CALLBACK(on_link_hover), obj);
+#ifdef MAEMO_CHANGES
+       g_signal_connect (G_OBJECT(priv->body_view), "motion-notify-event",
+                         G_CALLBACK (motion_notify_event), obj);
+#endif
+       g_signal_connect (G_OBJECT (priv->body_view), "button-press-event",
+                         G_CALLBACK (button_press_event), obj);
+       g_signal_connect (G_OBJECT (priv->body_view), "button-release-event",
+                         G_CALLBACK (button_release_event), obj);
 
        g_signal_connect (G_OBJECT (priv->mail_header_view), "recpt-activated", 
                          G_CALLBACK (on_recpt_activated), obj);
+       g_signal_connect (G_OBJECT (priv->mail_header_view), "show-details", 
+                         G_CALLBACK (on_show_details), obj);
 
        g_signal_connect (G_OBJECT (priv->attachments_view), "activate",
                          G_CALLBACK (on_attachment_activated), obj);
 
+       g_signal_connect (G_OBJECT (priv->view_images_button), "clicked",
+                         G_CALLBACK (on_view_images_clicked), obj);
+
        html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(priv->html_scroll));
 
        g_signal_connect (G_OBJECT (html_vadj), "changed",
                          G_CALLBACK (html_adjustment_changed), obj);
 
        gtk_widget_push_composite_child ();
-       priv->headers_box = gtk_vbox_new (0, FALSE);
+       priv->headers_box = gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT);
        gtk_widget_set_composite_name (priv->headers_box, "headers");
        gtk_widget_pop_composite_child ();
 
        if (priv->mail_header_view)
                gtk_box_pack_start (GTK_BOX(priv->headers_box), priv->mail_header_view, FALSE, FALSE, 0);
+       if (priv->view_images_button) {
+               GtkWidget *hbuttonbox;
+               
+               hbuttonbox = gtk_hbutton_box_new ();
+               gtk_container_add (GTK_CONTAINER (hbuttonbox), priv->view_images_button);
+#ifdef MODEST_TOOLKIT_HILDON2
+               gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_START);
+               gtk_box_pack_start (GTK_BOX (priv->headers_box), hbuttonbox, TRUE, TRUE, 0);
+#else
+               gtk_box_pack_start (GTK_BOX (priv->headers_box), hbuttonbox, FALSE, FALSE, 0);
+#endif
+               gtk_widget_hide (priv->view_images_button);
+       }
        
        if (priv->attachments_view) {
                gchar *att_label = g_strconcat (_("mcen_me_viewer_attachments"), ":", NULL);
@@ -1086,6 +1153,7 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
 #ifdef MAEMO_CHANGES
                gtk_widget_tap_and_hold_setup (GTK_WIDGET (priv->body_view), NULL, NULL, 0);
                g_signal_connect (G_OBJECT (priv->body_view), "tap-and-hold", G_CALLBACK (on_tap_and_hold), obj);
+               g_signal_connect (G_OBJECT (priv->body_view), "tap-and-hold-query", G_CALLBACK (on_tap_and_hold_query), obj);
 #endif
        }
        
@@ -1102,6 +1170,11 @@ modest_gtkhtml_msg_view_finalize (GObject *obj)
                g_object_unref (G_OBJECT(priv->msg));
                priv->msg = NULL;
        }
+
+       if (priv->idle_motion_id > 0) {
+               g_source_remove (priv->idle_motion_id);
+               priv->idle_motion_id = 0;
+       }
        
        /* we cannot disconnect sigs, because priv->body_view is
         * already dead */
@@ -1126,6 +1199,87 @@ modest_gtkhtml_msg_view_destroy (GtkObject *obj)
 
 /* INTERNAL METHODS */
 
+#ifdef MAEMO_CHANGES
+static gboolean 
+motion_notify_event (GtkWidget *widget,
+                    GdkEventMotion *event,
+                    gpointer userdata)
+{
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (userdata);
+
+       /* Use panning information in gtkhtml widget to support also vertical panning */
+
+       if (GTK_HTML (widget)->panning) {
+               gint y, dy;
+               gdouble value;
+
+               gdk_window_get_pointer (GTK_LAYOUT (widget)->bin_window, NULL, &y, NULL);
+               dy = y - GTK_HTML (widget)->lasty;
+               value = priv->vadj->value - (gdouble) dy;
+
+               if (value < priv->vadj->lower)
+                       value = priv->vadj->lower;
+               else if (value > priv->vadj->upper - priv->vadj->page_size)
+                       value = priv->vadj->upper - priv->vadj->page_size;
+               gtk_adjustment_set_value (priv->vadj, value);
+               
+       } 
+       return FALSE;
+}
+#endif
+
+static gboolean
+idle_motion (gpointer userdata)
+{
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (userdata);
+       if (GTK_HTML (priv->body_view)->in_selection_drag) {
+               gdouble offset;
+               GtkAdjustment *adj;
+               gint gdk_y;
+               gdk_window_get_pointer (gtk_widget_get_parent_window (priv->body_view), NULL, &gdk_y, NULL);
+               offset= (gdouble) (priv->headers_box->requisition.height + gdk_y);
+               adj = GTK_ADJUSTMENT (priv->vadj);
+               if (offset < adj->value + adj->step_increment) {
+                       gtk_adjustment_set_value (adj, MAX (offset + adj->page_increment - adj->page_size, 0.0));
+               } else if (offset > adj->value + adj->page_increment) {
+                       gtk_adjustment_set_value (adj, MIN (offset - adj->page_increment, adj->upper - adj->page_size));
+               }
+               gtk_widget_queue_resize (userdata);
+       }
+       return TRUE;
+}
+
+static gboolean 
+button_press_event (GtkWidget *widget,
+                   GdkEventButton *event,
+                   gpointer userdata)
+{
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (userdata);
+
+       if (priv->idle_motion_id == 0) {
+               priv->idle_motion_id = g_timeout_add (200, idle_motion, userdata);
+       }
+       return FALSE;
+}
+
+static gboolean 
+button_release_event (GtkWidget *widget,
+                     GdkEventButton *event,
+                     gpointer userdata)
+{
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (userdata);
+
+       if (priv->idle_motion_id > 0) {
+               gint gdk_y;
+               g_source_remove (priv->idle_motion_id);
+               
+               priv->idle_motion_id = 0;;
+               gdk_window_get_pointer (gtk_widget_get_parent_window (priv->body_view), NULL, &gdk_y, NULL);
+               event->y = (gdouble) gdk_y;
+       }
+       return FALSE;
+}
+
 static GtkAdjustment *
 get_vadjustment (ModestGtkhtmlMsgView *self)
 {
@@ -1261,6 +1415,18 @@ on_tap_and_hold (GtkWidget *widget,
 
        g_signal_emit_by_name (G_OBJECT (self), "link-contextual", priv->last_url);
 }
+
+static gboolean
+on_tap_and_hold_query (GtkWidget *widget,
+                      GdkEvent *event,
+                      gpointer data)
+{
+       ModestGtkhtmlMsgView *self = (ModestGtkhtmlMsgView *) data;
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
+
+       /* Don't show the tap and hold animation if no url below */
+       return (priv->last_url == NULL);
+}
 #endif
 
 static void
@@ -1272,12 +1438,35 @@ on_recpt_activated (ModestMailHeaderView *header_view,
 }
 
 static void
+on_show_details (ModestMailHeaderView *header_view, 
+                ModestGtkhtmlMsgView *self)
+{
+       g_signal_emit_by_name (G_OBJECT (self), "show-details");
+}
+
+static void
 on_attachment_activated (ModestAttachmentsView * att_view, TnyMimePart *mime_part, gpointer self)
 {
 
        g_signal_emit_by_name (G_OBJECT(self), "attachment_clicked", mime_part);
 }
 
+static void
+on_view_images_clicked (GtkButton * button, gpointer self)
+{
+       ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
+       TnyMimePart *part;
+
+       modest_mime_part_view_set_view_images (MODEST_MIME_PART_VIEW (priv->body_view), TRUE);
+       gtk_widget_hide (priv->view_images_button);
+       part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (priv->body_view));
+       tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (priv->body_view), part);
+       tny_msg_set_allow_external_images (TNY_MSG (priv->msg), TRUE);
+       g_object_unref (part);
+       
+
+}
+
 static gboolean
 on_activate_link (GtkWidget *widget, const gchar *uri, ModestGtkhtmlMsgView *self)
 {
@@ -1386,8 +1575,12 @@ on_fetch_url (GtkWidget *widget, const gchar *uri,
        const gchar* my_uri;
        TnyMimePart *part = NULL;
        
+
+
        priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
-       
+
+       if (modest_mime_part_view_has_external_images (MODEST_MIME_PART_VIEW (priv->body_view)))
+               gtk_widget_show (priv->view_images_button);
        /*
         * we search for either something starting with cid:, or something
         * with no prefix at all; this latter case occurs when sending mails
@@ -1400,12 +1593,25 @@ on_fetch_url (GtkWidget *widget, const gchar *uri,
        
        /* now try to find the embedded image */
        part = find_cid_image (priv->msg, my_uri);
+
        if (!part) {
-               g_printerr ("modest: %s: '%s' not found\n", __FUNCTION__, my_uri);
-               return FALSE;   
+               if (g_str_has_prefix (uri, "http:")) {
+                       if (modest_mime_part_view_get_view_images (MODEST_MIME_PART_VIEW (priv->body_view))) {
+                               gboolean result = FALSE;
+                               g_signal_emit_by_name (self, "fetch-image", uri, stream, &result);
+                               return result;
+                       } else {
+                               /* we return immediately to get a "image not found" icon */
+                               tny_stream_close (stream);
+                               return TRUE;
+                       }
+               } else {
+                       return FALSE;
+               }
        }
 
-       tny_mime_part_decode_to_stream ((TnyMimePart*)part, stream);
+       tny_mime_part_decode_to_stream ((TnyMimePart*)part, stream, NULL);
+       tny_stream_close (stream);
        g_object_unref (G_OBJECT(part));
        return TRUE;
 }
@@ -1422,6 +1628,7 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg)
        
        priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE(self);
        gtk_widget_set_no_show_all (priv->mail_header_view, FALSE);
+       modest_mime_part_view_set_view_images (MODEST_MIME_PART_VIEW (priv->body_view), FALSE);
 
        html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
        html_vadj->upper = 0;
@@ -1455,10 +1662,13 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg)
 
        modest_attachments_view_set_message (MODEST_ATTACHMENTS_VIEW(priv->attachments_view),
                                             msg);
+
+       modest_mime_part_view_set_view_images (MODEST_MIME_PART_VIEW (priv->body_view), tny_msg_get_allow_external_images (msg));
        
        body = modest_tny_msg_find_body_part (msg, TRUE);
        if (body) {
                tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (priv->body_view), body);
+               g_object_unref (body);
 
                if(modest_attachments_view_has_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view))) {
                        gtk_widget_show_all (priv->attachments_box);
@@ -1469,6 +1679,13 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg)
        } else 
                tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
 
+       if (modest_mime_part_view_has_external_images (MODEST_MIME_PART_VIEW (priv->body_view)) &&
+           !modest_mime_part_view_get_view_images (MODEST_MIME_PART_VIEW (priv->body_view))) {
+               gtk_widget_show (priv->view_images_button);
+       } else {
+               gtk_widget_hide (priv->view_images_button);
+       }
+
        gtk_widget_show (priv->body_view);
        gtk_widget_set_no_show_all (priv->attachments_box, TRUE);
        gtk_widget_show_all (priv->mail_header_view);
@@ -1633,7 +1850,7 @@ search_next (ModestGtkhtmlMsgView *self)
        return result;
 }
 
-static GList *
+static TnyList *
 get_selected_attachments (ModestGtkhtmlMsgView *self)
 {
        ModestGtkhtmlMsgViewPrivate *priv;
@@ -1645,7 +1862,7 @@ get_selected_attachments (ModestGtkhtmlMsgView *self)
        
 }
 
-static GList *
+static TnyList *
 get_attachments (ModestGtkhtmlMsgView *self)
 {
        ModestGtkhtmlMsgViewPrivate *priv;
@@ -1689,12 +1906,12 @@ tny_msg_view_init (gpointer g, gpointer iface_data)
 {
        TnyMsgViewIface *klass = (TnyMsgViewIface *)g;
 
-       klass->get_msg_func = modest_msg_view_get_msg;
-       klass->set_msg_func = modest_msg_view_set_msg;
-       klass->set_unavailable_func = modest_msg_view_set_unavailable;
-       klass->clear_func = modest_msg_view_clear;
-       klass->create_mime_part_view_for_func = modest_msg_view_create_mime_part_view_for;
-       klass->create_new_inline_viewer_func = modest_msg_view_create_new_inline_viewer;
+       klass->get_msg = modest_msg_view_get_msg;
+       klass->set_msg = modest_msg_view_set_msg;
+       klass->set_unavailable = modest_msg_view_set_unavailable;
+       klass->clear = modest_msg_view_clear;
+       klass->create_mime_part_view_for = modest_msg_view_create_mime_part_view_for;
+       klass->create_new_inline_viewer = modest_msg_view_create_new_inline_viewer;
 
        return;
 }
@@ -1786,9 +2003,9 @@ tny_mime_part_view_init (gpointer g, gpointer iface_data)
 {
        TnyMimePartViewIface *klass = (TnyMimePartViewIface *)g;
 
-       klass->get_part_func = modest_msg_view_mp_get_part;
-       klass->set_part_func = modest_msg_view_mp_set_part;
-       klass->clear_func = modest_msg_view_mp_clear;
+       klass->get_part = modest_msg_view_mp_get_part;
+       klass->set_part = modest_msg_view_mp_set_part;
+       klass->clear = modest_msg_view_mp_clear;
 
        return;
 }
@@ -2070,25 +2287,25 @@ modest_gtkhtml_msg_view_get_priority_default (ModestMsgView *self)
        return get_priority (MODEST_GTKHTML_MSG_VIEW (self));
 }
 
-static GList*
+static TnyList*
 modest_gtkhtml_msg_view_get_selected_attachments (ModestMsgView *self)
 {
        return MODEST_GTKHTML_MSG_VIEW_GET_CLASS (self)->get_selected_attachments_func (self);
 }
 
-static GList*
+static TnyList*
 modest_gtkhtml_msg_view_get_selected_attachments_default (ModestMsgView *self)
 {
        return get_selected_attachments (MODEST_GTKHTML_MSG_VIEW (self));
 }
 
-static GList*
+static TnyList*
 modest_gtkhtml_msg_view_get_attachments (ModestMsgView *self)
 {
        return MODEST_GTKHTML_MSG_VIEW_GET_CLASS (self)->get_attachments_func (self);
 }
 
-static GList*
+static TnyList*
 modest_gtkhtml_msg_view_get_attachments_default (ModestMsgView *self)
 {
        return get_attachments (MODEST_GTKHTML_MSG_VIEW (self));
@@ -2117,4 +2334,3 @@ modest_gtkhtml_msg_view_remove_attachment_default (ModestMsgView *self, TnyMimeP
 {
        remove_attachment (MODEST_GTKHTML_MSG_VIEW (self), attachment);
 }
-