diff options
author | Not Zed <NotZed@Ximian.com> | 2005-06-08 13:02:16 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-06-08 13:02:16 +0800 |
commit | c467b293c8b8c450f1cd8384a55dc989063f16f9 (patch) | |
tree | 134ac60b70ce68a68115c7e70e2ece860ec9d2a3 /mail | |
parent | 0b323d4e6e664a6c0f24f5ffa1bff2d8d08ceecf (diff) | |
download | gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar.gz gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar.bz2 gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar.lz gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar.xz gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.tar.zst gsoc2013-evolution-c467b293c8b8c450f1cd8384a55dc989063f16f9.zip |
make this run a timeout so we don't update too often and suck loads of cpu
2005-06-08 Not Zed <NotZed@Ximian.com>
* mail-component.c (view_changed_cb): make this run a timeout so
we don't update too often and suck loads of cpu time.
svn path=/trunk/; revision=29471
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/mail-component.c | 40 |
2 files changed, 44 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4c1fea8bc1..48845ae2ad 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2005-06-08 Not Zed <NotZed@Ximian.com> + + * mail-component.c (view_changed_cb): make this run a timeout so + we don't update too often and suck loads of cpu time. + 2005-06-07 Andre Klapper <9016009@gmx.de> * mail.error.xml: Fixing typo (bug 306151) diff --git a/mail/mail-component.c b/mail/mail-component.c index e6d77bba9d..a63fe06ff3 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -487,7 +487,7 @@ view_on_url (GObject *emitter, const char *url, const char *nice_url, MailCompon } static void -view_changed_cb(EMFolderView *emfv, EInfoLabel *el) +view_changed(EMFolderView *emfv, EInfoLabel *el) { if (emfv->folder) { char *name; @@ -559,6 +559,42 @@ view_changed_cb(EMFolderView *emfv, EInfoLabel *el) } } +static int +view_changed_timeout(void *d) +{ + EInfoLabel *el = d; + EMFolderView *emfv = g_object_get_data((GObject *)el, "folderview"); + + view_changed(emfv, el); + + g_object_set_data((GObject *)emfv, "view-changed-timeout", NULL); + + g_object_unref(el); + g_object_unref(emfv); + + return 0; +} + +static void +view_changed_cb(EMFolderView *emfv, EInfoLabel *el) +{ + void *v; + + /* This can get called 3 times every cursor move, so + we don't need to/want to run it immediately */ + + /* NB: we should have a 'view' struct/object to manage this crap, but this'll do for now */ + v = g_object_get_data((GObject *)emfv, "view-changed-timeout"); + if (v) { + g_source_remove(GPOINTER_TO_INT(v)); + } else { + g_object_ref(emfv); + g_object_ref(el); + } + + g_object_set_data((GObject *)emfv, "view-changed-timeout", GINT_TO_POINTER(g_timeout_add(250, view_changed_timeout, el))); +} + /* Evolution::Component CORBA methods. */ static void @@ -630,6 +666,8 @@ impl_createControls (PortableServer_Servant servant, g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), info); g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), info); + + g_object_set_data((GObject*)info, "folderview", view_widget); } static CORBA_boolean |