[evolution] I#474 - [ESource Editors] Invalid URL: field value reset on User: field change
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#474 - [ESource Editors] Invalid URL: field value reset on User: field change
- Date: Fri, 7 Jun 2019 15:27:20 +0000 (UTC)
commit 4714c73f861d4907d01db02d8c3c3df50e1a2913
Author: Milan Crha <mcrha redhat com>
Date: Fri Jun 7 17:29:20 2019 +0200
I#474 - [ESource Editors] Invalid URL: field value reset on User: field change
Closes https://gitlab.gnome.org/GNOME/evolution/issues/474
.../evolution-book-config-carddav.c | 20 ++++++++++--
.../evolution-cal-config-caldav.c | 28 ++++++++++++-----
.../evolution-cal-config-webcal.c | 36 ++++++++++++++++------
3 files changed, 64 insertions(+), 20 deletions(-)
---
diff --git a/src/modules/book-config-carddav/evolution-book-config-carddav.c
b/src/modules/book-config-carddav/evolution-book-config-carddav.c
index d97e50e963..85ef417bc0 100644
--- a/src/modules/book-config-carddav/evolution-book-config-carddav.c
+++ b/src/modules/book-config-carddav/evolution-book-config-carddav.c
@@ -168,7 +168,21 @@ book_config_carddav_uri_to_text (GBinding *binding,
soup_uri = g_value_get_boxed (source_value);
soup_uri_set_user (soup_uri, NULL);
- text = soup_uri_to_string (soup_uri, FALSE);
+ if (soup_uri_get_host (soup_uri)) {
+ text = soup_uri_to_string (soup_uri, FALSE);
+ } else {
+ GObject *target;
+
+ text = NULL;
+ target = g_binding_get_target (binding);
+ g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
+
+ if (!text || !*text) {
+ g_free (text);
+ text = soup_uri_to_string (soup_uri, FALSE);
+ }
+ }
+
g_value_take_string (target_value, text);
return TRUE;
@@ -191,8 +205,8 @@ book_config_carddav_text_to_uri (GBinding *binding,
text = g_value_get_string (source_value);
soup_uri = soup_uri_new (text);
- if (soup_uri == NULL)
- return FALSE;
+ if (!soup_uri)
+ soup_uri = soup_uri_new ("http://");
source_binding = g_binding_get_source (binding);
source = e_source_extension_ref_source (
diff --git a/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
b/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
index 0c50551d76..340c557828 100644
--- a/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
+++ b/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
@@ -225,7 +225,21 @@ cal_config_caldav_uri_to_text (GBinding *binding,
soup_uri = g_value_get_boxed (source_value);
soup_uri_set_user (soup_uri, NULL);
- text = soup_uri_to_string (soup_uri, FALSE);
+ if (soup_uri_get_host (soup_uri)) {
+ text = soup_uri_to_string (soup_uri, FALSE);
+ } else {
+ GObject *target;
+
+ text = NULL;
+ target = g_binding_get_target (binding);
+ g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
+
+ if (!text || !*text) {
+ g_free (text);
+ text = soup_uri_to_string (soup_uri, FALSE);
+ }
+ }
+
g_value_take_string (target_value, text);
return TRUE;
@@ -247,8 +261,8 @@ cal_config_caldav_text_to_uri (GBinding *binding,
text = g_value_get_string (source_value);
soup_uri = soup_uri_new (text);
- if (soup_uri == NULL)
- return FALSE;
+ if (!soup_uri)
+ soup_uri = soup_uri_new ("http://");
source = E_SOURCE (user_data);
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
@@ -422,13 +436,13 @@ cal_config_caldav_check_complete (ESourceConfigBackend *backend,
uri_string = gtk_entry_get_text (GTK_ENTRY (context->url_entry));
soup_uri = soup_uri_new (uri_string);
- if (!soup_uri) {
- complete = FALSE;
- } else {
+ if (soup_uri) {
if (g_strcmp0 (soup_uri_get_scheme (soup_uri), "caldav") == 0)
soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
- complete = SOUP_URI_VALID_FOR_HTTP (soup_uri);
+ complete = soup_uri_get_host (soup_uri) && SOUP_URI_VALID_FOR_HTTP (soup_uri);
+ } else {
+ complete = FALSE;
}
if (soup_uri != NULL)
diff --git a/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
b/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
index 8157e20e1d..6d2184bb40 100644
--- a/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
+++ b/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
@@ -64,7 +64,21 @@ cal_config_webcal_uri_to_text (GBinding *binding,
soup_uri = g_value_get_boxed (source_value);
soup_uri_set_user (soup_uri, NULL);
- text = soup_uri_to_string (soup_uri, FALSE);
+ if (soup_uri_get_host (soup_uri)) {
+ text = soup_uri_to_string (soup_uri, FALSE);
+ } else {
+ GObject *target;
+
+ text = NULL;
+ target = g_binding_get_target (binding);
+ g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
+
+ if (!text || !*text) {
+ g_free (text);
+ text = soup_uri_to_string (soup_uri, FALSE);
+ }
+ }
+
g_value_take_string (target_value, text);
return TRUE;
@@ -86,8 +100,8 @@ cal_config_webcal_text_to_uri (GBinding *binding,
text = g_value_get_string (source_value);
soup_uri = soup_uri_new (text);
- if (soup_uri == NULL)
- return FALSE;
+ if (!soup_uri)
+ soup_uri = soup_uri_new ("http://");
source = E_SOURCE (user_data);
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
@@ -187,7 +201,6 @@ cal_config_webcal_check_complete (ESourceConfigBackend *backend,
GtkEntry *entry;
Context *context;
const gchar *uri_string;
- const gchar *scheme;
const gchar *uid;
gboolean complete;
@@ -203,13 +216,16 @@ cal_config_webcal_check_complete (ESourceConfigBackend *backend,
soup_uri = soup_uri_new (uri_string);
- /* XXX webcal:// is a non-standard scheme, but we accept it.
- * Just convert it to http:// for the URI validity test. */
- scheme = soup_uri_get_scheme (soup_uri);
- if (g_strcmp0 (scheme, "webcal") == 0)
- soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
+ if (soup_uri) {
+ /* XXX webcal:// is a non-standard scheme, but we accept it.
+ * Just convert it to http:// for the URI validity test. */
+ if (g_strcmp0 (soup_uri_get_scheme (soup_uri), "webcal") == 0)
+ soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
- complete = SOUP_URI_VALID_FOR_HTTP (soup_uri);
+ complete = soup_uri_get_host (soup_uri) && SOUP_URI_VALID_FOR_HTTP (soup_uri);
+ } else {
+ complete = FALSE;
+ }
if (soup_uri != NULL)
soup_uri_free (soup_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]