diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-03-23 14:46:46 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-03-23 14:46:46 +0800 |
commit | e4affa9382419295eb9911d5528c1b9e38cb6283 (patch) | |
tree | fff0551a2c7b9c44093a69532b49fe2f88f8f833 /widgets | |
parent | 9755d8bb70c96140ef4f30f231241946d1524319 (diff) | |
download | gsoc2013-evolution-e4affa9382419295eb9911d5528c1b9e38cb6283.tar.gz gsoc2013-evolution-e4affa9382419295eb9911d5528c1b9e38cb6283.tar.zst gsoc2013-evolution-e4affa9382419295eb9911d5528c1b9e38cb6283.zip |
Made this not create the new font until realize instead of at new_view
2001-03-23 Christopher James Lahey <clahey@ximian.com>
* e-cell-text.c: Made this not create the new font until realize
instead of at new_view time.
* e-table-item.c: Don't request heights or do other things that
you aren't allowed to do before realization unless you're
realized.
svn path=/trunk/; revision=8915
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-cell-text.c | 24 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 19 |
2 files changed, 28 insertions, 15 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 969e17f84f..4143491c64 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -323,27 +323,12 @@ ect_cancel_edit (ECellTextView *text_view) static ECellView * ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) { - ECellText *ect = E_CELL_TEXT (ecell); ECellTextView *text_view = g_new0 (ECellTextView, 1); GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas; text_view->cell_view.ecell = ecell; text_view->cell_view.e_table_model = table_model; text_view->cell_view.e_table_item_view = e_table_item_view; - - if (ect->font_name){ -#if 0 - GdkFont *f; - - f = gdk_fontset_load (ect->font_name); - text_view->font = f; -#endif - text_view->font = e_font_from_gdk_name (ect->font_name); - } - if (!text_view->font){ - gdk_font_ref (GTK_WIDGET (canvas)->style->font); - text_view->font = e_font_from_gdk_font (GTK_WIDGET (canvas)->style->font); - } text_view->canvas = canvas; @@ -371,11 +356,20 @@ static void ect_realize (ECellView *ecell_view) { ECellTextView *text_view = (ECellTextView *) ecell_view; + ECellText *ect = (ECellText *) ecell_view->ecell; text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window); text_view->i_cursor = gdk_cursor_new (GDK_XTERM); + if (ect->font_name){ + text_view->font = e_font_from_gdk_name (ect->font_name); + } + if (!text_view->font){ + gdk_font_ref (GTK_WIDGET (text_view->canvas)->style->font); + text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font); + } + calc_ellipsis (text_view); if (parent_class->realize) diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index c675da9e8b..ca36054ce5 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -28,6 +28,10 @@ #define FOCUSED_BORDER 2 +/* FIXME: Do an analysis of which cell functions are needed before + realize and make sure that all of them are doable by all the cells + and that all of the others are only done after realization. */ + static GnomeCanvasItemClass *eti_parent_class; enum { @@ -590,6 +594,8 @@ eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti) static void eti_table_model_changed (ETableModel *table_model, ETableItem *eti) { + if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) + return; #if 0 int view_row; #endif @@ -685,6 +691,8 @@ eti_request_region_show (ETableItem *eti, static void eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) { + if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) + return; if (eti->renderers_can_change_size && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) { @@ -698,6 +706,8 @@ eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) static void eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETableItem *eti) { + if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) + return; if (eti->renderers_can_change_size && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) { @@ -711,6 +721,8 @@ eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETable static void eti_table_model_rows_inserted (ETableModel *table_model, int row, int count, ETableItem *eti) { + if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) + return; eti->rows = e_table_model_row_count (eti->table_model); if (eti->height_cache) { @@ -730,6 +742,8 @@ eti_table_model_rows_inserted (ETableModel *table_model, int row, int count, ETa static void eti_table_model_rows_deleted (ETableModel *table_model, int row, int count, ETableItem *eti) { + if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) + return; eti->rows = e_table_model_row_count (eti->table_model); if (eti->height_cache) @@ -1130,6 +1144,9 @@ eti_realize (GnomeCanvasItem *item) if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize) (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item); + + eti->rows = e_table_model_row_count (eti->table_model); + /* * Gdk Resource allocation */ @@ -1166,6 +1183,8 @@ eti_realize (GnomeCanvasItem *item) eti_realize_cell_views (eti); + free_height_cache(eti); + eti->needs_compute_height = 1; eti->needs_compute_width = 1; e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); |