Revision 1692

src/summaryview.c (revision 1692)
147 147

  
148 148
static GdkPixbuf *clip_pixbuf;
149 149

  
150
static void summary_clear_list_full	(SummaryView		*summaryview,
151
					 gboolean		 is_refresh);
152

  
150 153
static GList *summary_get_selected_rows	(SummaryView		*summaryview);
151 154
static void summary_selection_list_free	(SummaryView		*summaryview);
152 155

  
......
194 197
					 guint			 msgnum,
195 198
					 GtkTreeIter		*found);
196 199

  
200
static void summary_update_display_state(SummaryView		*summaryview,
201
					 guint			 disp_msgnum,
202
					 guint			 sel_msgnum);
203

  
197 204
static void summary_update_status	(SummaryView		*summaryview);
198 205

  
199 206
/* display functions */
......
761 768
	guint displayed_msgnum = 0;
762 769
	gboolean moved;
763 770
	gboolean selection_done = FALSE;
771
	gboolean do_qsearch = FALSE;
772
	const gchar *key = NULL;
764 773

  
765 774
	if (summary_is_locked(summaryview)) return FALSE;
766 775

  
......
811 820

  
812 821
	folderview_set_opened_item(summaryview->folderview, item);
813 822

  
814
	summary_clear_list(summaryview);
823
	summary_clear_list_full(summaryview, is_refresh);
815 824

  
816 825
	buf = NULL;
