* src/modest-ui-actions.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 19 Sep 2007 09:12:06 +0000 (09:12 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 19 Sep 2007 09:12:06 +0000 (09:12 +0000)
        * (open_msg_for_purge_cb): fixed usage of iterators. We were
          resetting the iterator to the first position and this was not
          working properly. Also removed a code that wasn't working for
          freeing the referenced attachments.
* src/modest-ui-dimming-rules.c:
        * (modest_ui_dimming_rules_on_remove_attachments): fixed a typo
          that was making the dimming rule fail (fixes NB#65901).

pmo-trunk-r3337

src/modest-ui-actions.c
src/modest-ui-dimming-rules.c

index 32bcee6..2e78faa 100644 (file)
@@ -3997,6 +3997,8 @@ open_msg_for_purge_cb (ModestMailOperation *mail_op,
 
                tny_iterator_next (iter);
        }
+       g_object_unref (iter);
+       
 
        if (pending_purges>0) {
                gint response;
@@ -4004,7 +4006,7 @@ open_msg_for_purge_cb (ModestMailOperation *mail_op,
 
                if (response == GTK_RESPONSE_OK) {
                        modest_platform_information_banner (NULL, NULL, _("mcen_ib_removing_attachment"));
-                       tny_iterator_first (iter);
+                       iter = tny_list_create_iterator (parts);
                        while (!tny_iterator_is_done (iter)) {
                                TnyMimePart *part;
                                
@@ -4023,26 +4025,10 @@ open_msg_for_purge_cb (ModestMailOperation *mail_op,
        } else {
                modest_platform_information_banner (NULL, NULL, _("mail_ib_attachment_already_purged"));
        }
+       g_object_unref (iter);
 
-       /* remove attachments */
-       tny_iterator_first (iter);
-       while (!tny_iterator_is_done (iter)) {
-               TnyMimePart *part;
-                       
-               part = TNY_MIME_PART (tny_iterator_get_current (iter));
-               if (part) {
-                       /* One for the reference given by tny_iterator_get_current(): */
-                       g_object_unref (part);
-
-                       /* TODO: Is this meant to remove the attachment by doing another unref()? 
-                        * Otherwise, this seems useless. */
-               }
-
-               tny_iterator_next (iter);
-       }
        modest_window_mgr_unregister_header (mgr, header);
 
-       g_object_unref (iter);
        g_object_unref (parts);
 }
 
index 0b7f3f6..f874ec2 100644 (file)
@@ -273,7 +273,7 @@ _define_msg_view_window_dimming_state (ModestMsgViewWindow *window)
        all_has_attach = all_has_attach && (flags & TNY_HEADER_FLAG_ATTACHMENTS);
        state->all_has_attachments = all_has_attach;
        if (!state->any_has_attachments)
-               state->any_has_attachments = flags & TNY_HEADER_FLAG_ATTACHMENTS;
+               state->any_has_attachments = (flags & TNY_HEADER_FLAG_ATTACHMENTS)?1:0;
        
        /* sent in progress */
        msg_uid = modest_tny_send_queue_get_msg_id (header);
@@ -1193,7 +1193,7 @@ modest_ui_dimming_rules_on_remove_attachments (ModestWindow *win, gpointer user_
 
        /* Check if the selected message in main window has attachments */
        if (!dimmed && MODEST_IS_MAIN_WINDOW (win)) {
-               dimmed = state->any_has_attachments;
+               dimmed = !(state->any_has_attachments);
                if (dimmed)
                        modest_dimming_rule_set_notification (rule, _("mail_ib_unable_to_purge_attachments"));
        }