From 91526797480db76525e1295ec4a65f29f4bdc9cf Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Tue, 8 Jan 2008 18:54:31 +0000 Subject: [PATCH] Fixed some reference leaks of attachments. I also moved from using GList* of TnyMimeParts to use TnyLists to maintain a more intuitive list of references. * src/widget/modest-gtkhtml-msg-view.[ch]: * Use TnyList of attachments * src/widgets/modest-msg-edit-window.h: * Use TnyList instead of GList for attachments. * src/widgets/modest-msg-view.[ch]: * Use TnyList instead of GList for attachments. * src/widgets/modest-attachment-view.c: * Now the ModestAttachmentView always keep a reference to the mime part with g_object_ref. * src/widgets/modest-msg-view-window.h: * Use TnyList instead of GList for attachments. * src/widgets/modest-attachments-view.[ch]: * Missing unreferencing on iteration. * Use TnyList instead of GList for attachmetns. * src/modest-tny-msg.c: * Use TnyList and unrefernce an attachment list properly. * src/modest-ui-actions.c: * Mail operations for saving to drafts or sending mails from edit window shouldn't keep a reference to the edit window. * Fixed minor bug assigning a g_strdup. * Some frees in error cases in modest_ui_actions_on_send. * src/maemo/modest-msg-edit-window.c: * Fixed some leaked references. * Use TnyList instead of GList for lists of attachments. * src/maemo/modest-msg-view-window.c: * Use TnyList instead of GList for lists of attachments. * Fixed some counting leaks. * src/modest-utils.[ch]: * New method modest_list_index (), that finds the ordinal index of an item in a list. * src/modest-ui-dimming-rules.c: * Use TnyList instead of GList for lists of attachments. pmo-trunk-r3996 --- src/maemo/modest-msg-edit-window.c | 135 +++++++++++++++++++-------------- src/maemo/modest-msg-view-window.c | 124 +++++++++++++++++------------- src/modest-tny-msg.c | 4 +- src/modest-ui-actions.c | 10 ++- src/modest-ui-dimming-rules.c | 45 +++++++---- src/modest-utils.c | 24 ++++++ src/modest-utils.h | 11 +++ src/widgets/modest-attachment-view.c | 2 +- src/widgets/modest-attachments-view.c | 24 ++++-- src/widgets/modest-attachments-view.h | 4 +- src/widgets/modest-gtkhtml-msg-view.c | 24 +++--- src/widgets/modest-gtkhtml-msg-view.h | 4 +- src/widgets/modest-msg-edit-window.h | 2 +- src/widgets/modest-msg-view-window.h | 6 +- src/widgets/modest-msg-view.c | 4 +- src/widgets/modest-msg-view.h | 8 +- 16 files changed, 266 insertions(+), 165 deletions(-) diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 9b15bec..7af8f5d 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -255,8 +255,8 @@ struct _ModestMsgEditWindowPrivate { gint last_vadj_upper; gint last_cid; - GList *attachments; - GList *images; + TnyList *attachments; + TnyList *images; TnyHeaderFlags priority_flags; @@ -387,8 +387,8 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) priv->cc_field = NULL; priv->bcc_field = NULL; priv->subject_field = NULL; - priv->attachments = NULL; - priv->images = NULL; + priv->attachments = TNY_LIST (tny_simple_list_new ()); + priv->images = TNY_LIST (tny_simple_list_new ()); priv->last_cid = 0; priv->cc_caption = NULL; @@ -798,10 +798,8 @@ modest_msg_edit_window_finalize (GObject *obj) g_free (priv->last_search); g_slist_free (priv->font_items_group); g_slist_free (priv->size_items_group); - g_list_foreach (priv->attachments, (GFunc) g_object_unref, NULL); - g_list_free (priv->attachments); - g_list_foreach (priv->images, (GFunc) g_object_unref, NULL); - g_list_free (priv->images); + g_object_unref (priv->attachments); + g_object_unref (priv->images); /* This had to stay alive for as long as the combobox that used it: */ modest_pair_list_free (priv->from_field_protos); @@ -848,15 +846,17 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type) } static void -replace_with_images (ModestMsgEditWindow *self, GList *attachments) +replace_with_images (ModestMsgEditWindow *self, TnyList *attachments) { ModestMsgEditWindowPrivate *priv; - GList *node; + TnyIterator *iter; priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self); - for (node = attachments; node != NULL; node = g_list_next (node)) { - TnyMimePart *part = (TnyMimePart *) node->data; + for (iter = tny_list_create_iterator (attachments); + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *cid = tny_mime_part_get_content_id (part); const gchar *mime_type = tny_mime_part_get_content_type (part); if ((cid != NULL)&&(mime_type != NULL)) { @@ -869,6 +869,7 @@ replace_with_images (ModestMsgEditWindow *self, GList *attachments) g_object_unref (pixbuf); } } + g_object_unref (part); } } @@ -916,10 +917,9 @@ get_related_images (ModestMsgEditWindow *self, TnyMsg *msg) part = TNY_MIME_PART (tny_iterator_get_current (iter)); content_type = tny_mime_part_get_content_type (part); if (content_type && g_str_has_prefix (content_type, "image/")) { - priv->images = g_list_prepend (priv->images, part); - } else { - g_object_unref (part); - } + tny_list_prepend (priv->images, (GObject *) part); + } + g_object_unref (part); tny_iterator_next (iter); } g_object_unref (iter); @@ -929,13 +929,15 @@ get_related_images (ModestMsgEditWindow *self, TnyMsg *msg) } static void -update_last_cid (ModestMsgEditWindow *self, GList *attachments) +update_last_cid (ModestMsgEditWindow *self, TnyList *attachments) { - GList *node; + TnyIterator *iter; ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self); - for (node = attachments; node != NULL; node = g_list_next (node)) { - TnyMimePart *part = (TnyMimePart *) node->data; + for (iter = tny_list_create_iterator (attachments) ; + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *cid = tny_mime_part_get_content_id (part); if (cid != NULL) { char *invalid = NULL; @@ -944,7 +946,7 @@ update_last_cid (ModestMsgEditWindow *self, GList *attachments) priv->last_cid = int_cid; } } - + g_object_unref (part); } } @@ -1015,7 +1017,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich) /* Add attachments to the view */ modest_attachments_view_set_message (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), msg); priv->attachments = modest_attachments_view_get_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view)); - if (priv->attachments == NULL) { + if (tny_list_get_length (priv->attachments) == 0) { gtk_widget_hide (priv->attachments_caption); } else { gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); @@ -1396,6 +1398,7 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) MsgData *data; const gchar *account_name; ModestMsgEditWindowPrivate *priv; + TnyIterator *att_iter; g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window), NULL); @@ -1433,30 +1436,35 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) data->html_body = NULL; /* deep-copy the data */ - GList *cursor = priv->attachments; + att_iter = tny_list_create_iterator (priv->attachments); data->attachments = NULL; - while (cursor) { - if (!(TNY_IS_MIME_PART(cursor->data))) { + while (!tny_iterator_is_done (att_iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (att_iter); + if (!(TNY_IS_MIME_PART(part))) { g_warning ("strange data in attachment list"); - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); continue; } data->attachments = g_list_append (data->attachments, - g_object_ref (cursor->data)); - cursor = g_list_next (cursor); + part); + tny_iterator_next (att_iter); } + g_object_unref (att_iter); GtkTextTagTable *tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (priv->text_buffer)); - cursor = priv->images; + att_iter = tny_list_create_iterator (priv->images); data->images = NULL; - while (cursor) { + while (!tny_iterator_is_done (att_iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (att_iter); const gchar *cid; - if (!(TNY_IS_MIME_PART(cursor->data))) { + if (!(TNY_IS_MIME_PART(part))) { g_warning ("strange data in attachment list"); - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); continue; } - cid = tny_mime_part_get_content_id (cursor->data); + cid = tny_mime_part_get_content_id (part); if (cid) { gchar *image_tag_id; GtkTextTag *image_tag; @@ -1470,9 +1478,10 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) ((gtk_text_iter_has_tag (&iter, image_tag))|| (gtk_text_iter_forward_to_tag_toggle (&iter, image_tag)))) data->images = g_list_append (data->images, - g_object_ref (cursor->data)); + g_object_ref (part)); } - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); } data->priority_flags = priv->priority_flags; @@ -1974,9 +1983,10 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window) wp_text_buffer_insert_image (WP_TEXT_BUFFER (priv->text_buffer), &position, g_strdup (tny_mime_part_get_content_id (mime_part)), pixbuf); } - priv->images = g_list_prepend (priv->images, mime_part); + tny_list_prepend (priv->images, (GObject *) mime_part); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); g_free (filename); + g_object_unref (mime_part); } } @@ -2056,6 +2066,8 @@ modest_msg_edit_window_attach_file_one ( stream = TNY_STREAM (tny_vfs_stream_new (handle)); tny_mime_part_construct_from_stream (mime_part, stream, mime_type); + + g_object_unref (stream); content_id = g_strdup_printf ("%d", priv->last_cid); tny_mime_part_set_content_id (mime_part, content_id); @@ -2066,43 +2078,48 @@ modest_msg_edit_window_attach_file_one ( tny_mime_part_set_filename (mime_part, basename); g_free (basename); - priv->attachments = g_list_prepend (priv->attachments, g_object_ref(mime_part)); + tny_list_prepend (priv->attachments, (GObject *) mime_part); modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), mime_part); gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); gtk_widget_show_all (priv->attachments_caption); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); g_free (filename); + g_object_unref (mime_part); } } void modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window, - GList *att_list) + TnyList *att_list) { ModestMsgEditWindowPrivate *priv; - gboolean clean_list = FALSE; + TnyIterator *iter; g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); if (att_list == NULL) { att_list = modest_attachments_view_get_selection (MODEST_ATTACHMENTS_VIEW (priv->attachments_view)); - clean_list = TRUE; + } else { + g_object_ref (att_list); } - if (att_list == NULL) { + if (tny_list_get_length (att_list) == 0) { hildon_banner_show_information (NULL, NULL, _("TODO: no attachments selected to remove")); } else { GtkWidget *confirmation_dialog = NULL; gboolean dialog_response; - GList *node; gchar *message = NULL; gchar *filename = NULL; - if (att_list->next == NULL) { - if (TNY_IS_MSG (att_list->data)) { - TnyHeader *header = tny_msg_get_header (TNY_MSG (att_list->data)); + if (tny_list_get_length (att_list) == 1) { + TnyMimePart *part; + iter = tny_list_create_iterator (att_list); + part = (TnyMimePart *) tny_iterator_get_current (iter); + g_object_unref (iter); + if (TNY_IS_MSG (part)) { + TnyHeader *header = tny_msg_get_header (TNY_MSG (part)); if (header) { filename = g_strdup (tny_header_get_subject (header)); g_object_unref (header); @@ -2111,45 +2128,46 @@ modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window, filename = g_strdup (_("mail_va_no_subject")); } } else { - filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (att_list->data))); + filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (part))); } + g_object_unref (part); } else { filename = g_strdup (""); } message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments", - att_list->next == NULL), filename); + (tny_list_get_length (att_list) == 1)), filename); g_free (filename); confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message); g_free (message); dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK); gtk_widget_destroy (confirmation_dialog); if (!dialog_response) { - if (clean_list) - g_list_free (att_list); + g_object_unref (att_list); return; } hildon_banner_show_information (NULL, NULL, _("mcen_ib_removing_attachment")); - - for (node = att_list; node != NULL; node = g_list_next (node)) { - TnyMimePart *mime_part = (TnyMimePart *) node->data; + + for (iter = tny_list_create_iterator (att_list); + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *att_id; - priv->attachments = g_list_remove (priv->attachments, mime_part); + tny_list_remove (priv->attachments, (GObject *) mime_part); modest_attachments_view_remove_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), mime_part); - if (priv->attachments == NULL) + if (tny_list_get_length (priv->attachments) == 0) gtk_widget_hide (priv->attachments_caption); att_id = tny_mime_part_get_content_id (mime_part); if (att_id != NULL) text_buffer_delete_images_by_id (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body)), att_id); - g_object_unref (mime_part); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); + g_object_unref (mime_part); } } - if (clean_list) - g_list_free (att_list); + g_object_unref (att_list); /* if the last attachment has been removed, focus the Subject: field */ if (!modest_attachments_view_has_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view))) @@ -3175,8 +3193,7 @@ modest_msg_edit_window_add_part (ModestMsgEditWindow *window, ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); g_return_if_fail (TNY_IS_MIME_PART (part)); - priv->attachments = g_list_prepend (priv->attachments, part); - g_object_ref (part); + tny_list_prepend (priv->attachments, (GObject *) part); modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), part); gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); gtk_widget_show_all (priv->attachments_caption); diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 8bc1349..fe118d9 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -2263,11 +2263,11 @@ on_queue_changed (ModestMailOperationQueue *queue, } } -GList * +TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win) { ModestMsgViewWindowPrivate *priv; - GList *selected_attachments = NULL; + TnyList *selected_attachments = NULL; g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win), NULL); priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (win); @@ -2284,7 +2284,7 @@ modest_msg_view_window_view_attachment (ModestMsgViewWindow *window, TnyMimePart const gchar *msg_uid; gchar *attachment_uid = NULL; gint attachment_index = 0; - GList *attachments; + TnyList *attachments; g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window)); g_return_if_fail (TNY_IS_MIME_PART (mime_part) || (mime_part == NULL)); @@ -2292,8 +2292,8 @@ modest_msg_view_window_view_attachment (ModestMsgViewWindow *window, TnyMimePart msg_uid = modest_msg_view_window_get_message_uid (MODEST_MSG_VIEW_WINDOW (window)); attachments = modest_msg_view_get_attachments (MODEST_MSG_VIEW (priv->msg_view)); - attachment_index = g_list_index (attachments, mime_part); - g_list_free (attachments); + attachment_index = modest_list_index (attachments, (GObject *) mime_part); + g_object_unref (attachments); if (msg_uid && attachment_index >= 0) { attachment_uid = g_strdup_printf ("%s/%d", msg_uid, attachment_index); @@ -2301,18 +2301,19 @@ modest_msg_view_window_view_attachment (ModestMsgViewWindow *window, TnyMimePart if (mime_part == NULL) { gboolean error = FALSE; - GList *selected_attachments = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view)); - if (selected_attachments == NULL) { + TnyList *selected_attachments = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view)); + if (selected_attachments == NULL || tny_list_get_length (selected_attachments) == 0) { error = TRUE; - } else if (g_list_length (selected_attachments) > 1) { + } else if (tny_list_get_length (selected_attachments) > 1) { hildon_banner_show_information (NULL, NULL, _("mcen_ib_unable_to_display_more")); error = TRUE; } else { - mime_part = (TnyMimePart *) selected_attachments->data; - g_object_ref (mime_part); + TnyIterator *iter; + iter = tny_list_create_iterator (selected_attachments); + mime_part = (TnyMimePart *) tny_iterator_get_current (iter); + g_object_unref (iter); } - g_list_foreach (selected_attachments, (GFunc) g_object_unref, NULL); - g_list_free (selected_attachments); + g_object_unref (selected_attachments); if (error) return; @@ -2535,9 +2536,8 @@ save_mime_parts_to_file_with_checks (SaveMimePartInfo *info) void -modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, GList *mime_parts) +modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts) { - gboolean clean_list = FALSE; ModestMsgViewWindowPrivate *priv; GList *files_to_save = NULL; GtkWidget *save_dialog = NULL; @@ -2551,24 +2551,29 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, GList *mim if (mime_parts == NULL) { mime_parts = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view)); - if (mime_parts == NULL) + if (mime_parts == NULL || tny_list_get_length (mime_parts) == 0) return; - clean_list = TRUE; + } else { + g_object_ref (mime_parts); } /* prepare dialog */ - if (mime_parts->next == NULL) { + if (tny_list_get_length (mime_parts) == 1) { + TnyIterator *iter; /* only one attachment selected */ - TnyMimePart *mime_part = (TnyMimePart *) mime_parts->data; + iter = tny_list_create_iterator (mime_parts); + TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); + g_object_unref (iter); if (!TNY_IS_MSG (mime_part) && tny_mime_part_is_attachment (mime_part)) { filename = tny_mime_part_get_filename (mime_part); } else { g_warning ("Tried to save a non-file attachment"); canceled = TRUE; } + g_object_unref (mime_part); } else { save_multiple_str = g_strdup_printf (_FM("sfil_va_number_of_objects_attachments"), - g_list_length (mime_parts)); + tny_list_get_length (mime_parts)); } save_dialog = hildon_file_chooser_dialog_new (GTK_WINDOW (window), @@ -2597,40 +2602,42 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, GList *mim hildon_banner_show_information (NULL, NULL, dgettext("hildon-fm", "sfil_ib_readonly_location")); } else { - GList *node = NULL; + TnyIterator *iter; - for (node = mime_parts; node != NULL; node = g_list_next (node)) { - TnyMimePart *mime_part = (TnyMimePart *) node->data; - + iter = tny_list_create_iterator (mime_parts); + while (!tny_iterator_is_done (iter)) { + TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); + + tny_iterator_next (iter); if (tny_mime_part_is_attachment (mime_part)) { SaveMimePartPair *pair; - if ((mime_parts->next != NULL) && - (tny_mime_part_get_filename (mime_part) == NULL)) + if ((!tny_iterator_is_done (iter)) && + (tny_mime_part_get_filename (mime_part) == NULL)) { + g_object_unref (mime_part); continue; + } pair = g_slice_new0 (SaveMimePartPair); - if (mime_parts->next == NULL) { + if (tny_iterator_is_done (iter)) { pair->filename = g_strdup (chooser_uri); } else { pair->filename = g_build_filename (chooser_uri, tny_mime_part_get_filename (mime_part), NULL); } - pair->part = g_object_ref (mime_part); + pair->part = mime_part; files_to_save = g_list_prepend (files_to_save, pair); } } + g_object_unref (iter); } g_free (chooser_uri); } gtk_widget_destroy (save_dialog); - if (clean_list) { - g_list_foreach (mime_parts, (GFunc) g_object_unref, NULL); - g_list_free (mime_parts); - } + g_object_unref (mime_parts); if (files_to_save != NULL) { SaveMimePartInfo *info = g_slice_new0 (SaveMimePartInfo); @@ -2666,11 +2673,12 @@ void modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean get_all) { ModestMsgViewWindowPrivate *priv; - GList *mime_parts = NULL, *node; + TnyList *mime_parts = NULL; gchar *confirmation_message; gint response; gint n_attachments; TnyMsg *msg; + TnyIterator *iter; /* TnyFolder *folder; */ g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window)); @@ -2682,37 +2690,42 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean mime_parts = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view)); /* Remove already purged messages from mime parts list */ - node = mime_parts; - while (node != NULL) { - TnyMimePart *part = TNY_MIME_PART (node->data); + iter = tny_list_create_iterator (mime_parts); + while (!tny_iterator_is_done (iter)) { + TnyMimePart *part = TNY_MIME_PART (tny_iterator_get_current (iter)); + tny_iterator_next (iter); if (tny_mime_part_is_purged (part)) { - GList *deleted_node = node; - node = g_list_next (node); - g_object_unref (part); - mime_parts = g_list_delete_link (mime_parts, deleted_node); - } else { - node = g_list_next (node); + tny_list_remove (mime_parts, (GObject *) part); } + g_object_unref (part); } + g_object_unref (iter); - if (mime_parts == NULL) + if (tny_list_get_length (mime_parts) == 0) { + g_object_unref (mime_parts); return; + } - n_attachments = g_list_length (mime_parts); + n_attachments = tny_list_get_length (mime_parts); if (n_attachments == 1) { const gchar *filename; + TnyMimePart *part; - if (TNY_IS_MSG (mime_parts->data)) { + iter = tny_list_create_iterator (mime_parts); + part = (TnyMimePart *) tny_iterator_get_current (iter); + g_object_unref (iter); + if (TNY_IS_MSG (part)) { TnyHeader *header; - header = tny_msg_get_header (TNY_MSG (mime_parts->data)); + header = tny_msg_get_header (TNY_MSG (part)); filename = tny_header_get_subject (header); g_object_unref (header); if (filename == NULL) filename = _("mail_va_no_subject"); } else { - filename = tny_mime_part_get_filename (TNY_MIME_PART (mime_parts->data)); + filename = tny_mime_part_get_filename (TNY_MIME_PART (part)); } confirmation_message = g_strdup_printf (_("mcen_nc_purge_file_text"), filename); + g_object_unref (part); } else { confirmation_message = g_strdup_printf (ngettext("mcen_nc_purge_file_text", "mcen_nc_purge_files_text", @@ -2722,8 +2735,10 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean confirmation_message); g_free (confirmation_message); - if (response != GTK_RESPONSE_OK) + if (response != GTK_RESPONSE_OK) { + g_object_unref (mime_parts); return; + } priv->purge_timeout = g_timeout_add (2000, show_remove_attachment_information, window); /* folder = tny_msg_get_folder (msg); */ @@ -2731,18 +2746,25 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean /* tny_folder_refresh (folder, NULL); */ /* g_object_unref (folder); */ - for (node = mime_parts; node != NULL; node = g_list_next (node)) { - tny_mime_part_set_purged (TNY_MIME_PART (node->data)); + iter = tny_list_create_iterator (mime_parts); + while (!tny_iterator_is_done (iter)) { + TnyMimePart *part; + + part = (TnyMimePart *) tny_iterator_get_current (iter); + tny_mime_part_set_purged (TNY_MIME_PART (part)); /* modest_msg_view_remove_attachment (MODEST_MSG_VIEW (priv->msg_view), node->data); */ + g_object_unref (part); + tny_iterator_next (iter); } + g_object_unref (iter); msg = tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view)); tny_msg_view_clear (TNY_MSG_VIEW (priv->msg_view)); tny_msg_rewrite_cache (msg); tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg); + g_object_unref (msg); - g_list_foreach (mime_parts, (GFunc) g_object_unref, NULL); - g_list_free (mime_parts); + g_object_unref (mime_parts); if (priv->purge_timeout > 0) { g_source_remove (priv->purge_timeout); diff --git a/src/modest-tny-msg.c b/src/modest-tny-msg.c index 437d79e..489697a 100644 --- a/src/modest-tny-msg.c +++ b/src/modest-tny-msg.c @@ -633,8 +633,10 @@ modest_tny_msg_create_forward_msg (TnyMsg *msg, add_attachments (TNY_MIME_PART (new_msg), attachments_list, FALSE); /* Clean */ - if (attachments_list) + if (attachments_list) { + g_list_foreach (attachments_list, (GFunc) g_object_unref, NULL); g_list_free (attachments_list); + } g_object_unref (G_OBJECT (parts)); return new_msg; diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 17633f1..1d0bc7a 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -2295,7 +2295,7 @@ modest_ui_actions_on_save_to_drafts (GtkWidget *widget, ModestMsgEditWindow *edi from = modest_account_mgr_get_from_string (account_mgr, account_name); /* Create the mail operation */ - mail_operation = modest_mail_operation_new (G_OBJECT(edit_window)); + mail_operation = modest_mail_operation_new (NULL); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation); modest_mail_operation_save_to_drafts (mail_operation, @@ -2383,7 +2383,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) ModestAccountMgr *account_mgr = modest_runtime_get_account_mgr(); gchar *account_name = g_strdup (data->account_name); if (!account_name) - g_strdup(modest_window_get_active_account (MODEST_WINDOW(edit_window))); + account_name = g_strdup(modest_window_get_active_account (MODEST_WINDOW(edit_window))); if (!account_name) account_name = modest_account_mgr_get_default_account (account_mgr); @@ -2391,8 +2391,9 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) if (!account_name) { modest_msg_edit_window_free_msg_data (edit_window, data); /* Run account setup wizard */ - if (!modest_ui_actions_run_account_setup_wizard (MODEST_WINDOW(edit_window))) + if (!modest_ui_actions_run_account_setup_wizard (MODEST_WINDOW(edit_window))) { return; + } } /* Get the currently-active transport account for this modest account: */ @@ -2403,6 +2404,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) } if (!transport_account) { + modest_msg_edit_window_free_msg_data (edit_window, data); /* Run account setup wizard */ if (!modest_ui_actions_run_account_setup_wizard(MODEST_WINDOW(edit_window))) return; @@ -2411,7 +2413,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name); /* Create the mail operation */ - ModestMailOperation *mail_operation = modest_mail_operation_new (G_OBJECT(edit_window)); + ModestMailOperation *mail_operation = modest_mail_operation_new (NULL); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_operation); modest_mail_operation_send_new_mail (mail_operation, diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index a4c6df1..1e0fc57 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -1533,7 +1533,7 @@ modest_ui_dimming_rules_on_editor_remove_attachment (ModestWindow *win, gpointer state = modest_window_get_dimming_state (win); if (!dimmed) { - GList *selected_attachments = NULL; + TnyList *selected_attachments = NULL; gint n_att_selected = 0; GtkWidget *attachments_view; attachments_view = modest_msg_edit_window_get_child_widget ( @@ -1542,8 +1542,8 @@ modest_ui_dimming_rules_on_editor_remove_attachment (ModestWindow *win, gpointer selected_attachments = modest_attachments_view_get_selection ( MODEST_ATTACHMENTS_VIEW (attachments_view)); - n_att_selected = g_list_length (selected_attachments); - g_list_free (selected_attachments); + n_att_selected = tny_list_get_length (selected_attachments); + g_object_unref (selected_attachments); dimmed = (n_att_selected != 1); } @@ -2356,7 +2356,7 @@ _invalid_attach_selected (ModestWindow *win, gboolean for_remove, ModestDimmingRule *rule) { - GList *attachments, *node; + TnyList *attachments; gint n_selected; TnyHeaderFlags flags; gboolean nested_attachments = FALSE; @@ -2376,7 +2376,7 @@ _invalid_attach_selected (ModestWindow *win, /* Get selected atachments */ attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win)); - n_selected = g_list_length (attachments); + n_selected = tny_list_get_length (attachments); /* Check unique */ if (!result) { @@ -2389,8 +2389,10 @@ _invalid_attach_selected (ModestWindow *win, /* Check attached type (view operation not required) */ if (!result && !for_view) { - for (node = attachments; node != NULL && !result; node = g_list_next (node)) { - TnyMimePart *mime_part = TNY_MIME_PART (node->data); + TnyIterator *iter; + iter = tny_list_create_iterator (attachments); + while (!tny_iterator_is_done (iter) && !result) { + TnyMimePart *mime_part = TNY_MIME_PART (tny_iterator_get_current (iter)); TnyList *nested_list = tny_simple_list_new (); if (!for_remove && TNY_IS_MSG (mime_part)) { selected_messages = TRUE; @@ -2402,7 +2404,10 @@ _invalid_attach_selected (ModestWindow *win, result = TRUE; } g_object_unref (nested_list); + g_object_unref (mime_part); + tny_iterator_next (iter); } + g_object_unref (iter); } /* Set notifications */ @@ -2419,7 +2424,7 @@ _invalid_attach_selected (ModestWindow *win, } /* Free */ - g_list_free (attachments); + g_object_unref (attachments); } return result; @@ -2428,7 +2433,8 @@ _invalid_attach_selected (ModestWindow *win, static gboolean _purged_attach_selected (ModestWindow *win, gboolean all, ModestDimmingRule *rule) { - GList *attachments = NULL, *node; + TnyList *attachments = NULL; + TnyIterator *iter; gint purged = 0; gint n_attachments = 0; gboolean result = FALSE; @@ -2448,16 +2454,25 @@ _purged_attach_selected (ModestWindow *win, gboolean all, ModestDimmingRule *rul if (attachments == NULL) return FALSE; - for (node = attachments; node != NULL; node = g_list_next (node)) { - TnyMimePart *mime_part = TNY_MIME_PART (node->data); + if (tny_list_get_length (attachments)) { + g_object_unref (attachments); + return FALSE; + } + + iter = tny_list_create_iterator (attachments); + while (!tny_iterator_is_done (iter)) { + TnyMimePart *mime_part = TNY_MIME_PART (tny_iterator_get_current (iter)); if (tny_mime_part_is_purged (mime_part)) { purged++; } n_attachments++; + g_object_unref (mime_part); + tny_iterator_next (iter); } + g_object_unref (iter); /* Free */ - g_list_free (attachments); + g_object_unref (attachments); if (all) result = (purged == n_attachments); @@ -2623,7 +2638,7 @@ _invalid_folder_for_purge (ModestWindow *win, /* If it's POP then dim */ if (modest_protocol_info_get_transport_store_protocol (proto_str) == MODEST_PROTOCOL_STORE_POP) { - GList *attachments = NULL; + TnyList *attachments = NULL; gint n_selected = 0; result = TRUE; @@ -2631,8 +2646,8 @@ _invalid_folder_for_purge (ModestWindow *win, * murrayc */ if (MODEST_IS_MSG_VIEW_WINDOW (win)) { attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win)); - n_selected = g_list_length (attachments); - g_list_free (attachments); + n_selected = tny_list_get_length (attachments); + g_object_unref (attachments); } modest_dimming_rule_set_notification (rule, diff --git a/src/modest-utils.c b/src/modest-utils.c index f0eb11e..a7f09ab 100644 --- a/src/modest-utils.c +++ b/src/modest-utils.c @@ -431,3 +431,27 @@ modest_utils_toggle_action_set_active_block_notify (GtkToggleAction *action, gbo } + +gint +modest_list_index (TnyList *list, GObject *object) +{ + TnyIterator *iter; + gint index = 0; + + iter = tny_list_create_iterator (list); + while (!tny_iterator_is_done (iter)) { + GObject *current = tny_iterator_get_current (iter); + + g_object_unref (current); + if (current == object) + break; + + tny_iterator_next (iter); + index++; + } + + if (tny_iterator_is_done (iter)) + index = -1; + g_object_unref (iter); + return index; +} diff --git a/src/modest-utils.h b/src/modest-utils.h index a055cc0..a47b0d0 100644 --- a/src/modest-utils.h +++ b/src/modest-utils.h @@ -124,4 +124,15 @@ void modest_utils_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *d */ void modest_utils_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value); +/** + * modest_list_index: + * @list: a #TnyList + * @object: a #GObject + * + * finds the index of @object in @list + * + * Returns: the index of @object, or -1 if @object is not in @list + */ +gint modest_list_index (TnyList *list, GObject *object); + #endif /*__MODEST_MAEMO_UTILS_H__*/ diff --git a/src/widgets/modest-attachment-view.c b/src/widgets/modest-attachment-view.c index 0d171bf..0a2e7da 100644 --- a/src/widgets/modest-attachment-view.c +++ b/src/widgets/modest-attachment-view.c @@ -203,7 +203,7 @@ modest_attachment_view_set_part_default (TnyMimePartView *self, TnyMimePart *mim g_object_unref (priv->mime_part); } - priv->mime_part = mime_part; + priv->mime_part = g_object_ref (mime_part); priv->size = 0; priv->is_purged = tny_mime_part_is_purged (mime_part); diff --git a/src/widgets/modest-attachments-view.c b/src/widgets/modest-attachments-view.c index 1fcf4c3..a56ceba 100644 --- a/src/widgets/modest-attachments-view.c +++ b/src/widgets/modest-attachments-view.c @@ -151,6 +151,9 @@ modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, Tn tny_iterator_next (iter); } + g_object_unref (iter); + g_object_unref (parts); + gtk_widget_queue_draw (GTK_WIDGET (attachments_view)); @@ -687,42 +690,47 @@ static void clipboard_clear (GtkClipboard *clipboard, gpointer userdata) unselect_all (atts_view); } -GList * +TnyList * modest_attachments_view_get_selection (ModestAttachmentsView *atts_view) { ModestAttachmentsViewPrivate *priv; - GList *selection, *node; + TnyList *selection; + GList *node; g_return_val_if_fail (MODEST_IS_ATTACHMENTS_VIEW (atts_view), NULL); priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (atts_view); - selection = NULL; + selection = tny_simple_list_new (); for (node = priv->selected; node != NULL; node = g_list_next (node)) { ModestAttachmentView *att_view = (ModestAttachmentView *) node->data; TnyMimePart *part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (att_view)); - selection = g_list_append (selection, part); + tny_list_append (selection, (GObject *) part); + g_object_unref (part); } return selection; } -GList * +TnyList * modest_attachments_view_get_attachments (ModestAttachmentsView *atts_view) { ModestAttachmentsViewPrivate *priv; - GList *children, *node, *att_list = NULL; + TnyList *att_list; + GList *children, *node= NULL; g_return_val_if_fail (MODEST_IS_ATTACHMENTS_VIEW (atts_view), NULL); priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (atts_view); + att_list = TNY_LIST (tny_simple_list_new ()); + children = gtk_container_get_children (GTK_CONTAINER (priv->box)); for (node = children; node != NULL; node = g_list_next (node)) { GtkWidget *att_view = GTK_WIDGET (node->data); TnyMimePart *mime_part = tny_mime_part_view_get_part (TNY_MIME_PART_VIEW (att_view)); - att_list = g_list_prepend (att_list, mime_part); + tny_list_append (att_list, (GObject *) mime_part); + g_object_unref (mime_part); } g_list_free (children); - att_list = g_list_reverse (att_list); return att_list; } diff --git a/src/widgets/modest-attachments-view.h b/src/widgets/modest-attachments-view.h index 42913a5..89837ad 100644 --- a/src/widgets/modest-attachments-view.h +++ b/src/widgets/modest-attachments-view.h @@ -70,8 +70,8 @@ void modest_attachments_view_set_message (ModestAttachmentsView *attachments_vie void modest_attachments_view_add_attachment (ModestAttachmentsView *attachments_view, TnyMimePart *part); void modest_attachments_view_remove_attachment (ModestAttachmentsView *attachments_view, TnyMimePart *part); void modest_attachments_view_remove_attachment_by_id (ModestAttachmentsView *attachments_view, const gchar *att_id); -GList *modest_attachments_view_get_attachments (ModestAttachmentsView *attachments_view); -GList *modest_attachments_view_get_selection (ModestAttachmentsView *attachments_view); +TnyList *modest_attachments_view_get_attachments (ModestAttachmentsView *attachments_view); +TnyList *modest_attachments_view_get_selection (ModestAttachmentsView *attachments_view); void modest_attachments_view_select_all (ModestAttachmentsView *attachments_view); gboolean modest_attachments_view_has_attachments (ModestAttachmentsView *attachments_view); diff --git a/src/widgets/modest-gtkhtml-msg-view.c b/src/widgets/modest-gtkhtml-msg-view.c index 98c8e4b..4e8ef57 100644 --- a/src/widgets/modest-gtkhtml-msg-view.c +++ b/src/widgets/modest-gtkhtml-msg-view.c @@ -148,8 +148,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 +160,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 +181,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); @@ -1633,7 +1633,7 @@ search_next (ModestGtkhtmlMsgView *self) return result; } -static GList * +static TnyList * get_selected_attachments (ModestGtkhtmlMsgView *self) { ModestGtkhtmlMsgViewPrivate *priv; @@ -1645,7 +1645,7 @@ get_selected_attachments (ModestGtkhtmlMsgView *self) } -static GList * +static TnyList * get_attachments (ModestGtkhtmlMsgView *self) { ModestGtkhtmlMsgViewPrivate *priv; @@ -2070,25 +2070,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)); diff --git a/src/widgets/modest-gtkhtml-msg-view.h b/src/widgets/modest-gtkhtml-msg-view.h index 30888b2..7dbd256 100644 --- a/src/widgets/modest-gtkhtml-msg-view.h +++ b/src/widgets/modest-gtkhtml-msg-view.h @@ -88,8 +88,8 @@ struct _ModestGtkhtmlMsgViewClass { GtkShadowType (*get_shadow_type_func) (ModestMsgView *self); TnyHeaderFlags (*get_priority_func) (ModestMsgView *self); void (*set_priority_func) (ModestMsgView *self, TnyHeaderFlags flags); - GList * (*get_selected_attachments_func) (ModestMsgView *self); - GList * (*get_attachments_func) (ModestMsgView *self); + TnyList * (*get_selected_attachments_func) (ModestMsgView *self); + TnyList * (*get_attachments_func) (ModestMsgView *self); void (*grab_focus_func) (ModestMsgView *self); void (*remove_attachment_func) (ModestMsgView *view, TnyMimePart *attachment); diff --git a/src/widgets/modest-msg-edit-window.h b/src/widgets/modest-msg-edit-window.h index bacb0b1..c4af36c 100644 --- a/src/widgets/modest-msg-edit-window.h +++ b/src/widgets/modest-msg-edit-window.h @@ -242,7 +242,7 @@ void modest_msg_edit_window_attach_file_one (Modest * remove attachments in @att_list, with a confirmation dialog */ void modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window, - GList *att_list); + TnyList *att_list); /** * modest_msg_edit_window_add_part: diff --git a/src/widgets/modest-msg-view-window.h b/src/widgets/modest-msg-view-window.h index b703f72..cb04add 100644 --- a/src/widgets/modest-msg-view-window.h +++ b/src/widgets/modest-msg-view-window.h @@ -208,18 +208,18 @@ void modest_msg_view_window_view_attachment (ModestMsgViewWindow *win * * Get selected attachments from #ModetMsgView private object. */ -GList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win); +TnyList * modest_msg_view_window_get_attachments (ModestMsgViewWindow *win); /** * modest_msg_view_window_save_attachments: * @window: a #ModestMsgViewWindow - * @mime_parts: a #GList of #TnyMimePart + * @mime_parts: a #TnyList of #TnyMimePart * * Save the #TnyMimePart attachments in @mime_parts, or currently selected attachments * if @mime_parts is %NULL, offering a dialog to the user to choose the location. */ void modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, - GList *mime_parts); + TnyList *mime_parts); /** * modest_msg_view_window_remove_attachments: diff --git a/src/widgets/modest-msg-view.c b/src/widgets/modest-msg-view.c index e97fa7c..cfb5b6d 100644 --- a/src/widgets/modest-msg-view.c +++ b/src/widgets/modest-msg-view.c @@ -88,13 +88,13 @@ modest_msg_view_set_priority (ModestMsgView *self, TnyHeaderFlags flags) MODEST_MSG_VIEW_GET_IFACE (self)->set_priority_func (self, flags); } -GList* +TnyList* modest_msg_view_get_selected_attachments (ModestMsgView *self) { return MODEST_MSG_VIEW_GET_IFACE (self)->get_selected_attachments_func (self); } -GList* +TnyList* modest_msg_view_get_attachments (ModestMsgView *self) { return MODEST_MSG_VIEW_GET_IFACE (self)->get_attachments_func (self); diff --git a/src/widgets/modest-msg-view.h b/src/widgets/modest-msg-view.h index 4c7f16d..241ac51 100644 --- a/src/widgets/modest-msg-view.h +++ b/src/widgets/modest-msg-view.h @@ -61,8 +61,8 @@ struct _ModestMsgViewIface { GtkShadowType (*get_shadow_type_func) (ModestMsgView *self); TnyHeaderFlags (*get_priority_func) (ModestMsgView *self); void (*set_priority_func) (ModestMsgView *self, TnyHeaderFlags flags); - GList * (*get_selected_attachments_func) (ModestMsgView *self); - GList * (*get_attachments_func) (ModestMsgView *self); + TnyList * (*get_selected_attachments_func) (ModestMsgView *self); + TnyList * (*get_attachments_func) (ModestMsgView *self); void (*grab_focus_func) (ModestMsgView *self); void (*remove_attachment_func) (ModestMsgView *view, TnyMimePart *attachment); @@ -100,8 +100,8 @@ GtkShadowType modest_msg_view_get_shadow_type (ModestMsgView *self); TnyHeaderFlags modest_msg_view_get_priority (ModestMsgView *self); void modest_msg_view_set_priority (ModestMsgView *self, TnyHeaderFlags flags); -GList *modest_msg_view_get_selected_attachments (ModestMsgView *self); -GList *modest_msg_view_get_attachments (ModestMsgView *self); +TnyList *modest_msg_view_get_selected_attachments (ModestMsgView *self); +TnyList *modest_msg_view_get_attachments (ModestMsgView *self); void modest_msg_view_grab_focus (ModestMsgView *self); void modest_msg_view_remove_attachment (ModestMsgView *view, TnyMimePart *attachment); -- 1.7.9.5