diff options
author | Milan Crha <mcrha@redhat.com> | 2014-06-05 01:46:25 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-06-05 01:46:25 +0800 |
commit | 2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f (patch) | |
tree | fd60a103158c3cfdbbce197feca07d7fea008a3d /mail | |
parent | 668745ff49d8f312c7d419a691cdab3e128ded06 (diff) | |
download | gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar.gz gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar.bz2 gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar.lz gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar.xz gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.tar.zst gsoc2013-evolution-2f3fbdd6c6ff42a6c71ebe1d1d78108affe59d0f.zip |
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.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-config-assistant.c | 4 | ||||
-rw-r--r-- | mail/e-mail-display.c | 81 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 2 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 2 | ||||
-rw-r--r-- | mail/em-filter-rule.c | 2 | ||||
-rw-r--r-- | mail/em-subscription-editor.c | 2 |
6 files changed, 56 insertions, 37 deletions
diff --git a/mail/e-mail-config-assistant.c b/mail/e-mail-config-assistant.c index 5688494161..e1a4add3ed 100644 --- a/mail/e-mail-config-assistant.c +++ b/mail/e-mail-config-assistant.c @@ -733,7 +733,7 @@ mail_config_assistant_constructed (GObject *object) page, "email-address", G_BINDING_SYNC_CREATE); - g_signal_connect ( + e_signal_connect_notify ( page, "notify::active-backend", G_CALLBACK (mail_config_assistant_notify_account_backend), assistant); @@ -816,7 +816,7 @@ mail_config_assistant_constructed (GObject *object) page, "email-address", G_BINDING_SYNC_CREATE); - g_signal_connect ( + e_signal_connect_notify ( page, "notify::active-backend", G_CALLBACK (mail_config_assistant_notify_transport_backend), assistant); diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 837c9b3892..fe91faab9a 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -606,18 +606,18 @@ mail_display_plugin_widget_requested (WebKitWebView *web_view, /* When EAttachmentBar is expanded/collapsed it does not * emit size-allocate signal despite it changes it's height. */ - g_signal_connect ( + e_signal_connect_notify ( widget, "notify::expanded", G_CALLBACK (mail_display_plugin_widget_resize), display); - g_signal_connect ( + e_signal_connect_notify ( widget, "notify::active-view", G_CALLBACK (mail_display_plugin_widget_resize), display); /* Always hide an attachment bar without attachments */ store = e_attachment_bar_get_store (E_ATTACHMENT_BAR (widget)); - g_signal_connect ( + e_signal_connect_notify ( store, "notify::num-attachments", G_CALLBACK (mail_display_attachment_count_changed), box); @@ -668,11 +668,11 @@ mail_display_plugin_widget_requested (WebKitWebView *web_view, /* Show/hide the attachment when the EAttachmentButton * is expanded/collapsed or shown/hidden. */ - g_signal_connect ( + e_signal_connect_notify ( widget, "notify::expanded", G_CALLBACK (attachment_button_expanded), display); - g_signal_connect ( + e_signal_connect_notify ( widget, "notify::visible", G_CALLBACK (attachment_button_expanded), display); @@ -994,7 +994,7 @@ mail_display_frame_created (WebKitWebView *web_view, d (printf ("Frame %s created!\n", webkit_web_frame_get_name (frame))); /* Call bind_func of all parts written in this frame */ - g_signal_connect ( + e_signal_connect_notify ( frame, "notify::load-status", G_CALLBACK (mail_parts_bind_dom), NULL); } @@ -1523,7 +1523,7 @@ e_mail_display_init (EMailDisplay *display) g_signal_connect ( display, "frame-created", G_CALLBACK (mail_display_frame_created), NULL); - g_signal_connect ( + e_signal_connect_notify ( display, "notify::uri", G_CALLBACK (mail_display_uri_changed), NULL); g_signal_connect ( @@ -1547,7 +1547,7 @@ e_mail_display_init (EMailDisplay *display) e_web_view_update_fonts (E_WEB_VIEW (display)); main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (display)); - g_signal_connect ( + e_signal_connect_notify ( main_frame, "notify::load-status", G_CALLBACK (mail_parts_bind_dom), NULL); @@ -1641,33 +1641,52 @@ e_mail_display_set_mode (EMailDisplay *display, display->priv->formatter = formatter; mail_display_update_formatter_colors (display); - g_signal_connect ( + e_signal_connect_notify ( formatter, "notify::image-loading-policy", G_CALLBACK (formatter_image_loading_policy_changed_cb), display); - g_object_connect ( - formatter, - "swapped-object-signal::notify::charset", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::image-loading-policy", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::mark-citations", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::show-sender-photo", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::show-real-date", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::animate-images", - G_CALLBACK (e_mail_display_reload), display, - "swapped-object-signal::notify::body-color", - G_CALLBACK (e_mail_display_update_colors), display, - "swapped-object-signal::notify::citation-color", - G_CALLBACK (e_mail_display_update_colors), display, - "swapped-object-signal::notify::frame-color", - G_CALLBACK (e_mail_display_update_colors), display, - "swapped-object-signal::notify::header-color", - G_CALLBACK (e_mail_display_update_colors), display, + e_signal_connect_notify_object ( + formatter, "notify::charset", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::image-loading-policy", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::mark-citations", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::show-sender-photo", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::show-real-date", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::animate-images", + G_CALLBACK (e_mail_display_reload), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::body-color", + G_CALLBACK (e_mail_display_update_colors), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::citation-color", + G_CALLBACK (e_mail_display_update_colors), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::frame-color", + G_CALLBACK (e_mail_display_update_colors), display, G_CONNECT_SWAPPED); + + e_signal_connect_notify_object ( + formatter, "notify::header-color", + G_CALLBACK (e_mail_display_update_colors), display, G_CONNECT_SWAPPED); + + g_object_connect (formatter, "swapped-object-signal::need-redraw", G_CALLBACK (e_mail_display_reload), display, NULL); diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index 4c4c6b62eb..5d7cb9d67d 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -1059,7 +1059,7 @@ e_mail_paned_view_init (EMailPanedView *view) { view->priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view); - g_signal_connect ( + e_signal_connect_notify ( view, "notify::group-by-threads", G_CALLBACK (mail_paned_view_notify_group_by_threads_cb), NULL); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 5e2f951feb..cbc595a042 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -3972,7 +3972,7 @@ connect_signals: display, "key-press-event", G_CALLBACK (mail_reader_key_press_event_cb), reader); - g_signal_connect_swapped ( + e_signal_connect_notify_swapped ( display, "notify::load-status", G_CALLBACK (mail_reader_load_status_changed_cb), reader); diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index 9bfb032a7a..e13e1f95f0 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -659,7 +659,7 @@ get_widget (EFilterRule *fr, g_object_set_data (G_OBJECT (add), "scrolled-window", scrolledwindow); - g_signal_connect ( + e_signal_connect_notify ( vadj, "notify::upper", G_CALLBACK (ensure_scrolled_height_cb), scrolledwindow); diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index 2d816c7c9e..9a84439bd3 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -1798,7 +1798,7 @@ em_subscription_editor_init (EMSubscriptionEditor *editor) G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - g_signal_connect ( + e_signal_connect_notify ( widget, "notify::sensitive", G_CALLBACK (emse_notebook_sensitive_changed_cb), editor); |