[evolution-exchange] Do not call g_object_notify() when property didn't change



commit 1394463ab712733ef9d64380650ca9085d18009b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 18 18:20:22 2012 +0200

    Do not call g_object_notify() when property didn't change

 server/lib/camel-exchange-settings.c |   58 ++++++++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/server/lib/camel-exchange-settings.c b/server/lib/camel-exchange-settings.c
index 1479e71..68b6957 100644
--- a/server/lib/camel-exchange-settings.c
+++ b/server/lib/camel-exchange-settings.c
@@ -607,6 +607,9 @@ camel_exchange_settings_set_check_all (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->check_all ? 1: 0) == (check_all ? 1 : 0))
+		return;
+
 	settings->priv->check_all = check_all;
 
 	g_object_notify (G_OBJECT (settings), "check-all");
@@ -626,6 +629,9 @@ camel_exchange_settings_set_filter_junk (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->filter_junk ? 1 : 0) == (filter_junk ? 1 : 0))
+		return;
+
 	settings->priv->filter_junk = filter_junk;
 
 	g_object_notify (G_OBJECT (settings), "filter-junk");
@@ -645,6 +651,9 @@ camel_exchange_settings_set_filter_junk_inbox (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->filter_junk_inbox ? 1 : 0) == (filter_junk_inbox ? 1 : 0))
+		return;
+
 	settings->priv->filter_junk_inbox = filter_junk_inbox;
 
 	g_object_notify (G_OBJECT (settings), "filter-junk-inbox");
@@ -664,6 +673,9 @@ camel_exchange_settings_set_gc_allow_browse (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->gc_allow_browse ? 1 : 0) == (gc_allow_browse ? 1 : 0))
+		return;
+
 	settings->priv->gc_allow_browse = gc_allow_browse;
 
 	g_object_notify (G_OBJECT (settings), "gc-allow-browse");
@@ -685,6 +697,9 @@ camel_exchange_settings_set_gc_auth_method (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if (settings->priv->gc_auth_method == gc_auth_method)
+		return;
+
 	settings->priv->gc_auth_method = gc_auth_method;
 
 	g_object_notify (G_OBJECT (settings), "gc-auth-method");
@@ -704,6 +719,9 @@ camel_exchange_settings_set_gc_expand_groups (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->gc_expand_groups ? 1 : 0) == (gc_expand_groups ? 1 : 0))
+		return;
+
 	settings->priv->gc_expand_groups = gc_expand_groups;
 
 	g_object_notify (G_OBJECT (settings), "gc-expand-groups");
@@ -723,11 +741,16 @@ camel_exchange_settings_set_gc_results_limit (CamelExchangeSettings *settings,
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
-	settings->priv->gc_results_limit = CLAMP (
+	gc_results_limit = CLAMP (
 		gc_results_limit,
 		GC_RESULTS_LIMIT_MIN,
 		GC_RESULTS_LIMIT_MAX);
 
+	if (settings->priv->gc_results_limit == gc_results_limit)
+		return;
+
+	settings->priv->gc_results_limit = gc_results_limit;
+
 	g_object_notify (G_OBJECT (settings), "gc-results-limit");
 }
 
@@ -769,6 +792,11 @@ camel_exchange_settings_set_gc_server_name (CamelExchangeSettings *settings,
 
 	g_mutex_lock (settings->priv->property_lock);
 
+	if (g_strcmp0 (settings->priv->gc_server_name, gc_server_name) == 0) {
+		g_mutex_unlock (settings->priv->property_lock);
+		return;
+	}
+
 	g_free (settings->priv->gc_server_name);
 	settings->priv->gc_server_name = g_strdup (gc_server_name);
 
@@ -815,6 +843,11 @@ camel_exchange_settings_set_mailbox (CamelExchangeSettings *settings,
 
 	g_mutex_lock (settings->priv->property_lock);
 
+	if (g_strcmp0 (settings->priv->mailbox, mailbox) == 0) {
+		g_mutex_unlock (settings->priv->property_lock);
+		return;
+	}
+
 	g_free (settings->priv->mailbox);
 	settings->priv->mailbox = g_strdup (mailbox);
 
@@ -861,6 +894,11 @@ camel_exchange_settings_set_owa_path (CamelExchangeSettings *settings,
 
 	g_mutex_lock (settings->priv->property_lock);
 
+	if (g_strcmp0 (settings->priv->owa_path, owa_path) == 0) {
+		g_mutex_unlock (settings->priv->property_lock);
+		return;
+	}
+
 	g_free (settings->priv->owa_path);
 	settings->priv->owa_path = g_strdup (owa_path);
 
@@ -907,6 +945,11 @@ camel_exchange_settings_set_owa_url (CamelExchangeSettings *settings,
 
 	g_mutex_lock (settings->priv->property_lock);
 
+	if (g_strcmp0 (settings->priv->owa_url, owa_url) == 0) {
+		g_mutex_unlock (settings->priv->property_lock);
+		return;
+	}
+
 	g_free (settings->priv->owa_url);
 	settings->priv->owa_url = g_strdup (owa_url);
 
@@ -929,11 +972,16 @@ camel_exchange_settings_set_passwd_exp_warn_period (CamelExchangeSettings *setti
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
-	settings->priv->passwd_exp_warn_period = CLAMP (
+	passwd_exp_warn_period = CLAMP (
 		passwd_exp_warn_period,
 		PASSWD_EXP_WARN_PERIOD_MIN,
 		PASSWD_EXP_WARN_PERIOD_MAX);
 
+	if (settings->priv->passwd_exp_warn_period == passwd_exp_warn_period)
+		return;
+
+	settings->priv->passwd_exp_warn_period = passwd_exp_warn_period;
+
 	g_object_notify (G_OBJECT (settings), "passwd-exp-warn-period");
 }
 
@@ -951,6 +999,9 @@ camel_exchange_settings_set_use_gc_results_limit (CamelExchangeSettings *setting
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->use_gc_results_limit ? 1 : 0) == (use_gc_results_limit ? 1 : 0))
+		return;
+
 	settings->priv->use_gc_results_limit = use_gc_results_limit;
 
 	g_object_notify (G_OBJECT (settings), "use-gc-results-limit");
@@ -970,6 +1021,9 @@ camel_exchange_settings_set_use_passwd_exp_warn_period (CamelExchangeSettings *s
 {
 	g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
 
+	if ((settings->priv->use_passwd_exp_warn_period ? 1 : 0) == (use_passwd_exp_warn_period ? 1 : 0))
+		return;
+
 	settings->priv->use_passwd_exp_warn_period = use_passwd_exp_warn_period;
 
 	g_object_notify (G_OBJECT (settings), "use-passwd-exp-warn-period");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]