From f95a4634519d4e41c4d1f29ab4f6cf0503a37995 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 26 Aug 2002 15:55:28 +0000 Subject: only set the key if the value is different from what we've already read 2002-08-26 Rodrigo Moya * 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 --- e-util/ChangeLog | 7 +++++++ e-util/e-config-listener.c | 11 +++++++++++ 2 files changed, 18 insertions(+) (limited to 'e-util') 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 + + * 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 * 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); -- cgit v1.2.3