Merge branch 'fixtests'
[modest] / src / modest-ui-dimming-rules.c
index 113eea4..2857cf7 100644 (file)
@@ -41,7 +41,7 @@
 #include "modest-tny-msg.h"
 #include "modest-tny-mime-part.h"
 #include "modest-text-utils.h"
-#include <modest-address-book.h>
+#include "modest-address-book.h"
 #include <widgets/modest-attachments-view.h>
 #include <modest-runtime.h>
 #include <tny-simple-list.h>
@@ -1877,13 +1877,13 @@ modest_ui_dimming_rules_on_send_receive_all (ModestWindow *win, gpointer user_da
 {
        ModestDimmingRule *rule = NULL;
        gboolean dimmed = FALSE;
-       
+
        g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);
        rule = MODEST_DIMMING_RULE (user_data);
  
        /* Check dimmed rule */ 
        GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr (), TRUE);
-       if (g_slist_length (account_names) <= 1)
+       if (g_slist_length (account_names) < 1)
                dimmed = TRUE;
        if (dimmed)
                modest_dimming_rule_set_notification (rule, _("mcen_nc_no_email_acnts_defined"));
@@ -2523,29 +2523,48 @@ _invalid_attach_selected (ModestWindow *win,
                        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 ();
+                               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;
+#ifdef MODEST_TOOLKIT_HILDON2
+                                               not_selectable = TRUE;
+#else
                                                result = TRUE;
+#endif
                                        }
                                        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;
+#ifdef MODEST_TOOLKIT_HILDON2
+                                       not_selectable = TRUE;
+#else
                                        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);
                }
+
+               /* No valid attachment available */
+               if (n_selected == 0)
+                       result = TRUE;
                
                /* Set notifications */
                if (result && rule != NULL) {