#include <hildon/hildon.h>
#endif
#include <tny-camel-bs-mime-part.h>
+#include <tny-camel-bs-msg.h>
#define MYDOCS_ENV "MYDOCSDIR"
#define DOCS_FOLDER ".documents"
gulong row_deleted_handler;
gulong row_inserted_handler;
gulong rows_reordered_handler;
+ gulong fetch_image_redraw_handler;
guint purge_timeout;
GtkWidget *remove_attachment_banner;
priv->row_deleted_handler = 0;
priv->row_inserted_handler = 0;
priv->rows_reordered_handler = 0;
+ priv->fetch_image_redraw_handler = 0;
priv->progress_hint = FALSE;
priv->fetching_images = 0;
call this function before */
modest_msg_view_window_disconnect_signals (MODEST_WINDOW (obj));
+ if (priv->fetch_image_redraw_handler > 0) {
+ g_source_remove (priv->fetch_image_redraw_handler);
+ priv->fetch_image_redraw_handler = 0;
+ }
+
if (priv->other_body != NULL) {
g_object_unref (priv->other_body);
priv->other_body = NULL;
{
GtkWidget *focus;
- focus = gtk_window_get_focus (GTK_WINDOW (window));
+ focus = gtk_container_get_focus_child ((GtkContainer *) window);
/* for the isearch toolbar case */
if (focus && GTK_IS_ENTRY (focus)) {
static void
message_reader_performer (gboolean canceled,
GError *err,
- GtkWindow *parent_window,
+ ModestWindow *parent_window,
TnyAccount *account,
gpointer user_data)
{
we're not online */
if (!tny_device_is_online (modest_runtime_get_device())) {
GtkResponseType response;
+ GtkWindow *toplevel;
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
- _("mcen_nc_get_msg"));
+ toplevel = (GtkWindow *) gtk_widget_get_toplevel ((GtkWidget *) window);
+ response = modest_platform_run_confirmation_dialog (toplevel, _("mcen_nc_get_msg"));
if (response == GTK_RESPONSE_CANCEL) {
update_window_title (window);
return FALSE;
}
/* Offer the connection dialog if necessary */
- modest_platform_connect_if_remote_and_perform ((GtkWindow *) window,
+ modest_platform_connect_if_remote_and_perform ((ModestWindow *) window,
TRUE,
TNY_FOLDER_STORE (folder),
message_reader_performer,
else
info->row_reference = NULL;
- message_reader_performer (FALSE, NULL, (GtkWindow *) window, account, info);
+ message_reader_performer (FALSE, NULL, (ModestWindow *) window, account, info);
if (account)
g_object_unref (account);
if (folder)
return;
}
+ if (msg && TNY_IS_CAMEL_BS_MSG (msg)) {
+ TnyMimePart *body;
+ body = modest_tny_msg_find_body_part (msg, TRUE);
+
+ if (body && !tny_camel_bs_mime_part_is_fetched (TNY_CAMEL_BS_MIME_PART (body))) {
+ /* We have body structure but not the body mime part. What we do
+ * is restarting load of message */
+ self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
+ priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
+
+ tny_header_unset_flag (TNY_HEADER (header), TNY_HEADER_FLAG_CACHED);
+
+ modest_msg_view_window_reload (self);
+
+ if (row_reference)
+ gtk_tree_row_reference_free (row_reference);
+ g_object_unref (body);
+ return;
+ }
+
+ if (body)
+ g_object_unref (body);
+ }
+
/* Get the window */
self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self));
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
msg = tny_camel_msg_new ();
- tny_camel_msg_parse (msg, file_stream);
+ tny_camel_msg_parse ((TnyCamelMsg *) msg, file_stream);
msg_win = modest_msg_view_window_new_for_attachment (TNY_MSG (msg), account, mailbox, helper->attachment_uid);
modest_window_set_zoom (MODEST_WINDOW (msg_win),
modest_window_get_zoom (MODEST_WINDOW (helper->self)));
priv->msg_uid);
if (!tny_device_is_online (modest_runtime_get_device())) {
- modest_platform_connect_and_perform (GTK_WINDOW (window),
+ modest_platform_connect_and_perform ((ModestWindow *) window,
TRUE,
TNY_ACCOUNT (account),
(ModestConnectedPerformer) view_attachment_connect_handler,
SaveMimePartInfo *info)
{
if (canceled || err) {
+ if (canceled && !err) {
+ info->result = GNOME_VFS_ERROR_CANCELLED;
+ }
g_idle_add ((GSourceFunc) idle_save_mime_part_show_result, info);
} else {
g_thread_create ((GThreadFunc)save_mime_part_to_file, info, FALSE, NULL);
account = tny_account_store_find_account (TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()),
priv->msg_uid);
- modest_platform_connect_and_perform (GTK_WINDOW (info->window),
+ modest_platform_connect_and_perform ((ModestWindow *) info->window,
TRUE,
TNY_ACCOUNT (account),
(ModestConnectedPerformer) save_mime_part_to_file_connect_handler,
/* In Hildon 2.2 save and delete operate over all the attachments as there's no
* selection available */
mime_parts = modest_msg_view_get_attachments (MODEST_MSG_VIEW (priv->msg_view));
- if (mime_parts && !modest_toolkit_utils_select_attachments (GTK_WINDOW (gtk_widget_get_toplevel (window)), mime_parts, FALSE)) {
+ if (mime_parts && !modest_toolkit_utils_select_attachments (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (window))), mime_parts, FALSE)) {
g_object_unref (mime_parts);
return;
}
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
+#ifdef MODEST_TOOLKIT_HILDON2
/* In hildon 2.2 we ignore the get_all flag as we always get all attachments. This is
* because we don't have selection
*/
g_object_unref (mime_parts);
return;
}
+#else
+ /* In gtk we get only selected attachments for the operation.
+ */
+ mime_parts = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view));
+
+ /* Remove already purged messages from mime parts list. We use
+ a copy of the list to remove items in the original one */
+ tmp = tny_list_copy (mime_parts);
+ iter = tny_list_create_iterator (tmp);
+ while (!tny_iterator_is_done (iter)) {
+ TnyMimePart *part = TNY_MIME_PART (tny_iterator_get_current (iter));
+ if (tny_mime_part_is_purged (part))
+ tny_list_remove (mime_parts, (GObject *) part);
+
+ g_object_unref (part);
+ tny_iterator_next (iter);
+ }
+ g_object_unref (tmp);
+ g_object_unref (iter);
+
+ if (tny_list_get_length (mime_parts) == 0) {
+ g_object_unref (mime_parts);
+ return;
+ }
+#endif
n_attachments = tny_list_get_length (mime_parts);
if (n_attachments == 1) {
"mcen_nc_purge_files_text",
n_attachments), n_attachments);
}
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (window))),
confirmation_message);
g_free (confirmation_message);
} FetchImageData;
gboolean
+on_fetch_image_timeout_refresh_view (gpointer userdata)
+{
+ ModestMsgViewWindowPrivate *priv;
+
+ priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (userdata);
+ update_progress_hint (MODEST_MSG_VIEW_WINDOW (userdata));
+ if (GTK_WIDGET_DRAWABLE (priv->msg_view)) {
+ gtk_widget_queue_draw (GTK_WIDGET (priv->msg_view));
+ }
+ priv->fetch_image_redraw_handler = 0;
+ g_object_unref (userdata);
+ return FALSE;
+}
+
+gboolean
on_fetch_image_idle_refresh_view (gpointer userdata)
{
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (fidata->window);
priv->fetching_images--;
- gtk_widget_queue_draw (fidata->msg_view);
- update_progress_hint (MODEST_MSG_VIEW_WINDOW (fidata->window));
+ if (priv->fetch_image_redraw_handler == 0) {
+ priv->fetch_image_redraw_handler = g_timeout_add (500, on_fetch_image_timeout_refresh_view, g_object_ref (fidata->window));
+ }
+
}
gdk_threads_leave ();