[evolution-data-server] Part of Bug #583374 - Better handle uri changes in ESource
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-data-server] Part of Bug #583374 - Better handle uri changes in ESource
- Date: Fri, 17 Jul 2009 10:04:56 +0000 (UTC)
commit 1564ac68405fa7cee379df876bf7139307a0e110
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 17 12:03:03 2009 +0200
Part of Bug #583374 - Better handle uri changes in ESource
libedataserver/e-source.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 5ccd506..9d34038 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -307,11 +307,18 @@ e_source_update_from_xml_node (ESource *source,
|| source->priv->relative_uri == NULL
|| relative_uri == NULL
|| strcmp ((gchar *)relative_uri, source->priv->relative_uri) != 0) {
+ gchar *abs_uri = NULL;
+
g_free (source->priv->name);
source->priv->name = g_strdup ((gchar *)name);
if (source->priv->group) {
- /* reset the absolute uri to NULL to be regenerated when asked for */
+ abs_uri = e_source_build_absolute_uri (source);
+ }
+
+ if (abs_uri && source->priv->absolute_uri && g_str_equal (abs_uri, source->priv->absolute_uri)) {
+ /* reset the absolute uri to NULL to be regenerated when asked for,
+ but only when it was generated also before */
g_free (source->priv->absolute_uri);
source->priv->absolute_uri = NULL;
} else if (source->priv->absolute_uri &&
@@ -325,6 +332,8 @@ e_source_update_from_xml_node (ESource *source,
g_free (tmp);
}
+ g_free (abs_uri);
+
g_free (source->priv->relative_uri);
source->priv->relative_uri = g_strdup ((gchar *)relative_uri);
@@ -493,26 +502,33 @@ void
e_source_set_relative_uri (ESource *source,
const gchar *relative_uri)
{
- gchar *absolute_uri;
+ gchar *absolute_uri, *old_abs_uri = NULL;
g_return_if_fail (E_IS_SOURCE (source));
if (source->priv->readonly)
return;
- if (source->priv->relative_uri == relative_uri)
+ if (source->priv->relative_uri == relative_uri ||
+ (source->priv->relative_uri && relative_uri && g_str_equal (source->priv->relative_uri, relative_uri)))
return;
+ if (source->priv->group)
+ old_abs_uri = e_source_build_absolute_uri (source);
+
g_free (source->priv->relative_uri);
source->priv->relative_uri = g_strdup (relative_uri);
- /* reset the absolute uri */
+ /* reset the absolute uri, if it's a generated one */
if (source->priv->absolute_uri &&
+ (!old_abs_uri || g_str_equal (source->priv->absolute_uri, old_abs_uri)) &&
(absolute_uri = e_source_build_absolute_uri (source))) {
g_free (source->priv->absolute_uri);
source->priv->absolute_uri = absolute_uri;
}
+ g_free (old_abs_uri);
+
g_signal_emit (source, signals[CHANGED], 0);
}
@@ -522,7 +538,7 @@ e_source_set_absolute_uri (ESource *source,
{
g_return_if_fail (E_IS_SOURCE (source));
- if (!!absolute_uri == !!source->priv->absolute_uri
+ if ((absolute_uri == source->priv->absolute_uri && absolute_uri == NULL)
|| (absolute_uri && source->priv->absolute_uri && !strcmp (source->priv->absolute_uri, absolute_uri)))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]