aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-view.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-03-17 10:18:01 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-03-17 10:18:01 +0800
commit47a3fd051381ceb10dceaa4b68d22decd2207f21 (patch)
treecdbce990188b83d1c995a6fd16f0947a1307e4bb /mail/em-folder-view.c
parentd521c569a074cd2a55d6519da0f865cac3b9486b (diff)
downloadgsoc2013-evolution-47a3fd051381ceb10dceaa4b68d22decd2207f21.tar.gz
gsoc2013-evolution-47a3fd051381ceb10dceaa4b68d22decd2207f21.tar.zst
gsoc2013-evolution-47a3fd051381ceb10dceaa4b68d22decd2207f21.zip
** See bug #73363
2005-03-16 Not Zed <NotZed@Ximian.com> ** See bug #73363 * em-folder-view.c (emfv_list_message_selected): insert a timeout before loading the message. (emfv_message_selected_timeout): handle the timeout, start loading the message. (emfv_set_folder, emfv_destroy): cleanups for above. svn path=/trunk/; revision=29049
Diffstat (limited to 'mail/em-folder-view.c')
-rw-r--r--mail/em-folder-view.c64
1 files changed, 50 insertions, 14 deletions
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 9ceb6fee25..2aed322adc 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -132,6 +132,7 @@ static const EMFolderViewEnable emfv_enable_map[];
struct _EMFolderViewPrivate {
guint seen_id;
guint setting_notify_id;
+ guint selected_id;
int nomarkseen:1;
int destroyed:1;
@@ -140,6 +141,8 @@ struct _EMFolderViewPrivate {
GalViewInstance *view_instance;
GalViewMenus *view_menus;
+
+ char *selected_uid;
};
static GtkVBoxClass *emfv_parent;
@@ -255,6 +258,14 @@ emfv_destroy (GtkObject *o)
p->invisible = NULL;
}
+ if (p->selected_id != 0) {
+ g_source_remove(p->selected_id);
+ p->selected_id = 0;
+ }
+
+ g_free(p->selected_uid);
+ p->selected_uid = NULL;
+
emfv->preview = NULL;
emfv->list = NULL;
emfv->preview_active = FALSE;
@@ -556,6 +567,9 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
if (folder == emfv->folder)
return;
+
+ if (emfv->priv->selected_id)
+ g_source_remove(emfv->priv->selected_id);
if (emfv->preview)
em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL);
@@ -2137,24 +2151,46 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM
g_object_unref (emfv);
}
+static gboolean
+emfv_message_selected_timeout(void *data)
+{
+ EMFolderView *emfv = data;
+
+ if (emfv->priv->selected_uid) {
+ if (emfv->displayed_uid == NULL || strcmp(emfv->displayed_uid, emfv->priv->selected_uid) != 0) {
+ g_free(emfv->displayed_uid);
+ emfv->displayed_uid = emfv->priv->selected_uid;
+ emfv->priv->selected_uid = NULL;
+ g_object_ref (emfv);
+ /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */
+ mail_get_message(emfv->folder, emfv->displayed_uid, emfv_list_done_message_selected, emfv, mail_thread_queued);
+ } else {
+ g_free(emfv->priv->selected_uid);
+ emfv->priv->selected_uid = NULL;
+ }
+ } else {
+ g_free(emfv->displayed_uid);
+ emfv->displayed_uid = NULL;
+ em_format_format((EMFormat *)emfv->preview, NULL, NULL, NULL);
+ emfv->priv->nomarkseen = FALSE;
+ }
+
+ emfv->priv->selected_id = 0;
+
+ return FALSE;
+}
+
static void
emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv)
{
if (emfv->preview_active) {
- if (uid) {
- if (emfv->displayed_uid == NULL || strcmp(emfv->displayed_uid, uid) != 0) {
- g_free(emfv->displayed_uid);
- emfv->displayed_uid = g_strdup(uid);
- g_object_ref (emfv);
- /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */
- mail_get_message(emfv->folder, uid, emfv_list_done_message_selected, emfv, mail_thread_queued);
- }
- } else {
- g_free(emfv->displayed_uid);
- emfv->displayed_uid = NULL;
- em_format_format((EMFormat *)emfv->preview, NULL, NULL, NULL);
- emfv->priv->nomarkseen = FALSE;
- }
+ if (emfv->priv->selected_id != 0)
+ g_source_remove(emfv->priv->selected_id);
+
+ emfv->priv->selected_id = g_timeout_add(100, emfv_message_selected_timeout, emfv);
+
+ g_free(emfv->priv->selected_uid);
+ emfv->priv->selected_uid = g_strdup(uid);
}
emfv_enable_menus(emfv);