Fixes NB#124628, 20 newest messages are not retrieved when the account has been setup
authorSergio Villar Senin <svillar@igalia.com>
Thu, 25 Jun 2009 18:08:31 +0000 (20:08 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 29 Jun 2009 08:11:48 +0000 (10:11 +0200)
Fixes NB#124639, only headers are downloaded when issuing a Send&Receive

src/hildon2/modest-easysetup-wizard-dialog.c
src/modest-mail-operation.c
src/modest-ui-actions.c

index b2369a5..c824802 100644 (file)
@@ -2321,6 +2321,11 @@ save_to_settings (ModestEasysetupWizardDialog *self)
        modest_account_settings_set_display_name (priv->settings, display_name);
        g_free (display_name);
        g_free (provider_id);
+
+       /* This values are hardcoded for Fremantle */
+       modest_account_settings_set_retrieve_type (priv->settings,
+                                                  MODEST_ACCOUNT_RETRIEVE_MESSAGES_AND_ATTACHMENTS);
+       modest_account_settings_set_retrieve_limit (priv->settings, 20);
 }
 
 
index 49e1818..19f8954 100644 (file)
@@ -1669,7 +1669,7 @@ inbox_refreshed_cb (TnyFolder *inbox,
                   if the mail operation has a source (this means that
                   was invoked by the user and not automatically by a
                   D-Bus method) */
-               if (info->retrieve_all_cb && priv->source)
+               if (info->retrieve_all_cb && info->interactive)
                        ignore_limit = info->retrieve_all_cb (priv->source,
                                                              new_headers_array->len,
                                                              retrieve_limit);
@@ -1679,7 +1679,9 @@ inbox_refreshed_cb (TnyFolder *inbox,
        new_headers = tny_simple_list_new ();
        for (i=0; i < new_headers_array->len; i++) {
                TnyHeader *header = TNY_HEADER (g_ptr_array_index (new_headers_array, i));
-               tny_list_append (new_headers, G_OBJECT (header));
+               /* We want the first element to be the most recent
+                  one, that's why we reverse the list */
+               tny_list_prepend (new_headers, G_OBJECT (header));
        }
        g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL);
        g_ptr_array_free (new_headers_array, FALSE);
index 75e6fdd..f5dd2fd 100644 (file)
@@ -2179,7 +2179,12 @@ new_messages_arrived (ModestMailOperation *self,
                        flags = tny_header_get_flags (header);
 
                        if (!(flags & TNY_HEADER_FLAG_SEEN)) {
-                               tny_list_append (actually_new_list, G_OBJECT (header));
+                               /* Messages are ordered from most
+                                  recent to oldest. But we want to
+                                  show notifications starting from
+                                  the oldest message. That's why we
+                                  reverse the list */
+                               tny_list_prepend (actually_new_list, G_OBJECT (header));
                        }
                        g_object_unref (header);
                }