diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-06-05 05:24:19 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-06-05 05:24:19 +0800 |
commit | 75a1cb19cdba3774d8d76ac9bf238254545b018f (patch) | |
tree | dd6759d82276a075db3d0dae04232b27ee9de330 /widgets/table/e-table-utils.c | |
parent | c1dadee81ade19d8524cd5d8466f76ffd4f5f289 (diff) | |
download | gsoc2013-evolution-75a1cb19cdba3774d8d76ac9bf238254545b018f.tar.gz gsoc2013-evolution-75a1cb19cdba3774d8d76ac9bf238254545b018f.tar.zst gsoc2013-evolution-75a1cb19cdba3774d8d76ac9bf238254545b018f.zip |
Added this function.
2002-06-04 Christopher James Lahey <clahey@ximian.com>
* e-table-header.c, e-table-header.h
(e_table_header_prioritized_column_selected): Added this function.
* e-table-utils.c, e-table-utils.h
(e_table_util_calculate_current_search_col): Added this function.
* e-table.c, e-table.h, e-tree.c: Added a "always_search"
argument. If this is off, then searches only occur if there's
sort. If it's on, sort takes precendence in doing searches,
followed by the highest priority column shown.
svn path=/trunk/; revision=17109
Diffstat (limited to 'widgets/table/e-table-utils.c')
-rw-r--r-- | widgets/table/e-table-utils.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index 8ae460681f..eb36323d70 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -137,3 +137,48 @@ e_table_spec_to_full_header (ETableSpecification *spec, return nh; } + +static gboolean +check_col (ETableCol *col, gpointer user_data) +{ + return col->search ? TRUE : FALSE; +} + +ETableCol * +e_table_util_calculate_current_search_col (ETableHeader *header, ETableHeader *full_header, ETableSortInfo *sort_info, gboolean always_search) +{ + int i; + int count; + ETableCol *col = NULL; + count = e_table_sort_info_grouping_get_count (sort_info); + for (i = 0; i < count; i++) { + ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, i); + + col = e_table_header_get_column (full_header, column.column); + + if (col && col->search) + break; + + col = NULL; + } + + if (col == NULL) { + count = e_table_sort_info_sorting_get_count (sort_info); + for (i = 0; i < count; i++) { + ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, i); + + col = e_table_header_get_column (full_header, column.column); + + if (col && col->search) + break; + + col = NULL; + } + } + + if (col == NULL && always_search) { + col = e_table_header_prioritized_column_selected (header, check_col, NULL); + } + + return col; +} |