aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-29 04:35:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:10 +0800
commitce3e2091c2ff7a581bfa959d71050a059d48ee94 (patch)
tree99c36b14c9840b5186cf47e106602b507d62cde7 /e-util
parentcaa26aeb6b119616c9ebe22bd91fc749411be18a (diff)
downloadgsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar.gz
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar.bz2
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar.lz
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar.xz
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.tar.zst
gsoc2013-evolution-ce3e2091c2ff7a581bfa959d71050a059d48ee94.zip
Add e_table_sort_info_sorting_remove().
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-table-header-item.c12
-rw-r--r--e-util/e-table-sort-info.c19
-rw-r--r--e-util/e-table-sort-info.h3
3 files changed, 24 insertions, 10 deletions
diff --git a/e-util/e-table-header-item.c b/e-util/e-table-header-item.c
index ddbe7c8cfd..8dcdf06c19 100644
--- a/e-util/e-table-header-item.c
+++ b/e-util/e-table-header-item.c
@@ -1818,16 +1818,8 @@ ethi_change_sort_state (ETableHeaderItem *ethi,
* This means the user has clicked twice
* already, lets kill sorting of this column now.
*/
- gint j;
-
- for (j = i + 1; j < length; j++)
- e_table_sort_info_sorting_set_nth (
- ethi->sort_info, j - 1,
- e_table_sort_info_sorting_get_nth (
- ethi->sort_info, j));
-
- e_table_sort_info_sorting_truncate (
- ethi->sort_info, length - 1);
+ e_table_sort_info_sorting_remove (
+ ethi->sort_info, i);
length--;
i--;
} else {
diff --git a/e-util/e-table-sort-info.c b/e-util/e-table-sort-info.c
index 3f1f928e74..047e31da6c 100644
--- a/e-util/e-table-sort-info.c
+++ b/e-util/e-table-sort-info.c
@@ -345,6 +345,25 @@ e_table_sort_info_sorting_get_count (ETableSortInfo *sort_info)
}
/**
+ * e_table_sort_info_sorting_remove:
+ * @sort_info: an #ETableSortInfo
+ * @n: the index of the element to remove
+ *
+ * Removes the sorting element at the given index. The following sorting
+ * elements are moved down one place.
+ **/
+void
+e_table_sort_info_sorting_remove (ETableSortInfo *sort_info,
+ guint n)
+{
+ g_return_if_fail (E_IS_TABLE_SORT_INFO (sort_info));
+
+ g_array_remove_index (sort_info->priv->sortings, n);
+
+ g_signal_emit (sort_info, signals[SORT_INFO_CHANGED], 0);
+}
+
+/**
* e_table_sort_info_sorting_truncate:
* @sort_info: an #ETableSortInfo
* @length: position where the truncation happens.
diff --git a/e-util/e-table-sort-info.h b/e-util/e-table-sort-info.h
index 1dfd91be16..64ed8640e7 100644
--- a/e-util/e-table-sort-info.h
+++ b/e-util/e-table-sort-info.h
@@ -98,6 +98,9 @@ void e_table_sort_info_grouping_set_nth
guint e_table_sort_info_sorting_get_count
(ETableSortInfo *sort_info);
+void e_table_sort_info_sorting_remove
+ (ETableSortInfo *sort_info,
+ guint n);
void e_table_sort_info_sorting_truncate
(ETableSortInfo *sort_info,
guint length);