diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-22 06:52:52 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-22 06:52:52 +0000 |
commit | ab756417b394ba20a43b6836db5e01469584df23 (patch) | |
tree | 228ee00fe732d706614bb308ff65c35d65a8f60f | |
parent | 9af6113797dc9bc40b4d46e6f7a520793d0c3621 (diff) |
summaryview.c: keep selecting row after changing thread display.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@598 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | src/summaryview.c | 86 |
3 files changed, 91 insertions, 4 deletions
@@ -1,3 +1,7 @@ +2005-09-22 + + * src/summaryview.c: keep selecting row after changing thread display. + 2005-09-21 * configure.in: removed mbs/wcs functions check. diff --git a/ChangeLog.ja b/ChangeLog.ja index 8e3a0493..f0bb4433 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,8 @@ +2005-09-22 + + * src/summaryview.c: スレッド表示を変更した後も行を選択し続ける + ようにした。 + 2005-09-21 * configure.in: mbs/wcs 関数チェックを削除。 diff --git a/src/summaryview.c b/src/summaryview.c index 9da370d1..01e2b409 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -122,6 +122,8 @@ static void summary_set_menu_sensitive (SummaryView *summaryview); static void summary_scroll_to_selected (SummaryView *summaryview, gboolean align_center); +static MsgInfo *summary_get_msginfo (SummaryView *summaryview, + GtkTreeRowReference *row); static guint summary_get_msgnum (SummaryView *summaryview, GtkTreeRowReference *row); @@ -1313,8 +1315,8 @@ static void summary_scroll_to_selected(SummaryView *summaryview, } } -static guint summary_get_msgnum(SummaryView *summaryview, - GtkTreeRowReference *row) +static MsgInfo *summary_get_msginfo(SummaryView *summaryview, + GtkTreeRowReference *row) { GtkTreeIter iter; MsgInfo *msginfo = NULL; @@ -1328,6 +1330,18 @@ static guint summary_get_msgnum(SummaryView *summaryview, gtk_tree_model_get(GTK_TREE_MODEL(summaryview->store), &iter, S_COL_MSG_INFO, &msginfo, -1); + return msginfo; +} + +static guint summary_get_msgnum(SummaryView *summaryview, + GtkTreeRowReference *row) +{ + MsgInfo *msginfo; + + msginfo = summary_get_msginfo(summaryview, row); + if (!msginfo) + return 0; + return msginfo->msgnum; } @@ -3309,6 +3323,7 @@ void summary_thread_build(SummaryView *summaryview) GtkTreeModel *model = GTK_TREE_MODEL(summaryview->store); GtkTreeStore *store = summaryview->store; GtkTreeIter iter, next; + GtkTreePath *path; GSList *mlist; GNode *root, *node; GHashTable *node_table; @@ -3316,6 +3331,7 @@ void summary_thread_build(SummaryView *summaryview) gboolean valid; FolderSortKey sort_key = SORT_BY_NONE; FolderSortType sort_type = SORT_ASCENDING; + MsgInfo *selected_msg, *displayed_msg; if (!summaryview->folder_item) return; @@ -3326,6 +3342,10 @@ void summary_thread_build(SummaryView *summaryview) STATUSBAR_PUSH(summaryview->mainwin, _("Building threads...")); main_window_cursor_wait(summaryview->mainwin); + selected_msg = summary_get_msginfo(summaryview, summaryview->selected); + displayed_msg = summary_get_msginfo + (summaryview, summaryview->displayed); + summaryview->folder_item->threaded = TRUE; mlist = summary_get_msg_list(summaryview); @@ -3375,7 +3395,33 @@ void summary_thread_build(SummaryView *summaryview) if (prefs_common.expand_thread) gtk_tree_view_expand_all(GTK_TREE_VIEW(summaryview->treeview)); - summary_scroll_to_selected(summaryview, TRUE); + if (!summaryview->selected || + (summaryview->selected && + !gtk_tree_row_reference_valid(summaryview->selected))) { + if (selected_msg && + gtkut_tree_model_find_by_column_data + (model, &iter, NULL, S_COL_MSG_INFO, selected_msg)) { + summary_select_row(summaryview, &iter, FALSE, TRUE); + } + } else + summary_scroll_to_selected(summaryview, TRUE); + + if (summaryview->displayed && + !gtk_tree_row_reference_valid(summaryview->displayed)) { + if (displayed_msg && + gtkut_tree_model_find_by_column_data + (model, &iter, NULL, S_COL_MSG_INFO, displayed_msg)) { + path = gtk_tree_model_get_path(model, &iter); + gtk_tree_row_reference_free(summaryview->displayed); + summaryview->displayed = + gtk_tree_row_reference_new(model, path); + gtk_tree_path_free(path); + } else { + messageview_clear(summaryview->messageview); + gtk_tree_row_reference_free(summaryview->displayed); + summaryview->displayed = NULL; + } + } debug_print(_("done.\n")); STATUSBAR_POP(summaryview->mainwin); @@ -3427,9 +3473,11 @@ void summary_unthread(SummaryView *summaryview) { GtkTreeModel *model = GTK_TREE_MODEL(summaryview->store); GtkTreeIter iter, next; + GtkTreePath *path; gboolean valid; FolderSortKey sort_key = SORT_BY_NONE; FolderSortType sort_type = SORT_ASCENDING; + MsgInfo *selected_msg, *displayed_msg; summary_lock(summaryview); @@ -3437,6 +3485,10 @@ void summary_unthread(SummaryView *summaryview) STATUSBAR_PUSH(summaryview->mainwin, _("Unthreading...")); main_window_cursor_wait(summaryview->mainwin); + selected_msg = summary_get_msginfo(summaryview, summaryview->selected); + displayed_msg = summary_get_msginfo + (summaryview, summaryview->displayed); + if (summaryview->folder_item) summaryview->folder_item->threaded = FALSE; @@ -3464,7 +3516,33 @@ void summary_unthread(SummaryView *summaryview) if (sort_key != SORT_BY_NONE) summary_sort(summaryview, sort_key, sort_type); - summary_scroll_to_selected(summaryview, TRUE); + if (!summaryview->selected || + (summaryview->selected && + !gtk_tree_row_reference_valid(summaryview->selected))) { + if (selected_msg && + gtkut_tree_model_find_by_column_data + (model, &iter, NULL, S_COL_MSG_INFO, selected_msg)) { + summary_select_row(summaryview, &iter, FALSE, TRUE); + } + } else + summary_scroll_to_selected(summaryview, TRUE); + + if (summaryview->displayed && + !gtk_tree_row_reference_valid(summaryview->displayed)) { + if (displayed_msg && + gtkut_tree_model_find_by_column_data + (model, &iter, NULL, S_COL_MSG_INFO, displayed_msg)) { + path = gtk_tree_model_get_path(model, &iter); + gtk_tree_row_reference_free(summaryview->displayed); + summaryview->displayed = + gtk_tree_row_reference_new(model, path); + gtk_tree_path_free(path); + } else { + messageview_clear(summaryview->messageview); + gtk_tree_row_reference_free(summaryview->displayed); + summaryview->displayed = NULL; + } + } debug_print(_("done.\n")); STATUSBAR_POP(summaryview->mainwin); |