aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-08-21 01:13:36 +0800
committerChris Lahey <clahey@src.gnome.org>2001-08-21 01:13:36 +0800
commit4dd3f5e734c4582596bfdabc29ffcac8261fb74d (patch)
tree2f5e5b158d2e9508824fa1b6143ecbbc9cc11d90
parent4a1da6f28901dba5c6a3dd3c3a8bc3b16f931e31 (diff)
downloadgsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar.gz
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar.bz2
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar.lz
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar.xz
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.tar.zst
gsoc2013-evolution-4dd3f5e734c4582596bfdabc29ffcac8261fb74d.zip
Made this object handle NULLs for all the handler functions.
2001-08-20 Christopher James Lahey <clahey@ximian.com> * e-table-without.c: Made this object handle NULLs for all the handler functions. svn path=/trunk/; revision=12316
-rw-r--r--widgets/table/e-table-without.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c
index 366b6c9f35..a597ac7381 100644
--- a/widgets/table/e-table-without.c
+++ b/widgets/table/e-table-without.c
@@ -43,9 +43,13 @@ check (ETableWithout *etw, int model_row)
void *key;
ETableSubset *etss = E_TABLE_SUBSET (etw);
- key = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
+ if (etw->priv->get_key_func)
+ key = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
+ else
+ key = GINT_TO_POINTER (model_row);
ret_val = (g_hash_table_lookup (etw->priv->hash, key) != NULL);
- etw->priv->free_gotten_key_func (key, etw->priv->closure);
+ if (etw->priv->free_gotten_key_func)
+ etw->priv->free_gotten_key_func (key, etw->priv->closure);
return ret_val;
}
@@ -56,9 +60,16 @@ check_with_key (ETableWithout *etw, void *key, int model_row)
void *key2;
ETableSubset *etss = E_TABLE_SUBSET (etw);
- key2 = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
- ret_val = (etw->priv->compare_func (key, key2));
- etw->priv->free_gotten_key_func (key, etw->priv->closure);
+ if (etw->priv->get_key_func)
+ key2 = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
+ else
+ key2 = GINT_TO_POINTER (model_row);
+ if (etw->priv->compare_func)
+ ret_val = (etw->priv->compare_func (key, key2));
+ else
+ ret_val = (key == key2);
+ if (etw->priv->free_gotten_key_func)
+ etw->priv->free_gotten_key_func (key, etw->priv->closure);
return ret_val;
}
@@ -97,7 +108,8 @@ delete_hash_element (gpointer key,
gpointer closure)
{
ETableWithout *etw = closure;
- etw->priv->free_duplicated_key_func (key, etw->priv->closure);
+ if (etw->priv->free_duplicated_key_func)
+ etw->priv->free_duplicated_key_func (key, etw->priv->closure);
}
static void
@@ -269,7 +281,8 @@ void e_table_without_add (ETableWithout *etw,
int i; /* View row */
ETableSubset *etss = E_TABLE_SUBSET (etw);
- key = etw->priv->duplicate_key_func (key, etw->priv->closure);
+ if (etw->priv->duplicate_key_func)
+ key = etw->priv->duplicate_key_func (key, etw->priv->closure);
g_hash_table_insert (etw->priv->hash, key, key);
for (i = 0; i < etss->n_map; i++) {
@@ -312,7 +325,8 @@ void e_table_without_remove (ETableWithout *etw,
}
}
if (g_hash_table_lookup_extended (etw->priv->hash, key, &old_key, NULL)) {
- etw->priv->free_duplicated_key_func (key, etw->priv->closure);
+ if (etw->priv->free_duplicated_key_func)
+ etw->priv->free_duplicated_key_func (key, etw->priv->closure);
g_hash_table_remove (etw->priv->hash, key);
}
}