diff options
Diffstat (limited to 'mail/em-folder-view.c')
-rw-r--r-- | mail/em-folder-view.c | 58 |
1 files changed, 15 insertions, 43 deletions
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index cbe1fc913a..29a2b51ccd 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -106,9 +106,8 @@ static const EMFolderViewEnable emfv_enable_map[]; struct _EMFolderViewPrivate { guint seen_id; guint setting_notify_id; - - char *loaded_uid; - char *loading_uid; + + char *displayed_uid; /* only used to stop re-loads, don't use it to represent any selection state */ CamelObjectHookID folder_changed_id; @@ -179,10 +178,7 @@ emfv_finalise(GObject *o) g_slist_free(emfv->ui_files); g_slist_free(emfv->enable_map); - - g_free (p->loaded_uid); - g_free (p->loading_uid); - + g_free(p); ((GObjectClass *)emfv_parent)->finalize(o); @@ -1588,16 +1584,8 @@ static void emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) { EMFolderView *emfv = data; - - g_free (emfv->priv->loaded_uid); - if (emfv->priv->loading_uid && !strcmp (emfv->priv->loading_uid, uid)) { - emfv->priv->loaded_uid = emfv->priv->loading_uid; - emfv->priv->loading_uid = NULL; - } else { - emfv->priv->loaded_uid = g_strdup (uid); - } - - em_format_format((EMFormat *) emfv->preview, (struct _CamelMedium *)msg); + + em_format_format((EMFormat *)emfv->preview, (struct _CamelMedium *)msg); if (emfv->priv->seen_id) g_source_remove(emfv->priv->seen_id); @@ -1605,11 +1593,11 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM if (msg && emfv->mark_seen) { if (emfv->mark_seen_timeout > 0) { struct mst_t *mst; - + mst = g_new (struct mst_t, 1); mst->emfv = emfv; mst->uid = g_strdup (uid); - + emfv->priv->seen_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, emfv->mark_seen_timeout, (GSourceFunc)do_mark_seen, mst, (GDestroyNotify)mst_free); } else { @@ -1622,35 +1610,19 @@ static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) { /* FIXME: ui stuff based on messageinfo, if available */ + if (emfv->preview_active) { - if (uid != NULL) { - if (emfv->priv->loading_uid != NULL) { - if (!strcmp (emfv->priv->loading_uid, uid)) - return; - } else if (emfv->priv->loaded_uid != NULL) { - if (!strcmp (emfv->priv->loaded_uid, uid)) - return; + if (uid) { + if (emfv->priv->displayed_uid == NULL || strcmp(emfv->priv->displayed_uid, uid) != 0) { + g_free(emfv->priv->displayed_uid); + emfv->priv->displayed_uid = g_strdup(uid); + mail_get_message(emfv->folder, uid, emfv_list_done_message_selected, emfv, mail_thread_new); } - - g_free (emfv->priv->loading_uid); - emfv->priv->loading_uid = g_strdup (uid); - - mail_get_message(emfv->folder, uid, emfv_list_done_message_selected, emfv, mail_thread_new); } else { - g_free (emfv->priv->loaded_uid); - emfv->priv->loaded_uid = NULL; - - g_free (emfv->priv->loading_uid); - emfv->priv->loading_uid = NULL; - + g_free(emfv->priv->displayed_uid); + emfv->priv->displayed_uid = NULL; em_format_format((EMFormat *)emfv->preview, NULL); } - } else { - g_free (emfv->priv->loaded_uid); - emfv->priv->loaded_uid = NULL; - - g_free (emfv->priv->loading_uid); - emfv->priv->loading_uid = NULL; } emfv_enable_menus(emfv); |