817 826
	if (!item || !item->path || !item->parent || item->no_select ||
......
854 863
	/* set tree store and hash table from the msginfo list, and
855 864
	   create the thread */
856 865
	summaryview->all_mlist = mlist;
857
	if (prefs_common.persist_qsearch_filter &&
858
	    item->qsearch_cond_type > QS_ALL) {
866

  
867
	if (prefs_common.persist_qsearch_filter || is_refresh) {
868
		if (item->qsearch_cond_type > QS_ALL)
869
			do_qsearch = TRUE;
870
		if (is_refresh) {
871
			key = gtk_entry_get_text
872
				(GTK_ENTRY(summaryview->search_entry));
873
			if (key && *key != '\0')
874
				do_qsearch = TRUE;
875
			else
876
				key = NULL;
877
		}
878
	}
879

  
880
	if (do_qsearch) {
859 881
		gint index;
860 882
		QSearchCondType type = item->qsearch_cond_type;
861 883

  
......
866 888
			gtk_option_menu_set_history
867 889
                		(GTK_OPTION_MENU(summaryview->filter_optmenu),
868 890
				 index);
891
		} else {
892
			gtk_option_menu_set_history
893
                		(GTK_OPTION_MENU(summaryview->filter_optmenu),
894
				 0);
895
			type = QS_ALL;
896
		}
897

  
898
		if (type > QS_ALL || key) {
869 899
			summaryview->flt_mlist =
870
				summary_qsearch_filter(summaryview, type, NULL);
900
				summary_qsearch_filter(summaryview, type, key);
871 901
			summaryview->on_filter = TRUE;
872 902
			summary_set_tree_model_from_list
873 903
				(summaryview, summaryview->flt_mlist);
......
893 923
					  0, 0, NULL, NULL, summaryview);
894 924

  
895 925
	if (is_refresh) {
896
		if (summary_find_msg_by_msgnum(summaryview, displayed_msgnum,
897
					       &iter)) {
898
			GtkTreePath *path;
926
		summary_update_display_state(summaryview, displayed_msgnum,
927
					     selected_msgnum);
899 928

  
900
			path = gtk_tree_model_get_path(model, &iter);
901
			gtk_tree_row_reference_free(summaryview->displayed);
902
			summaryview->displayed =
903
				gtk_tree_row_reference_new(model, path);
904
			gtk_tree_path_free(path);
905
		} else
906
			messageview_clear(summaryview->messageview);
907

  
908
		summary_select_by_msgnum(summaryview, selected_msgnum);
909

  
910 929
		if (!summaryview->selected) {
911 930
			/* no selected message - select first unread
912 931
			   message, but do not display it */
......
993 1012

  
994 1013
void summary_clear_list(SummaryView *summaryview)
995 1014
{
1015
	summary_clear_list_full(summaryview, FALSE);
1016
}
1017

  
1018
static void summary_clear_list_full(SummaryView *summaryview,
1019
				    gboolean is_refresh)
1020
{
996 1021
	GtkTreeView *treeview = GTK_TREE_VIEW(summaryview->treeview);
997 1022
	GtkAdjustment *adj;
998 1023

  
......
1045 1070
	summaryview->flt_deleted = summaryview->flt_moved = 0;
1046 1071
	summaryview->flt_copied = 0;
1047 1072
	summaryview->flt_new = summaryview->flt_unread = 0;
1048
	gtk_entry_set_text(GTK_ENTRY(summaryview->search_entry), "");
1049
	gtk_option_menu_set_history
1050
		(GTK_OPTION_MENU(summaryview->filter_optmenu), 0);
1073
	if (!is_refresh) {
1074
		gtk_entry_set_text(GTK_ENTRY(summaryview->search_entry), "");
1075
		gtk_option_menu_set_history
1076
			(GTK_OPTION_MENU(summaryview->filter_optmenu), 0);
1077
	}
1051 1078
	summaryview->on_filter = FALSE;
1052 1079

  
1053 1080
	procmsg_msg_list_free(summaryview->all_mlist);
......
1800 1827
	return FALSE;
1801 1828
}
1802 1829

  
1830
static void summary_update_display_state(SummaryView *summaryview,
1831
					 guint disp_msgnum, guint sel_msgnum)
1832
{
1833
	GtkTreeIter iter;
1834

  
1835
	if (summary_find_msg_by_msgnum(summaryview, disp_msgnum, &iter)) {
1836
		GtkTreePath *path;
1837
		GtkTreeModel *model = GTK_TREE_MODEL(summaryview->store);
1838

  
1839
		path = gtk_tree_model_get_path(model, &iter);
1840
		gtk_tree_row_reference_free(summaryview->displayed);
1841
		summaryview->displayed =
1842
			gtk_tree_row_reference_new(model, path);
1843
		gtk_tree_path_free(path);
1844
	} else
1845
		messageview_clear(summaryview->messageview);
1846

  
1847
	summary_select_by_msgnum(summaryview, sel_msgnum);
1848
}
1849

  
1803 1850
static guint attract_hash_func(gconstpointer key)
1804 1851
{
1805 1852
	gchar *str;
......
4176 4223
	    !gtk_tree_row_reference_valid(summaryview->displayed)) {
4177 4224
		if (displayed_msg &&
4178 4225
		    gtkut_tree_model_find_by_column_data
4179
			 (model, &iter, NULL, S_COL_MSG_INFO, displayed_msg)) {
4226
			(model, &iter, NULL, S_COL_MSG_INFO, displayed_msg)) {
4180 4227
			path = gtk_tree_model_get_path(model, &iter);
4181 4228
			gtk_tree_row_reference_free(summaryview->displayed);
4182 4229
			summaryview->displayed =
......
5197 5244

  
5198 5245
void summary_qsearch_reset(SummaryView *summaryview)
5199 5246
{
5247
	guint selected_msgnum = 0;
5248
	guint displayed_msgnum = 0;
5249

  
5200 5250
	if (!summaryview->on_filter)
5201 5251
		return;
5202 5252

  
......
5208 5258
	gtk_option_menu_set_history
5209 5259
		(GTK_OPTION_MENU(summaryview->filter_optmenu), 0);
5210 5260

  
5261
	selected_msgnum = summary_get_msgnum(summaryview,
5262
					     summaryview->selected);
5263
	displayed_msgnum = summary_get_msgnum(summaryview,
5264
					      summaryview->displayed);
5265

  
5211 5266
	summaryview->on_filter = FALSE;
5212 5267
	g_slist_free(summaryview->flt_mlist);
5213 5268
	summaryview->flt_mlist = NULL;
......
5222 5277
	summary_lock(summaryview);
5223 5278
	main_window_cursor_wait(summaryview->mainwin);
5224 5279

  
5225
	messageview_clear(summaryview->messageview);
5226

  
5227 5280
	gtkut_tree_view_fast_clear(GTK_TREE_VIEW(summaryview->treeview),
5228 5281
				   summaryview->store);
5229 5282
	summary_unset_sort_column_id(summaryview);
......
5238 5291
					  (GSignalMatchType)G_SIGNAL_MATCH_DATA,
5239 5292
					  0, 0, NULL, NULL, summaryview);
5240 5293

  
5294
	summary_update_display_state(summaryview, displayed_msgnum,
5295
				     selected_msgnum);
5296

  
5241 5297
	summary_update_status(summaryview);
5242 5298
	summary_status_show(summaryview);
5243 5299
	summary_set_menu_sensitive(summaryview);
......
5345 5401
	GtkWidget *menuitem;
5346 5402
	const gchar *key;
5347 5403
	GSList *flt_mlist;
5404
	guint selected_msgnum = 0;
5405
	guint displayed_msgnum = 0;
5348 5406

  
5349 5407
	menuitem = gtk_menu_get_active(GTK_MENU(summaryview->filter_menu));
5350 5408
	type = GPOINTER_TO_INT
......
5360 5418
		return;
5361 5419
	}
5362 5420

  
5421
	selected_msgnum = summary_get_msgnum(summaryview,
5422
					     summaryview->selected);
5423
	displayed_msgnum = summary_get_msgnum(summaryview,
5424
					      summaryview->displayed);
5425

  
5363 5426
	summaryview->on_filter = FALSE;
5364 5427
	g_slist_free(summaryview->flt_mlist);
5365 5428
	summaryview->flt_mlist = NULL;
......
5374 5437
	summary_lock(summaryview);
5375 5438
	main_window_cursor_wait(summaryview->mainwin);
5376 5439

  
5377
	messageview_clear(summaryview->messageview);
5378

  
5379 5440
	flt_mlist = summary_qsearch_filter(summaryview, type, key);
5380 5441
	summaryview->on_filter = TRUE;
5381 5442
	summaryview->flt_mlist = flt_mlist;
......
5395 5456
					  (GSignalMatchType)G_SIGNAL_MATCH_DATA,
5396 5457
					  0, 0, NULL, NULL, summaryview);
5397 5458

  
5459
	summary_update_display_state(summaryview, displayed_msgnum,
5460
				     selected_msgnum);
5461

  
5398 5462
	main_window_cursor_normal(summaryview->mainwin);
5399 5463
	summary_unlock(summaryview);
5400 5464
	summary_update_status(summaryview);
ChangeLog.ja (revision 1692)
1
2007-05-14
2

  
3
	* src/summaryview.c: ?????å??????Υ????????ե??å????????ݻ???????
4
	  ?褦?ˤ??????????å??????ι??????????????֤??ݻ????????褦?ˤ?????
5

  
1 6
2007-05-10
2 7

  
3 8
	* libsylph/folder.c: qsearch_cond_type ?????å??????֤??ݻ???????
ChangeLog (revision 1692)
1
2007-05-14
2

  
3
	* src/summaryview.c: the quick search key now persists on refresh.
4
	  The selection now persists on the update of quick search.
5

  
1 6
2007-05-10
2 7

  
3 8
	* libsylph/folder.c: qsearch_cond_type now persists between sessions.

Also available in: Unified diff