From 6c05b09be16ac8eceb17653c3c26c0c6f963ef10 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 18 Jun 2012 15:34:33 +0200 Subject: Do not call g_object_notify() when property didn't change --- modules/addressbook/e-book-shell-content.c | 9 ++++++ modules/bogofilter/evolution-bogofilter.c | 3 ++ modules/book-config-ldap/e-source-ldap.c | 35 +++++++++++++++++++++-- modules/cal-config-contacts/e-source-contacts.c | 3 ++ modules/cal-config-weather/e-source-weather.c | 14 ++++++++- modules/calendar/e-calendar-preferences.c | 2 +- modules/calendar/e-memo-shell-content.c | 6 ++++ modules/calendar/e-task-shell-content.c | 6 ++++ modules/calendar/e-task-shell-view.c | 3 ++ modules/itip-formatter/e-source-conflict-search.c | 3 ++ modules/spamassassin/evolution-spamassassin.c | 15 ++++++++++ 11 files changed, 94 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index 05f8bd8d03..d2ce13f099 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -121,6 +121,9 @@ static void book_shell_content_set_orientation (EBookShellContent *book_shell_content, GtkOrientation orientation) { + if (book_shell_content->priv->orientation == orientation) + return; + book_shell_content->priv->orientation = orientation; g_object_notify (G_OBJECT (book_shell_content), "orientation"); @@ -700,6 +703,9 @@ e_book_shell_content_set_preview_visible (EBookShellContent *book_shell_content, { g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content)); + if ((book_shell_content->priv->preview_visible ? 1 : 0) == (preview_visible ? 1 : 0)) + return; + book_shell_content->priv->preview_visible = preview_visible; g_object_notify (G_OBJECT (book_shell_content), "preview-visible"); @@ -720,6 +726,9 @@ e_book_shell_content_set_preview_show_maps (EBookShellContent *book_shell_conten { g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content)); + if ((book_shell_content->priv->preview_show_maps ? 1 : 0) == (show_maps ? 1 : 0)) + return; + book_shell_content->priv->preview_show_maps = show_maps; g_object_notify (G_OBJECT (book_shell_content), "preview-show-maps"); diff --git a/modules/bogofilter/evolution-bogofilter.c b/modules/bogofilter/evolution-bogofilter.c index 7d00888565..203142ace4 100644 --- a/modules/bogofilter/evolution-bogofilter.c +++ b/modules/bogofilter/evolution-bogofilter.c @@ -257,6 +257,9 @@ static void bogofilter_set_convert_to_unicode (EBogofilter *extension, gboolean convert_to_unicode) { + if ((extension->convert_to_unicode ? 1 : 0) == (convert_to_unicode ? 1 : 0)) + return; + extension->convert_to_unicode = convert_to_unicode; g_object_notify (G_OBJECT (extension), "convert-to-unicode"); diff --git a/modules/book-config-ldap/e-source-ldap.c b/modules/book-config-ldap/e-source-ldap.c index 88ee6bc634..a491409029 100644 --- a/modules/book-config-ldap/e-source-ldap.c +++ b/modules/book-config-ldap/e-source-ldap.c @@ -463,6 +463,9 @@ e_source_ldap_set_authentication (ESourceLDAP *extension, { g_return_if_fail (E_IS_SOURCE_LDAP (extension)); + if (extension->priv->authentication == authentication) + return; + extension->priv->authentication = authentication; g_object_notify (G_OBJECT (extension), "authentication"); @@ -482,6 +485,9 @@ e_source_ldap_set_can_browse (ESourceLDAP *extension, { g_return_if_fail (E_IS_SOURCE_LDAP (extension)); + if ((extension->priv->can_browse ? 1 : 0) == (can_browse ? 1 : 0)) + return; + extension->priv->can_browse = can_browse; g_object_notify (G_OBJECT (extension), "can-browse"); @@ -518,6 +524,7 @@ e_source_ldap_set_filter (ESourceLDAP *extension, const gchar *filter) { gboolean needs_parens; + gchar *new_filter; g_return_if_fail (E_IS_SOURCE_LDAP (extension)); @@ -528,11 +535,19 @@ e_source_ldap_set_filter (ESourceLDAP *extension, g_mutex_lock (extension->priv->property_lock); - g_free (extension->priv->filter); if (needs_parens) - extension->priv->filter = g_strdup_printf ("(%s)", filter); + new_filter = g_strdup_printf ("(%s)", filter); else - extension->priv->filter = g_strdup (filter); + new_filter = g_strdup (filter); + + if (g_strcmp0 (extension->priv->filter, new_filter) == 0) { + g_mutex_unlock (extension->priv->property_lock); + g_free (new_filter); + return; + } + + g_free (extension->priv->filter); + extension->priv->filter = new_filter; g_mutex_unlock (extension->priv->property_lock); @@ -553,6 +568,9 @@ e_source_ldap_set_limit (ESourceLDAP *extension, { g_return_if_fail (E_IS_SOURCE_LDAP (extension)); + if (extension->priv->limit == limit) + return; + extension->priv->limit = limit; g_object_notify (G_OBJECT (extension), "limit"); @@ -592,6 +610,11 @@ e_source_ldap_set_root_dn (ESourceLDAP *extension, g_mutex_lock (extension->priv->property_lock); + if (g_strcmp0 (extension->priv->root_dn, root_dn) == 0) { + g_mutex_unlock (extension->priv->property_lock); + return; + } + g_free (extension->priv->root_dn); extension->priv->root_dn = e_util_strdup_strip (root_dn); @@ -614,6 +637,9 @@ e_source_ldap_set_scope (ESourceLDAP *extension, { g_return_if_fail (E_IS_SOURCE_LDAP (extension)); + if (extension->priv->scope == scope) + return; + extension->priv->scope = scope; g_object_notify (G_OBJECT (extension), "scope"); @@ -633,6 +659,9 @@ e_source_ldap_set_security (ESourceLDAP *extension, { g_return_if_fail (E_IS_SOURCE_LDAP (extension)); + if (extension->priv->security == security) + return; + extension->priv->security = security; g_object_notify (G_OBJECT (extension), "security"); diff --git a/modules/cal-config-contacts/e-source-contacts.c b/modules/cal-config-contacts/e-source-contacts.c index 32ba589c71..1d2040cd72 100644 --- a/modules/cal-config-contacts/e-source-contacts.c +++ b/modules/cal-config-contacts/e-source-contacts.c @@ -133,6 +133,9 @@ e_source_contacts_set_include_me (ESourceContacts *extension, { g_return_if_fail (E_IS_SOURCE_CONTACTS (extension)); + if ((extension->priv->include_me ? 1 : 0) == (include_me ? 1 : 0)) + return; + extension->priv->include_me = include_me; g_object_notify (G_OBJECT (extension), "include-me"); diff --git a/modules/cal-config-weather/e-source-weather.c b/modules/cal-config-weather/e-source-weather.c index 63db1bc14b..3440224173 100644 --- a/modules/cal-config-weather/e-source-weather.c +++ b/modules/cal-config-weather/e-source-weather.c @@ -212,12 +212,21 @@ void e_source_weather_set_location (ESourceWeather *extension, const gchar *location) { + gchar *new_location; + g_return_if_fail (E_IS_SOURCE_WEATHER (extension)); g_mutex_lock (extension->priv->property_lock); + new_location = e_util_strdup_strip (location); + if (g_strcmp0 (extension->priv->location, new_location) == 0) { + g_mutex_unlock (extension->priv->property_lock); + g_free (new_location); + return; + } + g_free (extension->priv->location); - extension->priv->location = e_util_strdup_strip (location); + extension->priv->location = new_location; g_mutex_unlock (extension->priv->property_lock); @@ -238,6 +247,9 @@ e_source_weather_set_units (ESourceWeather *extension, { g_return_if_fail (E_IS_SOURCE_WEATHER (extension)); + if (extension->priv->units == units) + return; + extension->priv->units = units; g_object_notify (G_OBJECT (extension), "units"); diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c index 8c5c2796c4..a1655fa324 100644 --- a/modules/calendar/e-calendar-preferences.c +++ b/modules/calendar/e-calendar-preferences.c @@ -522,7 +522,7 @@ calendar_preferences_construct (ECalendarPreferences *prefs, g_signal_connect ( shell_settings, "notify::cal-use-system-timezone", G_CALLBACK (update_system_tz_widgets), prefs); - g_object_notify (G_OBJECT (shell_settings), "cal-use-system-timezone"); + update_system_tz_widgets (shell_settings, NULL, prefs); widget = e_builder_get_widget (prefs->builder, "timezone"); g_object_bind_property ( diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index ca1c1d8f5d..ab9f3180be 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -314,6 +314,9 @@ static void memo_shell_content_set_orientation (EMemoShellContent *memo_shell_content, GtkOrientation orientation) { + if (memo_shell_content->priv->orientation == orientation) + return; + memo_shell_content->priv->orientation = orientation; g_object_notify (G_OBJECT (memo_shell_content), "orientation"); @@ -742,6 +745,9 @@ e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content, { g_return_if_fail (E_IS_MEMO_SHELL_CONTENT (memo_shell_content)); + if ((memo_shell_content->priv->preview_visible ? 1 : 0) == (preview_visible ? 1 : 0)) + return; + memo_shell_content->priv->preview_visible = preview_visible; if (preview_visible && memo_shell_content->priv->preview_pane) { diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 2be1153775..3fe5f68f51 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -314,6 +314,9 @@ static void task_shell_content_set_orientation (ETaskShellContent *task_shell_content, GtkOrientation orientation) { + if (task_shell_content->priv->orientation == orientation) + return; + task_shell_content->priv->orientation = orientation; g_object_notify (G_OBJECT (task_shell_content), "orientation"); @@ -767,6 +770,9 @@ e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content, { g_return_if_fail (E_IS_TASK_SHELL_CONTENT (task_shell_content)); + if ((task_shell_content->priv->preview_visible ? 1 : 0) == (preview_visible ? 1 : 0)) + return; + task_shell_content->priv->preview_visible = preview_visible; if (preview_visible && task_shell_content->priv->preview_pane) { diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index f7028f87d3..4a466b7be7 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -526,6 +526,9 @@ e_task_shell_view_set_confirm_purge (ETaskShellView *task_shell_view, { g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view)); + if ((task_shell_view->priv->confirm_purge ? 1 : 0) == (confirm_purge ? 1 : 0)) + return; + task_shell_view->priv->confirm_purge = confirm_purge; g_object_notify (G_OBJECT (task_shell_view), "confirm-purge"); diff --git a/modules/itip-formatter/e-source-conflict-search.c b/modules/itip-formatter/e-source-conflict-search.c index c2f5eb6e99..4319b572cc 100644 --- a/modules/itip-formatter/e-source-conflict-search.c +++ b/modules/itip-formatter/e-source-conflict-search.c @@ -144,6 +144,9 @@ e_source_conflict_search_set_include_me (ESourceConflictSearch *extension, { g_return_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension)); + if ((extension->priv->include_me ? 1 : 0) == (include_me ? 1 : 0)) + return; + extension->priv->include_me = include_me; g_object_notify (G_OBJECT (extension), "include-me"); diff --git a/modules/spamassassin/evolution-spamassassin.c b/modules/spamassassin/evolution-spamassassin.c index 275e921398..0a6330e264 100644 --- a/modules/spamassassin/evolution-spamassassin.c +++ b/modules/spamassassin/evolution-spamassassin.c @@ -339,6 +339,9 @@ static void spam_assassin_set_local_only (ESpamAssassin *extension, gboolean local_only) { + if ((extension->local_only ? 1 : 0) == (local_only ? 1 : 0)) + return; + extension->local_only = local_only; g_object_notify (G_OBJECT (extension), "local-only"); @@ -354,6 +357,9 @@ static void spam_assassin_set_spamc_binary (ESpamAssassin *extension, const gchar *spamc_binary) { + if (g_strcmp0 (extension->spamc_binary, spamc_binary) == 0) + return; + g_free (extension->spamc_binary); extension->spamc_binary = g_strdup (spamc_binary); @@ -370,6 +376,9 @@ static void spam_assassin_set_spamd_binary (ESpamAssassin *extension, const gchar *spamd_binary) { + if (g_strcmp0 (extension->spamd_binary, spamd_binary) == 0) + return; + g_free (extension->spamd_binary); extension->spamd_binary = g_strdup (spamd_binary); @@ -386,6 +395,9 @@ static void spam_assassin_set_socket_path (ESpamAssassin *extension, const gchar *socket_path) { + if (g_strcmp0 (extension->socket_path, socket_path) == 0) + return; + g_free (extension->socket_path); extension->socket_path = g_strdup (socket_path); @@ -402,6 +414,9 @@ static void spam_assassin_set_use_daemon (ESpamAssassin *extension, gboolean use_daemon) { + if ((extension->use_daemon ? 1 : 0) == (use_daemon ? 1 : 0)) + return; + extension->use_daemon = use_daemon; g_object_notify (G_OBJECT (extension), "use-daemon"); -- cgit v1.2.3