[gnome-calendar/calendar-editor] source-dialog: give empty credentials instead of none at all



commit d05fb310d53cdeb7863bd5f1e5a4168a3a4d2854
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Apr 19 11:19:52 2015 -0300

    source-dialog: give empty credentials instead of none at all

 src/gcal-source-dialog.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 6318984..f11e258 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -1257,6 +1257,8 @@ validate_url_cb (GcalSourceDialog *dialog)
     }
   else
     {
+      ENamedParameters *credentials;
+
       // Pulse the entry while it performs the check
       priv->calendar_address_id = g_timeout_add (ENTRY_PROGRESS_TIMEOUT, (GSourceFunc) pulse_web_entry, 
dialog);
 
@@ -1265,6 +1267,8 @@ validate_url_cb (GcalSourceDialog *dialog)
        * username and password. If we get any error,
        * then it prompts and retry.
        */
+      credentials = e_named_parameters_new ();
+
       if (priv->prompt_password)
         {
           gint response;
@@ -1279,15 +1283,13 @@ validate_url_cb (GcalSourceDialog *dialog)
            */
           if (response == GTK_RESPONSE_OK)
             {
-              ENamedParameters *credentials = e_named_parameters_new ();
+              // User inputted credentials
               e_named_parameters_set (credentials, E_SOURCE_CREDENTIAL_USERNAME, user);
               e_named_parameters_set (credentials, E_SOURCE_CREDENTIAL_PASSWORD, password);
 
               e_webdav_discover_sources (source, gtk_entry_get_text (GTK_ENTRY 
(priv->calendar_address_entry)),
                                          E_WEBDAV_DISCOVER_SUPPORTS_EVENTS, credentials, NULL, 
discover_sources_cb,
                                          dialog);
-
-              e_named_parameters_free (credentials);
             }
 
           if (user)
@@ -1298,9 +1300,17 @@ validate_url_cb (GcalSourceDialog *dialog)
       else
         {
           g_debug ("[source-dialog] Trying to connect without credentials...");
+
+          // NULL credentials
+          e_named_parameters_set (credentials, E_SOURCE_CREDENTIAL_USERNAME, NULL);
+          e_named_parameters_set (credentials, E_SOURCE_CREDENTIAL_PASSWORD, NULL);
+
           e_webdav_discover_sources (source, gtk_entry_get_text (GTK_ENTRY (priv->calendar_address_entry)),
-                                     E_WEBDAV_DISCOVER_SUPPORTS_EVENTS, NULL, NULL, discover_sources_cb, 
dialog);
+                                     E_WEBDAV_DISCOVER_SUPPORTS_EVENTS, credentials, NULL, 
discover_sources_cb,
+                                     dialog);
         }
+
+      e_named_parameters_free (credentials);
     }
 
 out:


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