From 2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 4 Jun 2014 19:46:25 +0200 Subject: Ignore false GObject property change notifications This is related to bug 698275, which did not cover all cases. The problem here is that the dconf can in certain situation claim that everything changed (path "/" changed), which GSettingsBinding propagates to a GObject property unconditionally and GObject's property setter (g_object_set_property()) also notifies about the property change unconditionally, despite the real descendant property setter properly checks for the value change. After all these false notifications a callback on "notify" signal is called and possibly an expensive operation is run. Checking whether the value really changed helps in performance, for which were added new e-util functions: e_signal_connect_notify() e_signal_connect_notify_after() e_signal_connect_notify_swapped() e_signal_connect_notify_object() which have the same prototype as their GLib counterparts, but they allow only "notify::..." signals and they test whether the value really changed before they call the registered callback. --- e-util/e-interval-chooser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'e-util/e-interval-chooser.c') diff --git a/e-util/e-interval-chooser.c b/e-util/e-interval-chooser.c index 5e27471942..df6805cd3d 100644 --- a/e-util/e-interval-chooser.c +++ b/e-util/e-interval-chooser.c @@ -21,6 +21,7 @@ #include #include "e-util-enums.h" +#include "e-misc-utils.h" #define E_INTERVAL_CHOOSER_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -129,7 +130,7 @@ e_interval_chooser_init (EIntervalChooser *chooser) chooser->priv->spin_button = GTK_SPIN_BUTTON (widget); gtk_widget_show (widget); - g_signal_connect_swapped ( + e_signal_connect_notify_swapped ( widget, "notify::value", G_CALLBACK (interval_chooser_notify_interval), chooser); @@ -144,7 +145,7 @@ e_interval_chooser_init (EIntervalChooser *chooser) chooser->priv->combo_box = GTK_COMBO_BOX (widget); gtk_widget_show (widget); - g_signal_connect_swapped ( + e_signal_connect_notify_swapped ( widget, "notify::active", G_CALLBACK (interval_chooser_notify_interval), chooser); } -- cgit v1.2.3