aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-08-26 23:55:28 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-08-26 23:55:28 +0800
commitf95a4634519d4e41c4d1f29ab4f6cf0503a37995 (patch)
treefefa7a8e250f85b382e165d842d2e7e20ab1fb9c
parent5980d9a46fb04b32f6a4de6f484e55937cef7685 (diff)
downloadgsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar.gz
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar.bz2
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar.lz
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar.xz
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.tar.zst
gsoc2013-evolution-f95a4634519d4e41c4d1f29ab4f6cf0503a37995.zip
only set the key if the value is different from what we've already read
2002-08-26 Rodrigo Moya <rodrigo@ximian.com> * e-config-listener.c (e_config_listener_set_long): only set the key if the value is different from what we've already read from the database, to avoid extra change notifications. (e_config_listener_set_string): likewise. svn path=/trunk/; revision=17858
-rw-r--r--e-util/ChangeLog7
-rw-r--r--e-util/e-config-listener.c11
2 files changed, 18 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 6b7fa1d3ec..d70eb132f9 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,10 @@
+2002-08-26 Rodrigo Moya <rodrigo@ximian.com>
+
+ * e-config-listener.c (e_config_listener_set_long): only set the key
+ if the value is different from what we've already read from the
+ database, to avoid extra change notifications.
+ (e_config_listener_set_string): likewise.
+
2002-08-22 Rodrigo Moya <rodrigo@ximian.com>
* e-config-listener.[ch]: added "key_changed" signal to class.
diff --git a/e-util/e-config-listener.c b/e-util/e-config-listener.c
index df3dfdf27c..88debbd8b0 100644
--- a/e-util/e-config-listener.c
+++ b/e-util/e-config-listener.c
@@ -382,6 +382,10 @@ e_config_listener_set_long (EConfigListener *cl, const char *key, long value)
g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
g_return_if_fail (key != NULL);
+ /* check that the value is not the same */
+ if (value == e_config_listener_get_long_with_default (cl, key, 0, NULL))
+ return;
+
CORBA_exception_init (&ev);
bonobo_config_set_long (cl->priv->db, key, value, &ev);
@@ -395,10 +399,17 @@ void
e_config_listener_set_string (EConfigListener *cl, const char *key, const char *value)
{
CORBA_Environment ev;
+ char *s1, *s2;
g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
g_return_if_fail (key != NULL);
+ /* check that the value is not the same */
+ s1 = value;
+ s2 = e_config_listener_get_string_with_default (cl, key, NULL, NULL);
+ if (!strcmp (s1 ? s1 : "", s2 ? s2 : ""))
+ return;
+
CORBA_exception_init (&ev);
bonobo_config_set_string (cl->priv->db, key, value, &ev);