diff options
Diffstat (limited to 'plugins/caldav/caldav-source.c')
-rw-r--r-- | plugins/caldav/caldav-source.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index 46e510367f..5df807a691 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -124,11 +124,22 @@ location_changed (GtkEntry *editable, ESource *source) { EUri *euri; char *ruri; - const char *uri; + const char *uri, *username; uri = gtk_entry_get_text (GTK_ENTRY (editable)); euri = e_uri_new (uri); + g_return_if_fail (euri != NULL); + + username = e_source_get_property (source, "username"); + if (username && !*username) + username = NULL; + + if ((!euri->user && username) || (euri->user && username && !g_str_equal (euri->user, username))) { + g_free (euri->user); + euri->user = g_strdup (username); + } + ruri = print_uri_noproto (euri); e_source_set_relative_uri (source, ruri); g_free (ruri); @@ -163,6 +174,7 @@ user_changed (GtkEntry *editable, ESource *source) euri->user = NULL; if (user != NULL && *user) { + euri->user = g_strdup (user); e_source_set_property (source, "auth", "1"); } else { e_source_set_property (source, "auth", NULL); |