aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-27 11:49:31 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:09 +0800
commit6562ce11316558386b3288cd3725627d98743edf (patch)
treebe640371caed151da5d7c414b5ce6c23d2f44f39 /e-util
parent3b02bc488e2c22edd403867cd66ab3a3fce4dafa (diff)
downloadgsoc2013-evolution-6562ce11316558386b3288cd3725627d98743edf.tar.gz
gsoc2013-evolution-6562ce11316558386b3288cd3725627d98743edf.tar.zst
gsoc2013-evolution-6562ce11316558386b3288cd3725627d98743edf.zip
ETableSortInfo: Move "can_group" to private section.
Use e_table_sort_info_get_can_group() to obtain the value.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-table-sort-info.c25
-rw-r--r--e-util/e-table-sort-info.h2
2 files changed, 17 insertions, 10 deletions
diff --git a/e-util/e-table-sort-info.c b/e-util/e-table-sort-info.c
index 86ef1f71c0..54d5c8e8be 100644
--- a/e-util/e-table-sort-info.c
+++ b/e-util/e-table-sort-info.c
@@ -29,6 +29,7 @@
struct _ETableSortInfoPrivate {
GWeakRef specification;
+ gboolean can_group;
};
enum {
@@ -164,7 +165,7 @@ e_table_sort_info_init (ETableSortInfo *sort_info)
{
sort_info->priv = E_TABLE_SORT_INFO_GET_PRIVATE (sort_info);
- sort_info->can_group = TRUE;
+ sort_info->priv->can_group = TRUE;
}
/**
@@ -212,7 +213,7 @@ e_table_sort_info_get_can_group (ETableSortInfo *sort_info)
{
g_return_val_if_fail (E_IS_TABLE_SORT_INFO (sort_info), FALSE);
- return sort_info->can_group;
+ return sort_info->priv->can_group;
}
void
@@ -221,7 +222,7 @@ e_table_sort_info_set_can_group (ETableSortInfo *sort_info,
{
g_return_if_fail (E_IS_TABLE_SORT_INFO (sort_info));
- sort_info->can_group = can_group;
+ sort_info->priv->can_group = can_group;
}
/**
@@ -233,9 +234,14 @@ e_table_sort_info_set_can_group (ETableSortInfo *sort_info,
guint
e_table_sort_info_grouping_get_count (ETableSortInfo *sort_info)
{
+ guint count = 0;
+
g_return_val_if_fail (E_IS_TABLE_SORT_INFO (sort_info), 0);
- return (sort_info->can_group) ? sort_info->group_count : 0;
+ if (e_table_sort_info_get_can_group (sort_info))
+ count = sort_info->group_count;
+
+ return count;
}
static void
@@ -287,10 +293,13 @@ e_table_sort_info_grouping_get_nth (ETableSortInfo *sort_info,
g_return_val_if_fail (E_IS_TABLE_SORT_INFO (sort_info), fake);
- if (sort_info->can_group && n < sort_info->group_count)
- return sort_info->groupings[n];
+ if (!e_table_sort_info_get_can_group (sort_info))
+ return fake;
- return fake;
+ if (n >= e_table_sort_info_grouping_get_count (sort_info))
+ return fake;
+
+ return sort_info->groupings[n];
}
/**
@@ -545,7 +554,7 @@ e_table_sort_info_duplicate (ETableSortInfo *sort_info)
sort_info->sortings,
sizeof (ETableSortColumn) * new_info->sort_count);
- new_info->can_group = sort_info->can_group;
+ new_info->priv->can_group = sort_info->priv->can_group;
return new_info;
}
diff --git a/e-util/e-table-sort-info.h b/e-util/e-table-sort-info.h
index cc435f3d54..d1de2d3f28 100644
--- a/e-util/e-table-sort-info.h
+++ b/e-util/e-table-sort-info.h
@@ -69,8 +69,6 @@ struct _ETableSortInfo {
ETableSortColumn *groupings;
gint sort_count;
ETableSortColumn *sortings;
-
- gboolean can_group;
};
struct _ETableSortInfoClass {