diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-09-20 02:54:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-09-20 02:54:09 +0800 |
commit | 5f1b22f46d1a85ce05923835324a49cf076ef93f (patch) | |
tree | 51e8d6a797b263c308c65386115aec6ebe69f2dc | |
parent | 46608598c6d5e4e51cd709bff2db934557b3628e (diff) | |
download | gsoc2013-evolution-5f1b22f46d1a85ce05923835324a49cf076ef93f.tar.gz gsoc2013-evolution-5f1b22f46d1a85ce05923835324a49cf076ef93f.tar.zst gsoc2013-evolution-5f1b22f46d1a85ce05923835324a49cf076ef93f.zip |
Fix for bug #48618.
2003-09-19 Jeffrey Stedfast <fejj@ximian.com>
Fix for bug #48618.
* em-folder-view.c (emfv_list_message_selected): See if we have
already loaded the message uid that has just been selected, if so
- don't bother re-loading it.
(emfv_list_done_message_selected): Update loaded_uid and
loading_uid.
svn path=/trunk/; revision=22628
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/em-folder-view.c | 51 | ||||
-rw-r--r-- | mail/em-folder-view.h | 2 | ||||
-rw-r--r-- | mail/message-list.c | 1 |
4 files changed, 55 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ba8f027510..5be75e2f93 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2003-09-19 Jeffrey Stedfast <fejj@ximian.com> + + Fix for bug #48618. + + * em-folder-view.c (emfv_list_message_selected): See if we have + already loaded the message uid that has just been selected, if so + - don't bother re-loading it. + (emfv_list_done_message_selected): Update loaded_uid and + loading_uid. + 2003-09-18 Radek Doulik <rodo@ximian.com> * em-format-html.c (efh_init): use gtkhtml's blocking diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index d2e6ba629f..c30632cfc7 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -106,7 +106,10 @@ static const EMFolderViewEnable emfv_enable_map[]; struct _EMFolderViewPrivate { guint seen_id; guint setting_notify_id; - + + char *loaded_uid; + char *loading_uid; + CamelObjectHookID folder_changed_id; GtkWidget *invisible; @@ -176,7 +179,10 @@ 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); @@ -1583,6 +1589,14 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM { 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); if (emfv->priv->seen_id) @@ -1591,11 +1605,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 { @@ -1608,12 +1622,35 @@ 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) + 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; + } + + 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 + } else { + g_free (emfv->priv->loaded_uid); + emfv->priv->loaded_uid = NULL; + + g_free (emfv->priv->loading_uid); + emfv->priv->loading_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); diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 284de69c1b..080b19eb6a 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -74,7 +74,7 @@ struct _EMFolderView { struct _BonoboUIComponent *uic; /* if we're active, this will be set */ GSList *enable_map; /* bonobo menu enable map, entries are 0-terminated EMFolderViewEnable arryas TODO: should this be on class? */ - + int mark_seen_timeout; /* local copy of gconf stuff */ int mark_seen:1; int preview_active:1; /* is preview being used */ diff --git a/mail/message-list.c b/mail/message-list.c index a462f412fb..8398518810 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -2658,7 +2658,6 @@ on_selection_changed_cmd(ETree *tree, MessageList *ml) message_list_free_uids(ml, uids); gtk_selection_owner_set(NULL, GDK_SELECTION_PRIMARY, gtk_get_current_event_time()); } - } static gint |