aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-26 17:15:32 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-26 17:15:32 +0800
commit20925d94eb5649df410820e67017a299ce5d867d (patch)
tree34a29bc7dc4aca4cae7fd97e5aa5a97497f4926b /widgets/table/e-table-header.c
parent4c768a32bf0d07dea885d7e23da66762a7d2c82a (diff)
downloadgsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar.gz
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar.bz2
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar.lz
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar.xz
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.tar.zst
gsoc2013-evolution-20925d94eb5649df410820e67017a299ce5d867d.zip
Added some g_return_if_fails and g_return_val_if_fails.
2000-08-25 Christopher James Lahey <clahey@helixcode.com> * e-table-col.c, e-table-config.c, e-table-header.c, e-table-text-model.c: Added some g_return_if_fails and g_return_val_if_fails. svn path=/trunk/; revision=5056
Diffstat (limited to 'widgets/table/e-table-header.c')
-rw-r--r--widgets/table/e-table-header.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index fddda13da8..0f8f9ed1e9 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -348,7 +348,7 @@ e_table_header_index (ETableHeader *eth, int col)
{
g_return_val_if_fail (eth != NULL, -1);
g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
- g_return_val_if_fail (col < eth->col_count, -1);
+ g_return_val_if_fail (col >= 0 && col < eth->col_count, -1);
return eth->columns [col]->col_idx;
}
@@ -376,6 +376,7 @@ ETableCol **
e_table_header_get_columns (ETableHeader *eth)
{
ETableCol **ret;
+ int i;
g_return_val_if_fail (eth != NULL, 0);
g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
@@ -384,6 +385,10 @@ e_table_header_get_columns (ETableHeader *eth)
memcpy (ret, eth->columns, sizeof (ETableCol *) * eth->col_count);
ret [eth->col_count] = NULL;
+ for (i = 0; i < eth->col_count; i++) {
+ gtk_object_ref(GTK_OBJECT(ret[i]));
+ }
+
return ret;
}
@@ -479,11 +484,16 @@ e_table_header_remove (ETableHeader *eth, int idx)
void
e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
{
+ g_return_if_fail (eth != NULL);
+ g_return_if_fail (E_IS_TABLE_HEADER (eth));
}
void
e_table_header_set_size(ETableHeader *eth, int idx, int size)
{
+ g_return_if_fail (eth != NULL);
+ g_return_if_fail (E_IS_TABLE_HEADER (eth));
+
enqueue(eth, idx, size);
}
@@ -610,21 +620,19 @@ int
e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col)
{
int total, col;
-
+
g_return_val_if_fail (eth != NULL, 0);
g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
- {
- if (start_col < 0)
- start_col = 0;
- if (end_col > eth->col_count)
- end_col = eth->col_count;
+ if (start_col < 0)
+ start_col = 0;
+ if (end_col > eth->col_count)
+ end_col = eth->col_count;
+
+ total = 0;
+ for (col = start_col; col < end_col; col++){
- total = 0;
- for (col = start_col; col < end_col; col++){
-
- total += eth->columns [col]->width;
- }
+ total += eth->columns [col]->width;
}
return total;