Show proper size string for 0kb (fixes NB#92465).
[modest] / src / modest-tny-account-store.c
index 4d88938..47e6b81 100644 (file)
@@ -40,7 +40,7 @@
 #include <tny-camel-transport-account.h>
 #include <tny-camel-imap-store-account.h>
 #include <tny-camel-pop-store-account.h>
-
+#include "modest-text-utils.h"
 #include <modest-runtime.h>
 #include <modest-marshal.h>
 #include <modest-protocol-registry.h>
@@ -493,11 +493,8 @@ on_account_changed (ModestAccountMgr *acc_mgr,
 static void 
 show_password_warning_only (const gchar *msg)
 {
-       ModestWindow *main_window = 
-               modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE); /* don't create */
-       
        /* Show an explanatory temporary banner: */
-       if (main_window) 
+       if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ()))
                modest_platform_information_banner (NULL, NULL, msg);
 }
 
@@ -584,10 +581,10 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
                           __FUNCTION__, server_account_name ? server_account_name : "<NULL>");
                if (cancel)
                        *cancel = TRUE;
-               
+
                return NULL;
        }
-       
+
        /* This hash map stores passwords, including passwords that are not stored in gconf. */
        /* Is it in the hash? if it's already there, it must be wrong... */
        pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
@@ -600,7 +597,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
        MODEST_DEBUG_BLOCK(
                g_debug ("%s: Already asked = %d\n", __FUNCTION__, already_asked);
        );
-               
+
        /* If the password is not already there, try ModestConf */
        if (!already_asked) {
                pwd  = modest_account_mgr_get_server_account_password (priv->account_mgr,
@@ -657,18 +654,18 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
                if (settings_have_password) {
                        /* The password must be wrong, so show the account settings dialog so it can be corrected: */
                        show_wrong_password_dialog (account);
-                       
+
                        if (cancel)
                                *cancel = TRUE;
-                               
+
                        return NULL;
                }
-       
+
                /* we don't have it yet. Get the password from the user */
                const gchar* account_id = tny_account_get_id (account);
                gboolean remember = FALSE;
                pwd = NULL;
-               
+
                if (already_asked) {
                        const gchar *msg;
                        gboolean username_known = 
@@ -676,7 +673,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc
                                                                                             server_account_name);
                        /* If the login has ever succeeded then show a specific message */
                        if (username_known)
-                               msg = dgettext ("hildon-common-strings", "ecdg_ib_set_password_incorrect");
+                               msg = _CS ("ecdg_ib_set_password_incorrect");
                        else
                                msg = _("mcen_ib_username_pw_incorrect");
                        show_password_warning_only (msg);
@@ -1123,12 +1120,13 @@ modest_tny_account_store_alert (TnyAccountStore *self,
        if (error->code == TNY_SERVICE_ERROR_CERTIFICATE)
                retval = modest_platform_run_certificate_confirmation_dialog (server_name,
                                                                              error->message);
-       else if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE) {
+       else if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE ||
+                error->code == TNY_SERVICE_ERROR_CONNECT) {
+
                modest_platform_run_information_dialog (NULL, prompt, TRUE);
 
                /* Show the account dialog if it was wrong */
-               if (error->code == TNY_SERVICE_ERROR_CONNECT || 
-                   error->code == TNY_SERVICE_ERROR_AUTHENTICATE)
+               if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE)
                        show_wrong_password_dialog (account);
 
                retval = TRUE;
@@ -1512,9 +1510,9 @@ connection_status_changed (TnyAccount *account,
           runnning */
        if (status == TNY_CONNECTION_STATUS_CONNECTED) {
                const gchar *account_name;
-               ModestWindow *main_window;
+               ModestWindow *top_window;
                ModestTnyAccountStorePrivate *priv = NULL;
-               
+
                priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (data);
 
                /* Remove this handler */
@@ -1524,8 +1522,8 @@ connection_status_changed (TnyAccount *account,
 
                /* Perform a send receive */
                account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
-               main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE);
-               modest_ui_actions_do_send_receive (account_name, FALSE, FALSE, TRUE, main_window);
+               top_window = modest_window_mgr_get_current_top (modest_runtime_get_window_mgr ());
+               modest_ui_actions_do_send_receive (account_name, FALSE, FALSE, TRUE, top_window);
        }
 }