if (msg_is_visible (header, is_outbox)) {
next = gtk_tree_model_get_path (model, &tmp_iter);
*row_reference = gtk_tree_row_reference_new (model, next);
+ gtk_tree_path_free (next);
retval = TRUE;
finished = TRUE;
}
message */
finished = TRUE;
}
+ gtk_tree_path_free (next);
} else {
/* If there are no more messages and we don't
want to start again in the first one then
/* Free */
gtk_tree_path_free (path);
- if (next)
- gtk_tree_path_free (next);
return retval;
}
hildon_find_toolbar_highlight_entry (HILDON_FIND_TOOLBAR (priv->find_toolbar), TRUE);
} else {
gtk_widget_hide (priv->find_toolbar);
+ modest_msg_view_grab_focus (MODEST_MSG_VIEW (priv->msg_view));
}
/* update the toggle buttons status */
tmp = priv->progress_widgets;
source = modest_mail_operation_get_source(mail_op);
if (G_OBJECT (self) == source) {
- if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE || op_type == MODEST_MAIL_OPERATION_TYPE_OPEN ) {
+ if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE ) {
set_toolbar_transfer_mode(self);
while (tmp) {
modest_progress_object_add_operation (
op_type = modest_mail_operation_get_type_operation (mail_op);
tmp = priv->progress_widgets;
- if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE || op_type == MODEST_MAIL_OPERATION_TYPE_OPEN ) {
+ if (op_type == MODEST_MAIL_OPERATION_TYPE_RECEIVE ) {
while (tmp) {
modest_progress_object_remove_operation (MODEST_PROGRESS_OBJECT (tmp->data),
mail_op);
}
typedef struct {
-
+ gchar *filepath;
+ GtkWidget *banner;
+ guint banner_idle_id;
} DecodeAsyncHelper;
+static gboolean
+decode_async_banner_idle (gpointer user_data)
+{
+ DecodeAsyncHelper *helper = (DecodeAsyncHelper *) user_data;
+
+ helper->banner_idle_id = 0;
+ helper->banner = hildon_banner_show_animation (NULL, NULL, _("mail_me_opening"));
+ g_object_ref (helper->banner);
+
+ return FALSE;
+}
+
static void
on_decode_to_stream_async_handler (TnyMimePart *mime_part,
gboolean cancelled,
GError *err,
gpointer user_data)
{
- gchar *filepath = (gchar *) user_data;
+ DecodeAsyncHelper *helper = (DecodeAsyncHelper *) user_data;
+ if (helper->banner_idle_id > 0) {
+ g_source_remove (helper->banner_idle_id);
+ helper->banner_idle_id = 0;
+ }
+ if (helper->banner) {
+ gtk_widget_destroy (helper->banner);
+ }
if (cancelled || err) {
modest_platform_information_banner (NULL, NULL,
_("mail_ib_file_operation_failed"));
}
/* make the file read-only */
- g_chmod(filepath, 0444);
+ g_chmod(helper->filepath, 0444);
/* Activate the file */
- modest_platform_activate_file (filepath, tny_mime_part_get_content_type (mime_part));
+ modest_platform_activate_file (helper->filepath, modest_tny_mime_part_get_content_type (mime_part));
free:
/* Frees */
- g_free (filepath);
+ g_free (helper->filepath);
+ g_object_unref (helper->banner);
+ g_slice_free (DecodeAsyncHelper, helper);
}
void
gchar *attachment_uid = NULL;
gint attachment_index = 0;
TnyList *attachments;
+ TnyMimePart *window_msg;
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
g_return_if_fail (TNY_IS_MIME_PART (mime_part) || (mime_part == NULL));
return;
}
- if (!modest_tny_mime_part_is_msg (mime_part)) {
+ /* we also check for mime_part == priv->msg, as this means it's a direct attachment
+ * shown as attachment, so it should behave as a file */
+ window_msg = TNY_MIME_PART (tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view)));
+ if (!modest_tny_mime_part_is_msg (mime_part)||
+ mime_part == window_msg) {
gchar *filepath = NULL;
const gchar *att_filename = tny_mime_part_get_filename (mime_part);
gboolean show_error_banner = FALSE;
&filepath);
if (temp_stream != NULL) {
+ DecodeAsyncHelper *helper = g_slice_new (DecodeAsyncHelper);
+ helper->filepath = g_strdup (filepath);
+ helper->banner = NULL;
+ helper->banner_idle_id = g_timeout_add (1000, decode_async_banner_idle, helper);
tny_mime_part_decode_to_stream_async (mime_part, TNY_STREAM (temp_stream),
on_decode_to_stream_async_handler,
NULL,
- g_strdup (filepath));
+ helper);
g_object_unref (temp_stream);
/* NOTE: files in the temporary area will be automatically
* cleaned after some time if they are no longer in use */
const gchar *content_type;
/* the file may already exist but it isn't writable,
* let's try to open it anyway */
- content_type = tny_mime_part_get_content_type (mime_part);
+ content_type = modest_tny_mime_part_get_content_type (mime_part);
modest_platform_activate_file (filepath, content_type);
} else {
g_warning ("%s: modest_utils_create_temp_stream failed", __FUNCTION__);
msg_win = modest_msg_view_window_new_for_attachment (TNY_MSG (mime_part), account, attachment_uid);
modest_window_set_zoom (MODEST_WINDOW (msg_win),
modest_window_get_zoom (MODEST_WINDOW (window)));
- modest_window_mgr_register_window (mgr, msg_win);
+ modest_window_mgr_register_window (mgr, msg_win, MODEST_WINDOW (window));
gtk_widget_show_all (GTK_WIDGET (msg_win));
}
}
+ g_object_unref (window_msg);
g_object_unref (mime_part);
}
info->result = gnome_vfs_create (&handle, pair->filename, GNOME_VFS_OPEN_WRITE, FALSE, 0644);
if (info->result == GNOME_VFS_OK) {
+ GError *error = NULL;
stream = tny_vfs_stream_new (handle);
- if (tny_mime_part_decode_to_stream (pair->part, stream, NULL) < 0) {
+ if (tny_mime_part_decode_to_stream (pair->part, stream, &error) < 0) {
+ g_warning ("modest: could not save attachment %s: %d (%s)\n", pair->filename, error?error->code:-1, error?error->message:"Unknown error");
+
info->result = GNOME_VFS_ERROR_IO;
}
g_object_unref (G_OBJECT (stream));
g_slice_free (SaveMimePartPair, pair);
info->pairs = g_list_delete_link (info->pairs, info->pairs);
} else {
+ g_warning ("modest: could not create save attachment %s: %s\n", pair->filename, gnome_vfs_result_to_string (info->result));
save_mime_part_info_free (info, FALSE);
}
gchar *folder = NULL;
gchar *filename = NULL;
gchar *save_multiple_str = NULL;
+ TnyMsg *window_msg;
g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
g_object_ref (mime_parts);
}
+ window_msg = tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view));
/* prepare dialog */
if (tny_list_get_length (mime_parts) == 1) {
TnyIterator *iter;
save_multiple_str = g_strdup_printf (_FM("sfil_va_number_of_objects_attachments"),
tny_list_get_length (mime_parts));
}
+ g_object_unref (window_msg);
save_dialog = hildon_file_chooser_dialog_new (GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_SAVE);
return TRUE;;
}
+
+void
+modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self)
+{
+ modest_ui_actions_on_add_to_contacts (NULL, MODEST_WINDOW (self));
+}
+
+