Fremantle save and remove attachments act on all attachments
authorJose Dapena Paz <jdapena@igalia.com>
Tue, 27 Jan 2009 19:08:42 +0000 (19:08 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Tue, 27 Jan 2009 19:08:42 +0000 (19:08 +0000)
pmo-trunk-r7324

src/hildon2/modest-msg-view-window.c
src/modest-ui-dimming-rules.c

index 63a4c93..ea5ba0d 100644 (file)
@@ -2394,7 +2394,8 @@ modest_msg_view_window_get_attachments (ModestMsgViewWindow *win)
        g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win), NULL);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (win);
 
        g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (win), NULL);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (win);
 
-       selected_attachments = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view));
+       /* In Hildon 2.2 as there's no selection we assume we have all attachments selected */
+       selected_attachments = modest_msg_view_get_attachments (MODEST_MSG_VIEW (priv->msg_view));
        
        return selected_attachments;
 }
        
        return selected_attachments;
 }
@@ -2771,7 +2772,9 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *m
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
 
        if (mime_parts == NULL) {
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
 
        if (mime_parts == NULL) {
-               mime_parts = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view));
+               /* 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 == NULL || tny_list_get_length (mime_parts) == 0)
                        return;
        } else {
                if (mime_parts == NULL || tny_list_get_length (mime_parts) == 0)
                        return;
        } else {
@@ -2867,10 +2870,10 @@ modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
 
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
 
-       if (get_all)
-               mime_parts = modest_msg_view_get_attachments (MODEST_MSG_VIEW (priv->msg_view));
-       else
-               mime_parts = modest_msg_view_get_selected_attachments (MODEST_MSG_VIEW (priv->msg_view));
+       /* In hildon 2.2 we ignore the get_all flag as we always get all attachments. This is
+        * because we don't have selection
+        */
+       mime_parts = modest_msg_view_get_attachments (MODEST_MSG_VIEW (priv->msg_view));
                
        /* Remove already purged messages from mime parts list */
        iter = tny_list_create_iterator (mime_parts);
                
        /* Remove already purged messages from mime parts list */
        iter = tny_list_create_iterator (mime_parts);
index e8ba566..2857cf7 100644 (file)
@@ -2523,29 +2523,48 @@ _invalid_attach_selected (ModestWindow *win,
                        TnyIterator *iter;
                        iter = tny_list_create_iterator (attachments);
                        while (!tny_iterator_is_done (iter) && !result) {
                        TnyIterator *iter;
                        iter = tny_list_create_iterator (attachments);
                        while (!tny_iterator_is_done (iter) && !result) {
+#ifdef MODEST_TOOLKIT_HILDON2
+                               gboolean not_selectable = FALSE;
+#endif
                                TnyMimePart *mime_part = TNY_MIME_PART (tny_iterator_get_current (iter));
                                TnyList *nested_list = tny_simple_list_new ();
                                TnyMimePart *mime_part = TNY_MIME_PART (tny_iterator_get_current (iter));
                                TnyList *nested_list = tny_simple_list_new ();
+                               tny_mime_part_get_parts (mime_part, nested_list);
 
                                if (!for_remove && modest_tny_mime_part_is_msg (mime_part)) {
                                        TnyMsg *window_msg;
                                        window_msg = modest_msg_view_window_get_message (MODEST_MSG_VIEW_WINDOW (win));
                                        if ((TnyMimePart *) window_msg != mime_part) {
                                                selected_messages = TRUE;
 
                                if (!for_remove && modest_tny_mime_part_is_msg (mime_part)) {
                                        TnyMsg *window_msg;
                                        window_msg = modest_msg_view_window_get_message (MODEST_MSG_VIEW_WINDOW (win));
                                        if ((TnyMimePart *) window_msg != mime_part) {
                                                selected_messages = TRUE;
+#ifdef MODEST_TOOLKIT_HILDON2
+                                               not_selectable = TRUE;
+#else
                                                result = TRUE;
                                                result = TRUE;
+#endif
                                        }
                                        g_object_unref (window_msg);
                                }
                                        }
                                        g_object_unref (window_msg);
                                }
-                               tny_mime_part_get_parts (mime_part, nested_list);
                                if (!for_remove && tny_list_get_length (nested_list) > 0) {
                                        nested_attachments = TRUE;
                                if (!for_remove && tny_list_get_length (nested_list) > 0) {
                                        nested_attachments = TRUE;
+#ifdef MODEST_TOOLKIT_HILDON2
+                                       not_selectable = TRUE;
+#else
                                        result = TRUE;
                                        result = TRUE;
+#endif
                                }
                                }
+#ifdef MODEST_TOOLKIT_HILDON2
+                               if (not_selectable)
+                                       n_selected --;
+#endif
                                g_object_unref (nested_list);
                                g_object_unref (mime_part);
                                tny_iterator_next (iter);
                        }
                        g_object_unref (iter);
                }
                                g_object_unref (nested_list);
                                g_object_unref (mime_part);
                                tny_iterator_next (iter);
                        }
                        g_object_unref (iter);
                }
+
+               /* No valid attachment available */
+               if (n_selected == 0)
+                       result = TRUE;
                
                /* Set notifications */
                if (result && rule != NULL) {
                
                /* Set notifications */
                if (result && rule != NULL) {