aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-cell-text.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-cell-text.c')
-rw-r--r--widgets/table/e-cell-text.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index a354efde13..d7ef682fde 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -73,6 +73,7 @@ enum {
ARG_ELLIPSIS,
ARG_STRIKEOUT_COLUMN,
ARG_BOLD_COLUMN,
+ ARG_TEXT_FILTER,
};
@@ -1045,7 +1046,13 @@ ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
GdkFont *font;
font = text_view->font;
- return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
+ if (text_view->filter) {
+ char *string = text_view->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ int value = (font->ascent + font->descent) * number_of_lines(string) + TEXT_PAD;
+ g_free(string);
+ return value;
+ } else
+ return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
}
/*
@@ -1055,7 +1062,7 @@ static void *
ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+ char *str;
CellEdit *edit;
edit = g_new (CellEdit, 1);
@@ -1096,7 +1103,12 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
edit->pointer_in = FALSE;
edit->default_cursor_shown = TRUE;
- edit->old_text = g_strdup (str);
+ if (ect->filter) {
+ str = ect->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ edit->old_text = str;
+ } else {
+ edit->old_text = g_strdup (str);
+ }
edit->cell.text = g_strdup (str);
#if 0