aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-27 12:09:35 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:10 +0800
commit59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba (patch)
tree69082bb2740668e5d2b8c29e6258d0ba5cea0ad5
parent10e8a60ee342c6d28bf0a63b387e5248c33affab (diff)
downloadgsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar.gz
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar.bz2
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar.lz
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar.xz
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.tar.zst
gsoc2013-evolution-59ddc1f073aff7d67399c3b0ecc3ec3ec9218aba.zip
ETableSortInfo: Move "sort_count" to private section.
Use e_table_sort_info_sorting_get_count() to obtain the value.
-rw-r--r--e-util/e-table-sort-info.c26
-rw-r--r--e-util/e-table-sort-info.h1
2 files changed, 14 insertions, 13 deletions
diff --git a/e-util/e-table-sort-info.c b/e-util/e-table-sort-info.c
index 1f82ba91b7..9f9774555d 100644
--- a/e-util/e-table-sort-info.c
+++ b/e-util/e-table-sort-info.c
@@ -30,6 +30,7 @@
struct _ETableSortInfoPrivate {
GWeakRef specification;
guint group_count;
+ guint sort_count;
gboolean can_group;
};
@@ -338,21 +339,21 @@ e_table_sort_info_sorting_get_count (ETableSortInfo *sort_info)
{
g_return_val_if_fail (E_IS_TABLE_SORT_INFO (sort_info), 0);
- return sort_info->sort_count;
+ return sort_info->priv->sort_count;
}
static void
table_sort_info_sorting_real_truncate (ETableSortInfo *sort_info,
gint length)
{
- if (length < sort_info->sort_count)
- sort_info->sort_count = length;
+ if (length < sort_info->priv->sort_count)
+ sort_info->priv->sort_count = length;
- if (length > sort_info->sort_count) {
+ if (length > sort_info->priv->sort_count) {
sort_info->sortings = g_realloc (
sort_info->sortings,
length * sizeof (ETableSortColumn));
- sort_info->sort_count = length;
+ sort_info->priv->sort_count = length;
}
}
@@ -390,10 +391,10 @@ e_table_sort_info_sorting_get_nth (ETableSortInfo *sort_info,
g_return_val_if_fail (E_IS_TABLE_SORT_INFO (sort_info), fake);
- if (n < sort_info->sort_count)
- return sort_info->sortings[n];
+ if (n >= e_table_sort_info_sorting_get_count (sort_info))
+ return fake;
- return fake;
+ return sort_info->sortings[n];
}
/**
@@ -412,7 +413,7 @@ e_table_sort_info_sorting_set_nth (ETableSortInfo *sort_info,
{
g_return_if_fail (E_IS_TABLE_SORT_INFO (sort_info));
- if (n >= sort_info->sort_count)
+ if (n >= sort_info->priv->sort_count)
table_sort_info_sorting_real_truncate (sort_info, n + 1);
sort_info->sortings[n] = column;
@@ -549,12 +550,13 @@ e_table_sort_info_duplicate (ETableSortInfo *sort_info)
sort_info->groupings,
sizeof (ETableSortColumn) * new_info->priv->group_count);
- new_info->sort_count = sort_info->sort_count;
- new_info->sortings = g_new (ETableSortColumn, new_info->sort_count);
+ new_info->priv->sort_count = sort_info->priv->sort_count;
+ new_info->sortings = g_new (
+ ETableSortColumn, new_info->priv->sort_count);
memmove (
new_info->sortings,
sort_info->sortings,
- sizeof (ETableSortColumn) * new_info->sort_count);
+ sizeof (ETableSortColumn) * new_info->priv->sort_count);
new_info->priv->can_group = sort_info->priv->can_group;
diff --git a/e-util/e-table-sort-info.h b/e-util/e-table-sort-info.h
index 8c90be354e..28ca607f3f 100644
--- a/e-util/e-table-sort-info.h
+++ b/e-util/e-table-sort-info.h
@@ -66,7 +66,6 @@ struct _ETableSortInfo {
ETableSortInfoPrivate *priv;
ETableSortColumn *groupings;
- gint sort_count;
ETableSortColumn *sortings;
};