#include <widgets/modest-ui-constants.h>
#include <modest-icon-names.h>
#include <tny-camel-bs-mime-part.h>
+#include <modest-runtime.h>
/* FIXNE: we should have no maemo-deps in widgets/ */
#ifndef MODEST_TOOLKIT_GTK
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 {
#ifdef MODEST_TOOLKIT_HILDON2
GtkWidget *priority_box;
GtkWidget *priority_icon;
+ GtkWidget *calendar_box;
+ GtkWidget *calendar_icon;
#endif
/* internal adjustments for set_scroll_adjustments */
gtk_widget_hide_all (priv->priority_box);
}
+ priv->calendar_icon = gtk_image_new ();
+ 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),
+ _("TODO: invitation"),
+ priv->calendar_icon,
+ FALSE, FALSE);
+
+ gtk_widget_hide_all (priv->calendar_box);
+ }
#endif
if (priv->attachments_view) {
#ifndef MODEST_TOOLKIT_HILDON2
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)
- break;
- if (part_cid && part_cid[0] == '<') {
- const gchar *end;
- end = g_strrstr_len (part_cid, -1, ">");
-
- if (end && strncmp (part_cid + 1, cid, end - part_cid - 1) == 0)
- break;
- }
+ if (part_cids_equal (cid, part_cid))
+ break;
if (tny_mime_part_content_type_is (part, "multipart/related")) {
TnyList *related_parts = TNY_LIST (tny_simple_list_new ());
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 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))) {
+ 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;
}
gtk_widget_hide_all (priv->attachments_box);
#ifdef MODEST_TOOKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
+ gtk_widget_hide_all (priv->calendar_box);
#endif
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
/* 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);
+ gtk_widget_set_no_show_all (priv->calendar_box, TRUE);
#endif
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);
+ gtk_widget_set_no_show_all (priv->calendar_box, FALSE);
#endif
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
gtk_widget_hide_all (priv->attachments_box);
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
+ gtk_widget_hide_all (priv->calendar_box);
#endif
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (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;
+
+ g_return_if_fail (MODEST_IS_GTKHTML_MSG_VIEW (self));
+ priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
+
+
+
+}