#include <modest-tny-msg.h>
#include <modest-text-utils.h>
#include <widgets/modest-msg-view.h>
-#ifdef MODEST_TOOLKIT_HILDON2
#include <widgets/modest-compact-mail-header-view.h>
+#ifdef MODEST_TOOLKIT_HILDON2
#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-isearch-view.h>
#include <widgets/modest-ui-constants.h>
#include <modest-icon-names.h>
-
-/* FIXNE: we should have no maemo-deps in widgets/ */
-#ifndef MODEST_TOOLKIT_GTK
-#include "maemo/modest-hildon-includes.h"
-#endif /*!MODEST_TOOLKIT_GTK*/
-
+#include <tny-camel-bs-mime-part.h>
+#include <modest-runtime.h>
/* 'private'/'protected' functions */
static void modest_gtkhtml_msg_view_class_init (ModestGtkhtmlMsgViewClass *klass);
static void request_fetch_images (ModestGtkhtmlMsgView *view);
static void set_branding (ModestGtkhtmlMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon);
static gboolean has_blocked_external_images (ModestGtkhtmlMsgView *view);
+static void set_calendar (ModestGtkhtmlMsgView *self, TnyHeader *header, TnyMsg *msg);
/* list properties */
enum {
GtkWidget *priority_box;
GtkWidget *priority_icon;
#endif
+ GtkWidget *calendar_box;
+ GtkWidget *calendar_icon;
+ GtkWidget *calendar_actions_box;
+ GtkWidget *calendar_actions_container;
/* internal adjustments for set_scroll_adjustments */
GtkAdjustment *hadj;
/* id handler for dragged scroll */
guint idle_motion_id;
+ /* idle changes count */
+ gint idle_changes_count;
+ guint idle_readjust_scroll_id;
+ guint idle_resize_children_id;
+
/* zoom */
gdouble current_zoom;
/* link click management */
gchar *last_url;
+
+ gboolean has_blocked_bs_images;
};
#define MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
{
GtkAllocation view_allocation;
GtkAdjustment *hadj = get_hadjustment (self);
+ gint full_width = 0;
+ ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
get_view_allocation (self, &view_allocation);
hadj->page_size = view_allocation.width;
hadj->lower = 0;
hadj->upper = view_allocation.width;
+ /* Get the real width of the embedded html */
+ if (priv->html_scroll && GTK_WIDGET_VISIBLE(priv->html_scroll)) {
+ GtkAdjustment *html_hadj;
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ full_width += html_hadj->upper;
+ }
+
+ hadj->upper = MAX (view_allocation.width, full_width);
+
reclamp_adjustment (hadj, value_changed);
}
-static void
+static void
set_vadjustment_values (ModestGtkhtmlMsgView *self,
gboolean *value_changed)
{
allocation->height != widget->allocation.height))
gdk_window_invalidate_rect (widget->window, NULL, FALSE);
+ if (priv->idle_readjust_scroll_id == 0 && priv->idle_changes_count < 5 && widget->allocation.width != allocation->width) {
+ g_object_ref (self);
+ priv->idle_readjust_scroll_id = g_idle_add ((GSourceFunc) idle_readjust_scroll, self);
+ priv->idle_changes_count ++;
+ }
+
widget->allocation = *allocation;
set_hadjustment_values (self, &hadj_value_changed);
set_vadjustment_values (self, &vadj_value_changed);
html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
html_allocation.x = 0;
- html_allocation.y = headers_allocation.height;
+ html_allocation.y = MAX (0, headers_allocation.height - priv->vadj->value);
html_allocation.width = view_allocation.width;
- html_allocation.height = MAX ((gint) html_vadj->upper, (gint)(priv->vadj->upper - headers_allocation.height));
+ if (html_vadj->upper < allocation->height) {
+ html_allocation.height = MAX (html_vadj->upper, allocation->height - headers_allocation.height);
+ } else {
+ html_allocation.height = allocation->height;
+ }
+ /* html_allocation.height = MAX ((gint) html_vadj->upper, (gint)(priv->vadj->upper - headers_allocation.height)); */
if (GTK_WIDGET_REALIZED (widget)) {
gdk_window_move_resize (widget->window,
headers_allocation.height);
gdk_window_move_resize (priv->html_window,
(gint) (- priv->hadj->value),
- (gint) (html_allocation.y - priv->vadj->value),
+ (gint) html_allocation.y,
(gint) priv->hadj->upper,
html_allocation.height);
}
html_allocation.x = 0;
html_allocation.y = 0;
html_allocation.width = (gint) priv->hadj->upper;
- html_allocation.height = (gint) priv->vadj->upper - headers_allocation.height;
gtk_widget_size_allocate (priv->html_scroll, &html_allocation);
+ if (html_vadj->page_size != html_allocation.height) {
+ html_vadj->page_size = html_allocation.height;
+ gtk_adjustment_changed (html_vadj);
+ }
}
gtk_adjustment_changed (priv->hadj);
gtk_adjustment_changed (priv->vadj);
if (priv->html_scroll && GTK_WIDGET_VISIBLE (priv->html_scroll)) {
gint old_x, old_y;
gint new_x, new_y;
+ gint new_internal_vvalue;
gdk_window_get_position (priv->html_window, &old_x, &old_y);
new_x = -hadj->value;
- new_y = headers_offset - vadj->value;
+
+ new_internal_vvalue = MAX (0, vadj->value - headers_offset);
+ gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll)),
+ new_internal_vvalue);
+
+ new_y = MAX (0, headers_offset - vadj->value);
if (new_x != old_x || new_y != old_y) {
gdk_window_move (priv->html_window, new_x, new_y);
}
}
+static gboolean
+resize_children_idle (GtkContainer *cont)
+{
+ ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (cont);
+ if (GTK_WIDGET_DRAWABLE (cont)) {
+ gtk_container_resize_children (cont);
+ }
+ priv->idle_resize_children_id = 0;
+
+ return FALSE;
+}
+
static void
html_adjustment_changed (GtkAdjustment *adj,
gpointer userdata)
g_signal_stop_emission_by_name (G_OBJECT (adj), "changed");
priv->html_scroll->requisition.height = html_vadj->upper;
- if (html_vadj->upper == priv->html_scroll->allocation.height)
+ if ((priv->vadj != NULL && (html_vadj->upper == (priv->vadj->upper - GTK_WIDGET (priv->headers_box)->allocation.height)))
+ && html_vadj->page_size == priv->html_scroll->allocation.height)
return;
- priv->html_scroll->allocation.height = html_vadj->upper;
set_vadjustment_values (self, &vadj_changed);
- new_height = MAX ((gint) html_vadj->upper, (gint) (priv->vadj->upper - priv->headers_box->allocation.height));
+ if (html_vadj->upper < GTK_WIDGET (self)->allocation.height) {
+ new_height = MAX (html_vadj->upper,
+ GTK_WIDGET (self)->allocation.height - GTK_WIDGET(priv->headers_box)->allocation.height);
+ } else {
+ new_height = GTK_WIDGET (self)->allocation.height;
+ }
gtk_adjustment_changed (priv->vadj);
if (GTK_WIDGET_DRAWABLE (priv->html_scroll)) {
gdk_window_resize (priv->html_window, (gint) priv->hadj->upper, (gint) new_height);
gdk_window_process_updates (priv->view_window, TRUE);
- gtk_container_resize_children (GTK_CONTAINER (self));
+ if (priv->idle_resize_children_id == 0)
+ priv->idle_resize_children_id = gdk_threads_add_idle ((GSourceFunc) resize_children_idle, self);
}
}
gboolean
idle_readjust_scroll (ModestGtkhtmlMsgView *self)
{
+ ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
/* We're out the main lock */
gdk_threads_enter ();
if (GTK_WIDGET_DRAWABLE (self)) {
- ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
GtkAdjustment *html_vadj;
+ GtkAdjustment *html_hadj;
+
html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
- html_vadj->page_size = html_vadj->upper;
- gtk_adjustment_changed (html_vadj);
- gtk_widget_queue_resize (GTK_WIDGET (self));
- gtk_widget_queue_draw (GTK_WIDGET (self));
+ html_vadj->upper = 0;
+ html_vadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
+
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_hadj->upper = 0;
+ html_hadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_hadj), "changed");
+
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), 1, 1);
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), -1, -1);
+
+ gtk_widget_queue_resize (GTK_WIDGET (priv->body_view));
+ gtk_widget_queue_draw (GTK_WIDGET (priv->body_view));
/* Just another hack for making readjust really work. This forces an update
* of the scroll, and then, make the scroll really update properly the
* the size and not corrupt scrollable area */
gtk_adjustment_set_value (priv->vadj, 1.0);
gtk_adjustment_set_value (priv->vadj, 0.0);
+
}
+ priv->idle_readjust_scroll_id = 0;
g_object_unref (G_OBJECT (self));
+
gdk_threads_leave ();
return FALSE;
{
ModestGtkhtmlMsgViewPrivate *priv;
GtkAdjustment *html_vadj;
+#ifndef MODEST_TOOLKIT_HILDON2
GtkWidget *separator;
+#endif
GTK_WIDGET_UNSET_FLAGS (obj, GTK_NO_WINDOW);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (obj), TRUE);
priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE(obj);
+ priv->has_blocked_bs_images = FALSE;
+
+ priv->idle_changes_count = 0;
+ priv->idle_readjust_scroll_id = 0;
+ priv->idle_resize_children_id = 0;
priv->current_zoom = 1.0;
priv->hadj = NULL;
priv->msg = NULL;
priv->body_view = GTK_WIDGET (g_object_new (MODEST_TYPE_GTKHTML_MIME_PART_VIEW, NULL));
-#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->mail_header_view = GTK_WIDGET (modest_compact_mail_header_view_new ());
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
priv->attachments_view = GTK_WIDGET(modest_attachments_view_new (NULL));
#ifdef MODEST_TOOLKIT_HILDON2
G_CALLBACK (html_adjustment_changed), obj);
gtk_widget_push_composite_child ();
- priv->headers_box = gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT);
+ priv->headers_box = gtk_vbox_new (FALSE, 0);
gtk_widget_set_composite_name (priv->headers_box, "headers");
gtk_widget_pop_composite_child ();
gtk_widget_hide_all (priv->priority_box);
}
#endif
+ priv->calendar_actions_box = NULL;
+ priv->calendar_icon = gtk_image_new ();
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->calendar_icon), MODEST_HEADER_ICON_CALENDAR, GTK_ICON_SIZE_MENU);
+ gtk_misc_set_alignment (GTK_MISC (priv->calendar_icon), 0.0, 0.5);
+ if (priv->calendar_icon) {
+ priv->calendar_box = (GtkWidget *)
+ modest_mail_header_view_add_custom_header (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view),
+ _("mail_fi_invitation"),
+ priv->calendar_icon,
+ FALSE, FALSE);
+
+ gtk_widget_hide_all (priv->calendar_box);
+ }
+
if (priv->attachments_view) {
#ifndef MODEST_TOOLKIT_HILDON2
gchar *att_label = g_strconcat (_("mcen_me_viewer_attachments"), ":", NULL);
g_free (att_label);
}
+ priv->calendar_actions_container = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->headers_box), priv->calendar_actions_container, FALSE, FALSE, 0);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, TRUE);
+
+#ifndef MODEST_TOOLKIT_HILDON2
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX(priv->headers_box), separator, FALSE, FALSE, 0);
+#endif
gtk_widget_set_parent (priv->headers_box, GTK_WIDGET (obj));
priv->msg = NULL;
}
+ if (priv->idle_resize_children_id > 0) {
+ g_source_remove (priv->idle_resize_children_id);
+ priv->idle_resize_children_id = 0;
+ }
+
+ if (priv->idle_readjust_scroll_id > 0) {
+ g_source_remove (priv->idle_readjust_scroll_id);
+ priv->idle_readjust_scroll_id = 0;
+ }
+
if (priv->idle_motion_id > 0) {
g_source_remove (priv->idle_motion_id);
priv->idle_motion_id = 0;
if (!hadj)
hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0,0.0,0.0,0.0,0.0,0.0));
disconnect_hadjustment (self);
- g_object_ref (G_OBJECT (hadj));
- gtk_object_sink (GTK_OBJECT (hadj));
+ g_object_ref_sink (G_OBJECT (hadj));
priv->hadj = hadj;
set_hadjustment_values (self, &value_changed);
if (!vadj)
vadj = (GtkAdjustment *) gtk_adjustment_new (0.0,0.0,0.0,0.0,0.0,0.0);
disconnect_vadjustment (self);
- g_object_ref (G_OBJECT (vadj));
- gtk_object_sink (GTK_OBJECT (vadj));
+ g_object_ref_sink (G_OBJECT (vadj));
priv->vadj = vadj;
set_vadjustment_values (self, &value_changed);
/* The message could have not been downloaded yet */
if (priv->msg) {
modest_mime_part_view_set_view_images (MODEST_MIME_PART_VIEW (priv->body_view), TRUE);
+ priv->has_blocked_bs_images = FALSE;
part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (priv->body_view));
if (part) {
tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (priv->body_view), part);
{
ModestGtkhtmlMsgViewPrivate *priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
- return (modest_mime_part_view_has_external_images (MODEST_MIME_PART_VIEW (priv->body_view)) &&
+ return ((modest_mime_part_view_has_external_images (MODEST_MIME_PART_VIEW (priv->body_view)) ||
+ (priv->has_blocked_bs_images)) &&
!modest_mime_part_view_get_view_images (MODEST_MIME_PART_VIEW (priv->body_view)));
}
g_signal_emit_by_name (G_OBJECT (msg_view), "limit-error");
}
+static gboolean
+part_cids_equal (const gchar *part_cid1,
+ const gchar *part_cid2)
+{
+ if (g_strcmp0 (part_cid1, part_cid2) == 0)
+ return TRUE;
+
+ if (part_cid2 && part_cid2[0] == '<') {
+ const gchar *end;
+ end = g_strrstr_len (part_cid2, -1, ">");
+
+ if (end && strncmp (part_cid2 + 1, part_cid1, end - part_cid2 - 1) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
static TnyMimePart *
find_cid_image (TnyMsg *msg, const gchar *cid)
*/
if (!part_cid)
part_cid = tny_mime_part_get_content_location (part);
-
- if (part_cid && strcmp (cid, part_cid) == 0)
+
+ if (part_cids_equal (cid, part_cid))
break;
if (tny_mime_part_content_type_is (part, "multipart/related")) {
while (!tny_iterator_is_done (related_iter)) {
related_part = TNY_MIME_PART (tny_iterator_get_current (related_iter));
part_cid = tny_mime_part_get_content_id (related_part);
- if (part_cid && strcmp (cid, part_cid) == 0) {
+
+ if (part_cids_equal (cid, part_cid))
break;
- }
+
g_object_unref (related_part);
related_part = NULL;
tny_iterator_next (related_iter);
return part;
}
+static void
+fetch_url_decode_to_stream_cb (TnyMimePart *self, gboolean cancelled, TnyStream *stream, GError *err, gpointer user_data)
+{
+ tny_stream_close (stream);
+}
static gboolean
on_fetch_url (GtkWidget *widget, const gchar *uri,
} else {
return FALSE;
}
+ } else if (TNY_IS_CAMEL_BS_MIME_PART (part) &&
+ !tny_camel_bs_mime_part_is_fetched (TNY_CAMEL_BS_MIME_PART (part))){
+ if (!modest_mime_part_view_get_view_images (MODEST_MIME_PART_VIEW (priv->body_view)) ||
+ !tny_device_is_online (modest_runtime_get_device ())) {
+ priv->has_blocked_bs_images = TRUE;
+ tny_stream_close (stream);
+ return TRUE;
+ }
}
- tny_mime_part_decode_to_stream ((TnyMimePart*)part, stream, NULL);
- tny_stream_close (stream);
+ tny_mime_part_decode_to_stream_async ((TnyMimePart*)part, stream, fetch_url_decode_to_stream_cb, NULL, NULL);
g_object_unref (G_OBJECT(part));
return TRUE;
}
TnyMimePart *body;
ModestGtkhtmlMsgViewPrivate *priv;
TnyHeader *header;
- GtkAdjustment *html_vadj;
+ GtkAdjustment *html_vadj, *html_hadj;
g_return_if_fail (self);
priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE(self);
+ priv->has_blocked_bs_images = FALSE;
modest_mail_header_view_set_loading (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view), FALSE);
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;
- html_vadj->page_size = 0;
- g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
-
-
if (msg != priv->msg) {
if (priv->msg)
g_object_unref (G_OBJECT(priv->msg));
#ifdef MODEST_TOOKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
#endif
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
+
+ html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_vadj->upper = 0;
+ html_vadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
+
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_hadj->upper = 0;
+ html_hadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_hadj), "changed");
+
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), 1, 1);
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), -1, -1);
+
+ priv->idle_changes_count = 0;
+ gtk_widget_queue_resize (GTK_WIDGET (priv->body_view));
+
gtk_widget_queue_resize (GTK_WIDGET(self));
gtk_widget_queue_draw (GTK_WIDGET(self));
return;
/* Refresh priority */
set_priority (self, tny_header_get_flags (header));
+ set_calendar (self, header, msg);
gtk_widget_show (priv->body_view);
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_set_no_show_all (priv->priority_box, TRUE);
#endif
+ gtk_widget_set_no_show_all (priv->calendar_box, TRUE);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, TRUE);
gtk_widget_set_no_show_all (priv->attachments_box, TRUE);
gtk_widget_show_all (priv->mail_header_view);
gtk_widget_set_no_show_all (priv->attachments_box, FALSE);
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_set_no_show_all (priv->priority_box, FALSE);
#endif
+ gtk_widget_set_no_show_all (priv->calendar_box, FALSE);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, FALSE);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
+
+ html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_vadj->upper = 0;
+ html_vadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
+
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_hadj->upper = 0;
+ html_hadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_hadj), "changed");
+
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), 1, 1);
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), -1, -1);
+
+ priv->idle_changes_count = 0;
+ gtk_widget_queue_resize (GTK_WIDGET (priv->body_view));
+
gtk_widget_queue_resize (GTK_WIDGET(self));
gtk_widget_queue_draw (GTK_WIDGET(self));
/* This is a hack to force reallocation of scroll after drawing all the stuff. This
* makes the html view get the proper and expected size and prevent being able to scroll
* the buffer when it shouldn't be scrollable */
- g_object_ref (self);
- g_timeout_add (250, (GSourceFunc) idle_readjust_scroll, self);
+ if (priv->idle_readjust_scroll_id == 0) {
+ g_object_ref (self);
+ priv->idle_readjust_scroll_id = g_idle_add ((GSourceFunc) idle_readjust_scroll, self);
+ }
}
static void
set_header (ModestGtkhtmlMsgView *self, TnyHeader *header)
{
ModestGtkhtmlMsgViewPrivate *priv;
- GtkAdjustment *html_vadj;
+ GtkAdjustment *html_vadj, *html_hadj;
g_return_if_fail (self);
}
priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE(self);
+ priv->has_blocked_bs_images = FALSE;
modest_mail_header_view_set_loading (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view), TRUE);
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->page_size = 0;
g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_hadj->upper = 0;
+ html_hadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_hadj), "changed");
+
+ priv->idle_changes_count = 0;
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), 1, 1);
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), -1, -1);
+ gtk_widget_queue_resize (GTK_WIDGET (priv->body_view));
if (priv->msg) {
g_object_unref (G_OBJECT(priv->msg));
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
#endif
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
+ priv->idle_changes_count = 0;
gtk_widget_queue_resize (GTK_WIDGET(self));
gtk_widget_queue_draw (GTK_WIDGET(self));
}
set_zoom (ModestGtkhtmlMsgView *self, gdouble zoom)
{
ModestGtkhtmlMsgViewPrivate *priv;
+ GtkAdjustment *html_vadj, *html_hadj;
g_return_if_fail (MODEST_IS_GTKHTML_MSG_VIEW (self));
priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
modest_zoomable_set_zoom (MODEST_ZOOMABLE(priv->body_view), zoom);
+ html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_vadj->upper = 0;
+ html_vadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_vadj), "changed");
+
+ html_hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
+ html_hadj->upper = 0;
+ html_hadj->page_size = 0;
+ g_signal_emit_by_name (G_OBJECT (html_hadj), "changed");
+
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), 1, 1);
+ gtk_widget_set_size_request (GTK_WIDGET (priv->body_view), -1, -1);
+
+ priv->idle_changes_count = 0;
gtk_widget_queue_resize (priv->body_view);
}
{
return has_blocked_external_images (MODEST_GTKHTML_MSG_VIEW (self));
}
+
+static void
+set_calendar (ModestGtkhtmlMsgView *self, TnyHeader *header, TnyMsg *msg)
+{
+ ModestGtkhtmlMsgViewPrivate *priv;
+ TnyMimePart *calendar_part;
+
+ g_return_if_fail (MODEST_IS_GTKHTML_MSG_VIEW (self));
+ priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
+
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ if (priv->calendar_actions_box) {
+ gtk_widget_destroy (priv->calendar_actions_box);
+ priv->calendar_actions_box = NULL;
+ }
+
+ calendar_part = modest_tny_msg_find_calendar (TNY_MSG (msg));
+
+ if (calendar_part) {
+ gboolean retval = FALSE;
+ priv->calendar_actions_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->calendar_actions_container), priv->calendar_actions_box, FALSE, FALSE, 0);
+ g_signal_emit_by_name (G_OBJECT (self), "handle-calendar", calendar_part, priv->calendar_actions_box, &retval);
+ if (retval) {
+ gtk_widget_show (priv->calendar_actions_container);
+ gtk_widget_show_all (priv->calendar_actions_container);
+ gtk_widget_show (priv->calendar_actions_box);
+ gtk_widget_show_all (priv->calendar_actions_box);
+ } else {
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ gtk_widget_hide (priv->calendar_actions_box);
+ gtk_widget_hide_all (priv->calendar_actions_box);
+ }
+ gtk_widget_show_all (priv->calendar_box);
+ g_object_unref (calendar_part);
+ } else {
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ if (priv->calendar_actions_box)
+ gtk_widget_hide (priv->calendar_actions_box);
+ }
+}