diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-06-30 07:05:22 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-06-30 07:05:22 +0000 |
commit | 4a8036cd561af3db6578dba40e79c4e39940fbde (patch) | |
tree | eeb13629619ea289a01acaeeb2145deaaaad49f7 /src | |
parent | 6bcb771eafbef0bb433d13b0411ba101ea94aac7 (diff) |
update summary view on receiving on the fly.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2591 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/inc.c | 5 | ||||
-rw-r--r-- | src/summaryview.c | 49 | ||||
-rw-r--r-- | src/summaryview.h | 2 |
3 files changed, 55 insertions, 1 deletions
@@ -1036,12 +1036,17 @@ static gboolean hash_remove_func(gpointer key, gpointer value, gpointer data) static void inc_update_folderview(IncProgressDialog *inc_dialog, IncSession *inc_session) { + MainWindow *mainwin; + if (g_hash_table_size(inc_session->tmp_folder_table) > 0) { folderview_update_item_foreach(inc_session->tmp_folder_table, FALSE); g_hash_table_foreach_remove(inc_session->tmp_folder_table, hash_remove_func, NULL); } + + mainwin = main_window_get(); + summary_show_queued_msgs(mainwin->summaryview); } static void inc_progress_dialog_update_periodic(IncProgressDialog *inc_dialog, diff --git a/src/summaryview.c b/src/summaryview.c index 49742199..b705fbd9 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -197,6 +197,9 @@ static void summary_update_status (SummaryView *summaryview); /* display functions */ static void summary_status_show (SummaryView *summaryview); +static void summary_set_row (SummaryView *summaryview, + GtkTreeIter *iter, + MsgInfo *msginfo); static void summary_set_tree_model_from_list (SummaryView *summaryview, GSList *mlist); @@ -1020,6 +1023,50 @@ void summary_clear_all(SummaryView *summaryview) summary_status_show(summaryview); } +void summary_show_queued_msgs(SummaryView *summaryview) +{ + FolderItem *item; + GSList *qlist, *cur; + MsgInfo *msginfo; + GtkTreeStore *store = GTK_TREE_STORE(summaryview->store); + GtkTreeIter iter; + + if (summary_is_locked(summaryview)) + return; + + item = summaryview->folder_item; + if (!item || !item->path || !item->cache_queue || + item->stype == F_VIRTUAL) + return; + + debug_print("summary_show_queued_msgs: appending queued messages to summary (%s)\n", item->path); + + qlist = g_slist_reverse(item->cache_queue); + item->cache_queue = NULL; + if (item->mark_queue) { + procmsg_flaginfo_list_free(item->mark_queue); + item->mark_queue = NULL; + } + + for (cur = qlist; cur != NULL; cur = cur->next) { + msginfo = (MsgInfo *)cur->data; + + debug_print("summary_show_queued_msgs: appending msg %u\n", + msginfo->msgnum); + msginfo->folder = item; + gtk_tree_store_append(store, &iter, NULL); + summary_set_row(summaryview, &iter, msginfo); + + summaryview->total_size += msginfo->size; + } + + summaryview->all_mlist = g_slist_concat(summaryview->all_mlist, qlist); + + item->cache_dirty = TRUE; + + debug_print("summary_show_queued_msgs: done.\n"); +} + void summary_lock(SummaryView *summaryview) { summaryview->lock_count++; @@ -2501,7 +2548,7 @@ gint summary_write_cache(SummaryView *summaryview) for (cur = summaryview->all_mlist; cur != NULL; cur = cur->next) { MsgInfo *msginfo = (MsgInfo *)cur->data; - if (msginfo->folder->mark_queue != NULL) { + if (msginfo->folder && msginfo->folder->mark_queue != NULL) { MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW); } if (fps.cache_fp) diff --git a/src/summaryview.h b/src/summaryview.h index 230318f0..fdc1d9b7 100644 --- a/src/summaryview.h +++ b/src/summaryview.h @@ -168,6 +168,8 @@ gboolean summary_show (SummaryView *summaryview, void summary_clear_list (SummaryView *summaryview); void summary_clear_all (SummaryView *summaryview); +void summary_show_queued_msgs (SummaryView *summaryview); + void summary_lock (SummaryView *summaryview); void summary_unlock (SummaryView *summaryview); gboolean summary_is_locked (SummaryView *summaryview); |