Only enable show_latest for imap and pop accounts.
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 11 Nov 2009 12:55:12 +0000 (13:55 +0100)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 11 Nov 2009 12:55:12 +0000 (13:55 +0100)
src/hildon2/modest-header-window.c
src/modest-protocol-registry.c
src/modest-protocol-registry.h

index 30816a3..79d44ce 100644 (file)
@@ -50,6 +50,7 @@
 #include <hildon/hildon-banner.h>
 #include <modest-ui-dimming-rules.h>
 #include <modest-tny-folder.h>
+#include <modest-tny-account.h>
 #include <tny-simple-list.h>
 
 #define SHOW_LATEST_SIZE 250
@@ -654,10 +655,26 @@ create_header_view (ModestWindow *self, TnyFolder *folder)
        GtkWidget *header_view;
        GtkWidget *delete_item, *mark_read_item, *mark_unread_item;
        ModestHeaderWindowPrivate *priv;
+       TnyAccount *account;
+       ModestProtocolType protocol_type;
+       gboolean limit_headers;
 
-       header_view  = modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_TWOLINES);
-       modest_header_view_set_show_latest (MODEST_HEADER_VIEW (header_view), SHOW_LATEST_SIZE);
        priv = MODEST_HEADER_WINDOW_GET_PRIVATE (self);
+
+       header_view  = modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_TWOLINES);
+
+       account = modest_tny_folder_get_account (folder);
+       limit_headers = FALSE;
+       if (account) {
+               protocol_type = modest_tny_account_get_protocol_type (account);
+               if (modest_protocol_registry_protocol_type_has_tag (modest_runtime_get_protocol_registry (),
+                                                                   protocol_type,
+                                                                   MODEST_PROTOCOL_REGISTRY_STORE_LIMIT_HEADER_WINDOW)) {
+                       limit_headers = TRUE;
+               }
+       }
+       modest_header_view_set_show_latest (MODEST_HEADER_VIEW (header_view), limit_headers?SHOW_LATEST_SIZE:0);
+
        priv->notify_model = g_signal_connect ((GObject*) header_view, "notify::model",
                                               G_CALLBACK (on_header_view_model_changed), self);
 
@@ -1033,13 +1050,13 @@ update_view (ModestHeaderWindow *self,
 
        visible = modest_header_view_get_show_latest (MODEST_HEADER_VIEW (priv->header_view));
 
-       if (all_count > 0 && visible < all_count && folder_empty) {
+       if (visible > 0 && all_count > 0 && visible < all_count && folder_empty) {
                modest_header_view_set_show_latest (MODEST_HEADER_VIEW (priv->header_view), visible + SHOW_LATEST_SIZE);
        }
 
        if (visible > all_count)
                visible = all_count;
-       if (visible == all_count) {
+       if (visible == 0 || visible == all_count) {
                gtk_widget_hide_all (priv->show_more_button);
                gtk_widget_hide_all (priv->show_more_button2);
        } else {
index 9e89763..57d2cef 100644 (file)
@@ -464,6 +464,7 @@ modest_protocol_registry_set_to_default (ModestProtocolRegistry *self)
                                      MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS,
                                      MODEST_PROTOCOL_REGISTRY_HAS_LEAVE_ON_SERVER_PROTOCOLS,
                                      MODEST_PROTOCOL_REGISTRY_STORE_FORBID_INCOMING_XFERS,
+                                     MODEST_PROTOCOL_REGISTRY_STORE_LIMIT_HEADER_WINDOW,
                                      NULL);
        g_object_unref (protocol);
 
@@ -491,6 +492,7 @@ modest_protocol_registry_set_to_default (ModestProtocolRegistry *self)
                                      MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS,
                                      MODEST_PROTOCOL_REGISTRY_REMOTE_STORE_PROTOCOLS,
                                      MODEST_PROTOCOL_REGISTRY_STORE_HAS_FOLDERS,
+                                     MODEST_PROTOCOL_REGISTRY_STORE_LIMIT_HEADER_WINDOW,
                                      NULL);
        g_object_unref (protocol);
 
index 3bf3aa9..f7c314c 100644 (file)
@@ -58,6 +58,7 @@ G_BEGIN_DECLS
 /* Accounts that do not allow to move messages or folders from */
 #define MODEST_PROTOCOL_REGISTRY_STORE_FORBID_OUTGOING_XFERS "store-forbid-outgoing-xfers"
 #define MODEST_PROTOCOL_REGISTRY_NO_AUTO_UPDATE_PROTOCOLS "no-auto-update"
+#define MODEST_PROTOCOL_REGISTRY_STORE_LIMIT_HEADER_WINDOW "store-limit-header-window"
 
 /* convenience macros */
 #define MODEST_TYPE_PROTOCOL_REGISTRY             (modest_protocol_registry_get_type())