From 0a2a12ea7dcc71c4ba9d3d046dbef30c2f660d61 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 30 Mar 2015 23:30:03 -0300 Subject: [PATCH] source-dialog: better handle 1-source servers --- src/gcal-source-dialog.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c index 4e2079c4..00a34cbe 100644 --- a/src/gcal-source-dialog.c +++ b/src/gcal-source-dialog.c @@ -822,7 +822,28 @@ discover_sources_cb (GObject *source, } else if (n_sources == 1) { - // TODO: no need to select the only source available + gboolean uri_valid; + gchar *resource_path; + + src = discovered_sources->data; + + // Get the new resource path from the uri + uri_valid = uri_get_fields (src->href, NULL, NULL, &resource_path); + + // Update the ESourceWebdav extension's resource path + if (uri_valid) + { + ESourceWebdav *webdav = e_source_get_extension (E_SOURCE (source), E_SOURCE_EXTENSION_WEBDAV_BACKEND); + + e_source_webdav_set_resource_path (webdav, resource_path); + + // Update button sensivity, etc + gtk_widget_set_sensitive (priv->add_button, source != NULL); + setup_source_details (GCAL_SOURCE_DIALOG (user_data), E_SOURCE (source)); + } + + if (resource_path) + g_free (resource_path); } // Free things up