[evolution-ews] Visualize incorrect values in an account editor



commit e3f96b4255fe793e2e78115061b4e32fc4ff535f
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 1 14:19:48 2015 +0100

    Visualize incorrect values in an account editor
    
    It's sometimes hard to spot what's wrong when creating a new
    mail account, or editing it. This change adds visual indication
    beside widgets whose value is not filled correctly.

 src/configuration/e-mail-config-ews-backend.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index b51d0eb..6819118 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -355,12 +355,15 @@ static gboolean
 mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
 {
        EMailConfigServicePage *page;
+       EMailConfigEwsBackendPrivate *priv;
        CamelSettings *settings;
        CamelEwsSettings *ews_settings;
        CamelNetworkSettings *network_settings;
        const gchar *hosturl;
        const gchar *user;
+       gboolean correct, complete = TRUE;
 
+       priv = E_MAIL_CONFIG_EWS_BACKEND_GET_PRIVATE (backend);
        page = e_mail_config_service_backend_get_page (backend);
 
        /* This backend serves double duty.  One instance holds the
@@ -381,13 +384,17 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
        network_settings = CAMEL_NETWORK_SETTINGS (settings);
        user = camel_network_settings_get_user (network_settings);
 
-       if (hosturl == NULL || *hosturl == '\0')
-               return FALSE;
+       correct = hosturl != NULL && *hosturl != '\0';
+       complete = complete && correct;
+
+       e_util_set_entry_issue_hint (priv->host_entry, correct ? NULL : _("Host URL cannot be empty"));
+
+       correct = user != NULL && *user != '\0';
+       complete = complete && correct;
 
-       if (user == NULL || *user == '\0')
-               return FALSE;
+       e_util_set_entry_issue_hint (priv->user_entry, correct ? NULL : _("User name cannot be empty"));
 
-       return TRUE;
+       return complete;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]