aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-group-leaf.c153
-rw-r--r--widgets/table/e-table-group.c132
-rw-r--r--widgets/table/e-table-header.c3
-rw-r--r--widgets/table/e-table.c2
4 files changed, 179 insertions, 111 deletions
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index e4c46747dd..c721b7d49a 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -45,8 +45,12 @@ static void
etgl_destroy (GtkObject *object)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(object);
- if (etgl->ets)
+
+ if (etgl->ets) {
gtk_object_unref (GTK_OBJECT(etgl->ets));
+ etgl->ets = NULL;
+ }
+
if (etgl->item) {
if (etgl->etgl_cursor_change_id != 0)
gtk_signal_disconnect (GTK_OBJECT (etgl->item),
@@ -63,13 +67,12 @@ etgl_destroy (GtkObject *object)
if (etgl->etgl_click_id != 0)
gtk_signal_disconnect (GTK_OBJECT (etgl->item),
etgl->etgl_click_id);
- if (etgl->etgl_key_press_id != 0)
+ if (etgl->etgl_key_press_id != 0)
gtk_signal_disconnect (GTK_OBJECT (etgl->item),
etgl->etgl_key_press_id);
- if (etgl->etgl_start_drag_id != 0)
+ if (etgl->etgl_start_drag_id != 0)
gtk_signal_disconnect (GTK_OBJECT (etgl->item),
etgl->etgl_start_drag_id);
- gtk_object_destroy (GTK_OBJECT(etgl->item));
etgl->etgl_cursor_change_id = 0;
etgl->etgl_cursor_activated_id = 0;
@@ -78,10 +81,16 @@ etgl_destroy (GtkObject *object)
etgl->etgl_click_id = 0;
etgl->etgl_key_press_id = 0;
etgl->etgl_start_drag_id = 0;
+
+ gtk_object_destroy (GTK_OBJECT(etgl->item));
etgl->item = NULL;
}
- if (etgl->selection_model)
+
+ if (etgl->selection_model) {
gtk_object_unref (GTK_OBJECT(etgl->selection_model));
+ etgl->selection_model = NULL;
+ }
+
if (GTK_OBJECT_CLASS (etgl_parent_class)->destroy)
GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object);
}
@@ -94,17 +103,21 @@ e_table_group_leaf_construct (GnomeCanvasGroup *parent,
ETableModel *model,
ETableSortInfo *sort_info)
{
- etgl->is_grouped = e_table_sort_info_grouping_get_count(sort_info);
+ etgl->is_grouped = e_table_sort_info_grouping_get_count(sort_info) > 0 ? TRUE : FALSE;
+
if (etgl->is_grouped)
- etgl->ets = E_TABLE_SUBSET(e_table_sorted_variable_new (model, full_header, sort_info));
+ etgl->ets = E_TABLE_SUBSET(e_table_sorted_variable_new (model,
+ full_header,
+ sort_info));
else
- etgl->ets = E_TABLE_SUBSET(e_table_sorted_new (model, full_header, sort_info));
- gtk_object_ref(GTK_OBJECT(etgl->ets));
- gtk_object_sink(GTK_OBJECT(etgl->ets));
+ etgl->ets = E_TABLE_SUBSET(e_table_sorted_new (model,
+ full_header,
+ sort_info));
+
e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model);
}
-/**
+/**
* e_table_group_leaf_new
* @parent: The %GnomeCanvasGroup to create a child of.
* @full_header: The full header of the %ETable.
@@ -127,7 +140,7 @@ e_table_group_leaf_new (GnomeCanvasGroup *parent,
ETableGroupLeaf *etgl;
g_return_val_if_fail (parent != NULL, NULL);
-
+
etgl = gtk_type_new (e_table_group_leaf_get_type ());
e_table_group_leaf_construct (parent, etgl, full_header,
@@ -139,18 +152,21 @@ static void
etgl_cursor_change (GtkObject *object, gint row, ETableGroupLeaf *etgl)
{
if (row < E_TABLE_SUBSET(etgl->ets)->n_map)
- e_table_group_cursor_change (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row]);
+ e_table_group_cursor_change (E_TABLE_GROUP(etgl),
+ E_TABLE_SUBSET(etgl->ets)->map_table[row]);
}
static void
etgl_cursor_activated (GtkObject *object, gint view_row, ETableGroupLeaf *etgl)
{
if (view_row < E_TABLE_SUBSET(etgl->ets)->n_map)
- e_table_group_cursor_activated (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[view_row]);
+ e_table_group_cursor_activated (E_TABLE_GROUP(etgl),
+ E_TABLE_SUBSET(etgl->ets)->map_table[view_row]);
}
static void
-etgl_double_click (GtkObject *object, gint model_row, gint model_col, GdkEvent *event, ETableGroupLeaf *etgl)
+etgl_double_click (GtkObject *object, gint model_row, gint model_col, GdkEvent *event,
+ ETableGroupLeaf *etgl)
{
e_table_group_double_click (E_TABLE_GROUP(etgl), model_row, model_col, event);
}
@@ -159,22 +175,30 @@ static gint
etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl)
{
if (row < E_TABLE_SUBSET(etgl->ets)->n_map && row >= 0)
- return e_table_group_key_press (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event);
+ return e_table_group_key_press (E_TABLE_GROUP(etgl),
+ E_TABLE_SUBSET(etgl->ets)->map_table[row],
+ col,
+ event);
else
return 0;
}
static gint
-etgl_start_drag (GtkObject *object, gint model_row, gint model_col, GdkEvent *event, ETableGroupLeaf *etgl)
+etgl_start_drag (GtkObject *object, gint model_row, gint model_col, GdkEvent *event,
+ ETableGroupLeaf *etgl)
{
return e_table_group_start_drag (E_TABLE_GROUP(etgl), model_row, model_col, event);
}
static gint
-etgl_right_click (GtkObject *object, gint view_row, gint model_col, GdkEvent *event, ETableGroupLeaf *etgl)
+etgl_right_click (GtkObject *object, gint view_row, gint model_col, GdkEvent *event,
+ ETableGroupLeaf *etgl)
{
if (view_row < E_TABLE_SUBSET(etgl->ets)->n_map)
- return e_table_group_right_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[view_row], model_col, event);
+ return e_table_group_right_click (E_TABLE_GROUP(etgl),
+ E_TABLE_SUBSET(etgl->ets)->map_table[view_row],
+ model_col,
+ event);
else
return 0;
}
@@ -183,7 +207,10 @@ static gint
etgl_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl)
{
if (row < E_TABLE_SUBSET(etgl->ets)->n_map)
- return e_table_group_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->ets)->map_table[row], col, event);
+ return e_table_group_click (E_TABLE_GROUP(etgl),
+ E_TABLE_SUBSET(etgl->ets)->map_table[row],
+ col,
+ event);
else
return 0;
}
@@ -192,12 +219,14 @@ static void
etgl_reflow (GnomeCanvasItem *item, gint flags)
{
ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item);
+
gtk_object_get(GTK_OBJECT(leaf->item),
"height", &leaf->height,
NULL);
gtk_object_get(GTK_OBJECT(leaf->item),
"width", &leaf->width,
NULL);
+
e_canvas_item_request_parent_reflow (item);
}
@@ -209,27 +238,51 @@ etgl_realize (GnomeCanvasItem *item)
if (GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize)
GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item);
- etgl->item = E_TABLE_ITEM(gnome_canvas_item_new (GNOME_CANVAS_GROUP(etgl),
- e_table_item_get_type (),
- "ETableHeader", E_TABLE_GROUP(etgl)->header,
- "ETableModel", etgl->ets,
- "alternating_row_colors", etgl->alternating_row_colors,
- "horizontal_draw_grid", etgl->horizontal_draw_grid,
- "vertical_draw_grid", etgl->vertical_draw_grid,
- "drawfocus", etgl->draw_focus,
- "cursor_mode", etgl->cursor_mode,
- "minimum_width", etgl->minimum_width,
- "length_threshold", etgl->length_threshold,
- "selection_model", etgl->selection_model,
- NULL));
-
- etgl->etgl_cursor_change_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_change", GTK_SIGNAL_FUNC(etgl_cursor_change), etgl);
- etgl->etgl_cursor_activated_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "cursor_activated", GTK_SIGNAL_FUNC(etgl_cursor_activated), etgl);
- etgl->etgl_double_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "double_click", GTK_SIGNAL_FUNC(etgl_double_click), etgl);
- etgl->etgl_right_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "right_click", GTK_SIGNAL_FUNC(etgl_right_click), etgl);
- etgl->etgl_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "click", GTK_SIGNAL_FUNC(etgl_click), etgl);
- etgl->etgl_key_press_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "key_press", GTK_SIGNAL_FUNC(etgl_key_press), etgl);
- etgl->etgl_start_drag_id = gtk_signal_connect (GTK_OBJECT(etgl->item), "start_drag", GTK_SIGNAL_FUNC(etgl_start_drag), etgl);
+ etgl->item = E_TABLE_ITEM(gnome_canvas_item_new (
+ GNOME_CANVAS_GROUP(etgl),
+ e_table_item_get_type (),
+ "ETableHeader", E_TABLE_GROUP(etgl)->header,
+ "ETableModel", etgl->ets,
+ "alternating_row_colors", etgl->alternating_row_colors,
+ "horizontal_draw_grid", etgl->horizontal_draw_grid,
+ "vertical_draw_grid", etgl->vertical_draw_grid,
+ "drawfocus", etgl->draw_focus,
+ "cursor_mode", etgl->cursor_mode,
+ "minimum_width", etgl->minimum_width,
+ "length_threshold", etgl->length_threshold,
+ "selection_model", etgl->selection_model,
+ NULL));
+
+ etgl->etgl_cursor_change_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "cursor_change",
+ GTK_SIGNAL_FUNC(etgl_cursor_change),
+ etgl);
+ etgl->etgl_cursor_activated_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "cursor_activated",
+ GTK_SIGNAL_FUNC(etgl_cursor_activated),
+ etgl);
+ etgl->etgl_double_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "double_click",
+ GTK_SIGNAL_FUNC(etgl_double_click),
+ etgl);
+
+ etgl->etgl_right_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "right_click",
+ GTK_SIGNAL_FUNC(etgl_right_click),
+ etgl);
+ etgl->etgl_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "click",
+ GTK_SIGNAL_FUNC(etgl_click),
+ etgl);
+ etgl->etgl_key_press_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "key_press",
+ GTK_SIGNAL_FUNC(etgl_key_press),
+ etgl);
+ etgl->etgl_start_drag_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
+ "start_drag",
+ GTK_SIGNAL_FUNC(etgl_start_drag),
+ etgl);
+
e_canvas_item_request_reflow(item);
}
@@ -237,6 +290,7 @@ static void
etgl_add (ETableGroup *etg, gint row)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
e_table_subset_variable_add (E_TABLE_SUBSET_VARIABLE(etgl->ets), row);
}
@@ -246,6 +300,7 @@ static void
etgl_add_array (ETableGroup *etg, const gint *array, gint count)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
e_table_subset_variable_add_array (E_TABLE_SUBSET_VARIABLE(etgl->ets), array, count);
}
@@ -255,6 +310,7 @@ static void
etgl_add_all (ETableGroup *etg)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
e_table_subset_variable_add_all (E_TABLE_SUBSET_VARIABLE(etgl->ets));
}
@@ -264,6 +320,7 @@ static gboolean
etgl_remove (ETableGroup *etg, gint row)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
return e_table_subset_variable_remove (E_TABLE_SUBSET_VARIABLE(etgl->ets), row);
}
@@ -274,6 +331,7 @@ static void
etgl_increment (ETableGroup *etg, gint position, gint amount)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
e_table_subset_variable_increment (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount);
}
@@ -283,6 +341,7 @@ static void
etgl_decrement (ETableGroup *etg, gint position, gint amount)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
e_table_subset_variable_decrement (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount);
}
@@ -292,6 +351,7 @@ static int
etgl_row_count (ETableGroup *etg)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
return e_table_model_row_count(E_TABLE_MODEL(etgl->ets));
}
@@ -299,6 +359,7 @@ static void
etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
if (direction == E_FOCUS_END) {
e_table_item_set_cursor (etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->ets)) - 1);
} else {
@@ -310,6 +371,7 @@ static gint
etgl_get_focus_column (ETableGroup *etg)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
return e_table_item_get_focused_column (etgl->item);
}
@@ -317,6 +379,7 @@ static EPrintable *
etgl_get_printable (ETableGroup *etg)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
return e_table_item_get_printable (etgl->item);
}
@@ -324,6 +387,7 @@ static void
etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
e_table_item_compute_location (etgl->item, x, y, row, col);
}
@@ -331,6 +395,7 @@ static void
etgl_get_cell_geometry (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+
e_table_item_get_cell_geometry (etgl->item, row, col, x, y, width, height);
}
@@ -463,7 +528,7 @@ etgl_class_init (GtkObjectClass *object_class)
object_class->get_arg = etgl_get_arg;
item_class->realize = etgl_realize;
-
+
etgl_parent_class = gtk_type_class (PARENT_TYPE);
e_group_class->add = etgl_add;
@@ -494,9 +559,9 @@ etgl_class_init (GtkObjectClass *object_class)
gtk_object_add_arg_type ("ETableGroupLeaf::selection_model", E_SELECTION_MODEL_TYPE,
GTK_ARG_WRITABLE, ARG_SELECTION_MODEL);
- gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE,
+ gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE,
GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE,
+ gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("ETableGroupLeaf::minimum_width", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index d9174452be..32c972ed40 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -44,17 +44,27 @@ static void
etg_destroy (GtkObject *object)
{
ETableGroup *etg = E_TABLE_GROUP(object);
- if (etg->header)
+
+ if (etg->header) {
gtk_object_unref (GTK_OBJECT(etg->header));
- if (etg->full_header)
+ etg->header = NULL;
+ }
+
+ if (etg->full_header) {
gtk_object_unref (GTK_OBJECT(etg->full_header));
- if (etg->model)
+ etg->full_header = NULL;
+ }
+
+ if (etg->model) {
gtk_object_unref (GTK_OBJECT(etg->model));
+ etg->model = NULL;
+ }
+
if (GTK_OBJECT_CLASS (etg_parent_class)->destroy)
GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
}
-/**
+/**
* e_table_group_new
* @parent: The %GnomeCanvasGroup to create a child of.
* @full_header: The full header of the %ETable.
@@ -81,7 +91,7 @@ e_table_group_new (GnomeCanvasGroup *parent,
int n)
{
g_return_val_if_fail (model != NULL, NULL);
-
+
if (n < e_table_sort_info_grouping_get_count(sort_info)) {
return e_table_group_container_new (parent, full_header, header, model, sort_info, n);
} else {
@@ -90,7 +100,7 @@ e_table_group_new (GnomeCanvasGroup *parent,
return NULL;
}
-/**
+/**
* e_table_group_construct
* @parent: The %GnomeCanvasGroup to create a child of.
* @etg: The %ETableGroup to construct.
@@ -116,7 +126,7 @@ e_table_group_construct (GnomeCanvasGroup *parent,
gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
}
-/**
+/**
* e_table_group_add
* @etg: The %ETableGroup to add a row to
* @row: The row to add.
@@ -131,11 +141,11 @@ e_table_group_add (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->add)
- ETG_CLASS (etg)->add (etg, row);
+ g_assert (ETG_CLASS (etg)->add != NULL);
+ ETG_CLASS (etg)->add (etg, row);
}
-/**
+/**
* e_table_group_add_array
* @etg: The %ETableGroup to add to
* @array: The array to add.
@@ -152,11 +162,11 @@ e_table_group_add_array (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->add_array)
- ETG_CLASS (etg)->add_array (etg, array, count);
+ g_assert (ETG_CLASS (etg)->add_array != NULL);
+ ETG_CLASS (etg)->add_array (etg, array, count);
}
-/**
+/**
* e_table_group_add_all
* @etg: The %ETableGroup to add to
*
@@ -169,11 +179,11 @@ e_table_group_add_all (ETableGroup *etg)
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->add_all)
- ETG_CLASS (etg)->add_all (etg);
+ g_assert (ETG_CLASS (etg)->add_all != NULL);
+ ETG_CLASS (etg)->add_all (etg);
}
-/**
+/**
* e_table_group_remove
* @etg: The %ETableGroup to remove a row from
* @row: The row to remove.
@@ -191,13 +201,11 @@ e_table_group_remove (ETableGroup *etg,
g_return_val_if_fail (etg != NULL, FALSE);
g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE);
- if (ETG_CLASS (etg)->remove)
- return ETG_CLASS (etg)->remove (etg, row);
- else
- return FALSE;
+ g_assert (ETG_CLASS (etg)->remove != NULL);
+ return ETG_CLASS (etg)->remove (etg, row);
}
-/**
+/**
* e_table_group_increment
* @etg: The %ETableGroup to increment
* @position: The position to increment from
@@ -215,11 +223,11 @@ e_table_group_increment (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->increment)
- ETG_CLASS (etg)->increment (etg, position, amount);
+ g_assert (ETG_CLASS (etg)->increment != NULL);
+ ETG_CLASS (etg)->increment (etg, position, amount);
}
-/**
+/**
* e_table_group_increment
* @etg: The %ETableGroup to decrement
* @position: The position to decrement from
@@ -237,11 +245,11 @@ e_table_group_decrement (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->decrement)
- ETG_CLASS (etg)->decrement (etg, position, amount);
+ g_assert (ETG_CLASS (etg)->decrement != NULL);
+ ETG_CLASS (etg)->decrement (etg, position, amount);
}
-/**
+/**
* e_table_group_increment
* @etg: The %ETableGroup to count
*
@@ -253,15 +261,13 @@ gint
e_table_group_row_count (ETableGroup *etg)
{
g_return_val_if_fail (etg != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), 0);
+ g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
- if (ETG_CLASS (etg)->row_count)
- return ETG_CLASS (etg)->row_count (etg);
- else
- return 0;
+ g_assert (ETG_CLASS (etg)->row_count != NULL);
+ return ETG_CLASS (etg)->row_count (etg);
}
-/**
+/**
* e_table_group_set_focus
* @etg: The %ETableGroup to set
* @direction: The direction the focus is coming from.
@@ -278,11 +284,11 @@ e_table_group_set_focus (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->set_focus)
- ETG_CLASS (etg)->set_focus (etg, direction, view_col);
+ g_assert (ETG_CLASS (etg)->set_focus != NULL);
+ ETG_CLASS (etg)->set_focus (etg, direction, view_col);
}
-/**
+/**
* e_table_group_get_focus
* @etg: The %ETableGroup to check
*
@@ -296,13 +302,11 @@ e_table_group_get_focus (ETableGroup *etg)
g_return_val_if_fail (etg != NULL, FALSE);
g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE);
- if (ETG_CLASS (etg)->get_focus)
- return ETG_CLASS (etg)->get_focus (etg);
- else
- return FALSE;
+ g_assert (ETG_CLASS (etg)->get_focus != NULL);
+ return ETG_CLASS (etg)->get_focus (etg);
}
-/**
+/**
* e_table_group_get_focus_column
* @etg: The %ETableGroup to check
*
@@ -314,15 +318,13 @@ gint
e_table_group_get_focus_column (ETableGroup *etg)
{
g_return_val_if_fail (etg != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE);
+ g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
- if (ETG_CLASS (etg)->get_focus_column)
- return ETG_CLASS (etg)->get_focus_column (etg);
- else
- return -1;
+ g_assert (ETG_CLASS (etg)->get_focus_column != NULL);
+ return ETG_CLASS (etg)->get_focus_column (etg);
}
-/**
+/**
* e_table_group_get_printable
* @etg: %ETableGroup which will be printed
*
@@ -337,13 +339,11 @@ e_table_group_get_printable (ETableGroup *etg)
g_return_val_if_fail (etg != NULL, NULL);
g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL);
- if (ETG_CLASS (etg)->get_printable)
- return ETG_CLASS (etg)->get_printable (etg);
- else
- return NULL;
+ g_assert (ETG_CLASS (etg)->get_printable != NULL);
+ return ETG_CLASS (etg)->get_printable (etg);
}
-/**
+/**
* e_table_group_compute_location
* @eti: %ETableGroup to look in.
* @x: A pointer to the x location to find in the %ETableGroup.
@@ -363,11 +363,11 @@ e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->compute_location)
- ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
+ g_assert (ETG_CLASS (etg)->compute_location != NULL);
+ ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
}
-/**
+/**
* e_table_group_get_position
* @eti: %ETableGroup to look in.
* @x: A pointer to the location to store the found x location in.
@@ -393,11 +393,11 @@ e_table_group_get_cell_geometry (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- if (ETG_CLASS (etg)->get_cell_geometry)
- ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
+ g_assert (ETG_CLASS (etg)->get_cell_geometry != NULL);
+ ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
}
-/**
+/**
* e_table_group_cursor_change
* @eti: %ETableGroup to emit the signal on
* @row: The new cursor row (model row)
@@ -415,7 +415,7 @@ e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
row);
}
-/**
+/**
* e_table_group_cursor_activated
* @eti: %ETableGroup to emit the signal on
* @row: The cursor row (model row)
@@ -433,7 +433,7 @@ e_table_group_cursor_activated (ETableGroup *e_table_group, gint row)
row);
}
-/**
+/**
* e_table_group_double_click
* @eti: %ETableGroup to emit the signal on
* @row: The row clicked on (model row)
@@ -453,7 +453,7 @@ e_table_group_double_click (ETableGroup *e_table_group, gint row, gint col, GdkE
row, col, event);
}
-/**
+/**
* e_table_group_right_click
* @eti: %ETableGroup to emit the signal on
* @row: The row clicked on (model row)
@@ -477,7 +477,7 @@ e_table_group_right_click (ETableGroup *e_table_group, gint row, gint col, GdkEv
return return_val;
}
-/**
+/**
* e_table_group_click
* @eti: %ETableGroup to emit the signal on
* @row: The row clicked on (model row)
@@ -501,7 +501,7 @@ e_table_group_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *e
return return_val;
}
-/**
+/**
* e_table_group_key_press
* @eti: %ETableGroup to emit the signal on
* @row: The cursor row (model row)
@@ -525,7 +525,7 @@ e_table_group_key_press (ETableGroup *e_table_group, gint row, gint col, GdkEven
return return_val;
}
-/**
+/**
* e_table_group_start_drag
* @eti: %ETableGroup to emit the signal on
* @row: The cursor row (model row)
@@ -549,7 +549,7 @@ e_table_group_start_drag (ETableGroup *e_table_group, gint row, gint col, GdkEve
return return_val;
}
-/**
+/**
* e_table_group_get_header
* @eti: %ETableGroup to check
*
@@ -612,7 +612,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->click = NULL;
klass->key_press = NULL;
klass->start_drag = NULL;
-
+
klass->add = NULL;
klass->add_array = NULL;
klass->add_all = NULL;
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index 56c7bed164..dd5625df99 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -321,7 +321,8 @@ eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
*
* This function adds the @tc ETableCol definition into the @eth ETableHeader
* at position @pos. This is the way you add new ETableCols to the
- * ETableHeader.
+ * ETableHeader. The header will assume ownership of the @tc; you should not
+ * unref it after you add it.
*
* This function will emit the "structure_change" signal on the @eth object.
* The ETableCol is assumed
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 5ac8e45a61..bf2f884c45 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -700,6 +700,8 @@ et_canvas_realize (GtkWidget *canvas, ETable *e_table)
static void
et_canvas_button_press (GtkWidget *canvas, GdkEvent *event, ETable *e_table)
{
+ fprintf (stderr, "et_canvas_button_press(): PRESSED\n");
+
if (GTK_WIDGET_HAS_FOCUS(canvas)) {
GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item;