aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/ChangeLog23
-rw-r--r--widgets/table/e-cell-text.c6
-rw-r--r--widgets/table/e-table-config.c10
-rw-r--r--widgets/table/e-table-group.c26
-rw-r--r--widgets/table/e-table-header-utils.c9
-rw-r--r--widgets/table/e-table-item.c13
-rw-r--r--widgets/table/e-tree-table-adapter.c2
7 files changed, 56 insertions, 33 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index ab9bd4ea90..e0ff5149c1 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,26 @@
+2007-08-31 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Move away from g_assert to g_return* critical warnings to debug
+ them better.
+
+ * e-cell-text.c: (ect_edit_select_all), (_get_position):
+ * e-table-config.c: (configure_combo_box_add),
+ (configure_combo_box_set_active),
+ (update_sort_and_group_config_dialog):
+ * e-table-group.c: (e_table_group_add), (e_table_group_add_array),
+ (e_table_group_add_all), (e_table_group_remove),
+ (e_table_group_increment), (e_table_group_decrement),
+ (e_table_group_row_count), (e_table_group_set_focus),
+ (e_table_group_get_focus), (e_table_group_get_focus_column),
+ (e_table_group_get_printable), (e_table_group_compute_location),
+ (e_table_group_get_cell_geometry):
+ * e-table-header-utils.c: (e_table_header_compute_height),
+ (make_composite_pixmap), (e_table_header_draw_button):
+ * e-table-item.c: (eti_attach_cell_views), (eti_row_height_real),
+ (eti_add_table_model), (eti_add_selection_model),
+ (eti_header_structure_changed), (eti_add_header_model):
+ * e-tree-table-adapter.c: (generate_tree):
+
2007-08-24 Milan Crha <mcrha@redhat.com>
** Fix for bug #239441
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 8558ca6540..ec20d6bbf3 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -888,7 +888,7 @@ ect_get_bg_color(ECellView *ecell_view, int row)
static void
ect_edit_select_all (ECellTextView *text_view)
{
- g_assert (text_view->edit);
+ g_return_if_fail (text_view->edit);
text_view->edit->selection_start = 0;
text_view->edit->selection_end = strlen (text_view->edit->text);
@@ -2327,7 +2327,9 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command)
default:
return edit->selection_end;
}
- g_assert_not_reached ();
+
+ g_return_val_if_reached(0);
+
return 0; /* Kill warning */
}
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 8e5e36e6d9..dd92445a77 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -175,12 +175,12 @@ configure_combo_box_add (GtkComboBox *combo_box, const gchar *item,
COLUMN_ITEM, item, COLUMN_VALUE, value, -1);
index = g_object_get_data (G_OBJECT (combo_box), "index");
- g_assert (index != NULL);
+ g_return_if_fail (index != NULL);
/* Add an entry to the tree model index. */
path = gtk_tree_model_get_path (model, &iter);
reference = gtk_tree_row_reference_new (model, path);
- g_assert (reference != NULL);
+ g_return_if_fail (reference != NULL);
g_hash_table_insert (index, g_strdup (value), reference);
gtk_tree_path_free (path);
}
@@ -211,7 +211,7 @@ configure_combo_box_set_active (GtkComboBox *combo_box, const gchar *value)
GHashTable *index;
index = g_object_get_data (G_OBJECT (combo_box), "index");
- g_assert (index != NULL);
+ g_return_if_fail (index != NULL);
reference = g_hash_table_lookup (index, value);
if (reference != NULL) {
@@ -338,9 +338,9 @@ update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
widgets [i].radio_ascending);
if (is_sort)
- g_assert (widgets [i].radio_ascending != config->group [i].radio_ascending);
+ g_return_if_fail (widgets [i].radio_ascending != config->group [i].radio_ascending);
else
- g_assert (widgets [i].radio_ascending != config->sort [i].radio_ascending);
+ g_return_if_fail (widgets [i].radio_ascending != config->sort [i].radio_ascending);
gtk_toggle_button_set_active (t, 1);
}
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index a9cdcae468..ba37abed96 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -156,7 +156,7 @@ e_table_group_add (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->add != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->add != NULL);
ETG_CLASS (etg)->add (etg, row);
}
@@ -177,7 +177,7 @@ e_table_group_add_array (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->add_array != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->add_array != NULL);
ETG_CLASS (etg)->add_array (etg, array, count);
}
@@ -194,7 +194,7 @@ e_table_group_add_all (ETableGroup *etg)
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->add_all != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->add_all != NULL);
ETG_CLASS (etg)->add_all (etg);
}
@@ -216,7 +216,7 @@ 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);
- g_assert (ETG_CLASS (etg)->remove != NULL);
+ g_return_val_if_fail (ETG_CLASS (etg)->remove != NULL, FALSE);
return ETG_CLASS (etg)->remove (etg, row);
}
@@ -238,7 +238,7 @@ e_table_group_increment (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->increment != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->increment != NULL);
ETG_CLASS (etg)->increment (etg, position, amount);
}
@@ -260,7 +260,7 @@ e_table_group_decrement (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->decrement != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->decrement != NULL);
ETG_CLASS (etg)->decrement (etg, position, amount);
}
@@ -278,7 +278,7 @@ 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), -1);
- g_assert (ETG_CLASS (etg)->row_count != NULL);
+ g_return_val_if_fail (ETG_CLASS (etg)->row_count != NULL, -1);
return ETG_CLASS (etg)->row_count (etg);
}
@@ -299,7 +299,7 @@ e_table_group_set_focus (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->set_focus != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->set_focus != NULL);
ETG_CLASS (etg)->set_focus (etg, direction, view_col);
}
@@ -317,7 +317,7 @@ 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);
- g_assert (ETG_CLASS (etg)->get_focus != NULL);
+ g_return_val_if_fail (ETG_CLASS (etg)->get_focus != NULL, FALSE);
return ETG_CLASS (etg)->get_focus (etg);
}
@@ -335,7 +335,7 @@ 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), -1);
- g_assert (ETG_CLASS (etg)->get_focus_column != NULL);
+ g_return_val_if_fail (ETG_CLASS (etg)->get_focus_column != NULL, -1);
return ETG_CLASS (etg)->get_focus_column (etg);
}
@@ -354,7 +354,7 @@ 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);
- g_assert (ETG_CLASS (etg)->get_printable != NULL);
+ g_return_val_if_fail (ETG_CLASS (etg)->get_printable != NULL, NULL);
return ETG_CLASS (etg)->get_printable (etg);
}
@@ -378,7 +378,7 @@ 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));
- g_assert (ETG_CLASS (etg)->compute_location != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->compute_location != NULL);
ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
}
@@ -408,7 +408,7 @@ e_table_group_get_cell_geometry (ETableGroup *etg,
g_return_if_fail (etg != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_assert (ETG_CLASS (etg)->get_cell_geometry != NULL);
+ g_return_if_fail (ETG_CLASS (etg)->get_cell_geometry != NULL);
ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
}
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 1bbb60eb07..807713d170 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -86,7 +86,7 @@ e_table_header_compute_height (ETableCol *ecol, GtkWidget *widget)
pango_layout_get_pixel_size (layout, NULL, &height);
if (ecol->is_pixbuf) {
- g_assert (ecol->pixbuf != NULL);
+ g_return_val_if_fail (ecol->pixbuf != NULL, -1);
height = MAX (height, gdk_pixbuf_get_height (ecol->pixbuf));
}
@@ -122,7 +122,7 @@ make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc,
pwidth = gdk_pixbuf_get_width (pixbuf);
pheight = gdk_pixbuf_get_height (pixbuf);
- g_assert (width <= pwidth && height <= pheight);
+ g_return_val_if_fail (width <= pwidth && height <= pheight, NULL);
color = ((bg->red & 0xff00) << 8) | (bg->green & 0xff00) | ((bg->blue & 0xff00) >> 8);
@@ -404,8 +404,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
}
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached();
}
if (inner_width < 1)
@@ -420,7 +419,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
int xpos;
GdkPixmap *pixmap;
- g_assert (ecol->pixbuf != NULL);
+ g_return_if_fail (ecol->pixbuf != NULL);
pwidth = gdk_pixbuf_get_width (ecol->pixbuf);
pheight = gdk_pixbuf_get_height (ecol->pixbuf);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 457f1ad778..adabf7c90f 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -354,8 +354,8 @@ eti_attach_cell_views (ETableItem *eti)
{
int i;
- g_assert (eti->header);
- g_assert (eti->table_model);
+ g_return_if_fail (eti->header);
+ g_return_if_fail (eti->table_model);
/* this is just c&p from model pre change, but it fixes things */
eti_cancel_drag_due_to_model_change (eti);
@@ -616,7 +616,7 @@ eti_row_height_real (ETableItem *eti, int row)
int col;
int h, max_h;
- g_assert (cols == 0 || eti->cell_views);
+ g_return_val_if_fail (cols == 0 || eti->cell_views, 0);
max_h = 0;
@@ -1257,7 +1257,7 @@ e_table_item_redraw_row (ETableItem *eti,
static void
eti_add_table_model (ETableItem *eti, ETableModel *table_model)
{
- g_assert (eti->table_model == NULL);
+ g_return_if_fail (eti->table_model == NULL);
eti->table_model = table_model;
g_object_ref (eti->table_model);
@@ -1310,7 +1310,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
static void
eti_add_selection_model (ETableItem *eti, ESelectionModel *selection)
{
- g_assert (eti->selection == NULL);
+ g_return_if_fail (eti->selection == NULL);
eti->selection = selection;
g_object_ref (eti->selection);
@@ -1354,7 +1354,6 @@ eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
* There should be at least one column
* BUT: then you can't remove all columns from a header and add new ones.
*/
- /*g_assert (eti->cols != 0);*/
if (eti->cell_views){
eti_unrealize_cell_views (eti);
@@ -1388,7 +1387,7 @@ eti_request_column_width (ETableHeader *eth, int col, ETableItem *eti)
static void
eti_add_header_model (ETableItem *eti, ETableHeader *header)
{
- g_assert (eti->header == NULL);
+ g_return_if_fail (eti->header == NULL);
eti->header = header;
g_object_ref (header);
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 0cd84650e5..93c73e1d1e 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -362,7 +362,7 @@ generate_tree(ETreeTableAdapter *etta, ETreePath path)
e_table_model_pre_change(E_TABLE_MODEL(etta));
- g_assert(e_tree_model_node_is_root(etta->priv->source, path));
+ g_return_if_fail (e_tree_model_node_is_root(etta->priv->source, path));
if (etta->priv->root)
kill_gnode(etta->priv->root, etta);