aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-06-19 02:00:07 +0800
committerDan Vrátil <dvratil@redhat.com>2012-06-19 16:27:05 +0800
commit2c51b159c7b30d5639202d6b60eda536d0be45e8 (patch)
tree3d45f37aaaeffeafcebcba01edcbc509fa364f9b
parent67b64140d5f429cc9bb4e8645ce9e6f9f2553162 (diff)
downloadgsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar.gz
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar.bz2
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar.lz
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar.xz
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.tar.zst
gsoc2013-evolution-2c51b159c7b30d5639202d6b60eda536d0be45e8.zip
Reduce amount or EMailDisplay reloads when displaying Preferences dialog
-rw-r--r--mail/e-mail-display.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index d3652c57c3..5a754602ab 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -71,6 +71,8 @@ struct _EMailDisplayPrivate {
GSettings *settings;
GHashTable *widgets;
+
+ guint reload_scheduled: 1;
};
enum {
@@ -1500,6 +1502,23 @@ e_mail_display_get_mode (EMailDisplay *display)
return display->priv->mode;
}
+static gboolean
+reload_display (EMailDisplay *display)
+{
+ e_mail_display_reload (display);
+ return FALSE;
+}
+
+static void
+schedule_display_reload (EMailDisplay *display)
+{
+ if (display->priv->reload_scheduled)
+ return;
+
+ g_idle_add ((GSourceFunc) reload_display, display);
+ display->priv->reload_scheduled = TRUE;
+}
+
void
e_mail_display_set_mode (EMailDisplay *display,
EMailFormatterMode mode)
@@ -1527,33 +1546,33 @@ e_mail_display_set_mode (EMailDisplay *display,
g_object_connect (formatter,
"swapped-signal::notify::charset",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::image-loading-policy",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::mark-citations",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::only-local-photos",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::show-sender-photo",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::show-real-date",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::animate-images",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::text-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::body-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::citation-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::content-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::frame-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::notify::header-color",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
"swapped-signal::need-redraw",
- G_CALLBACK (e_mail_display_reload), display,
+ G_CALLBACK (schedule_display_reload), display,
NULL);
e_mail_display_reload (display);
@@ -1681,9 +1700,13 @@ e_mail_display_reload (EMailDisplay *display)
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+ printf("Reloading EMailDisplay!\n");
+
web_view = E_WEB_VIEW (display);
uri = e_web_view_get_uri (web_view);
+ display->priv->reload_scheduled = FALSE;
+
if (!uri || !*uri)
return;
@@ -1715,6 +1738,7 @@ e_mail_display_reload (EMailDisplay *display)
g_string_free (new_uri, TRUE);
g_hash_table_destroy (table);
+
}
GtkAction *