diff options
-rw-r--r-- | widgets/table/e-cell-vbox.c | 3 | ||||
-rw-r--r-- | widgets/table/e-table-header.c | 4 | ||||
-rw-r--r-- | widgets/table/e-table-header.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-memory-store.c | 6 | ||||
-rw-r--r-- | widgets/table/e-table.c | 42 | ||||
-rw-r--r-- | widgets/table/e-table.h | 1 |
6 files changed, 39 insertions, 19 deletions
diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c index bbbc4013e3..a854c2dae1 100644 --- a/widgets/table/e-cell-vbox.c +++ b/widgets/table/e-cell-vbox.c @@ -153,9 +153,10 @@ ecv_draw (ECellView *ecell_view, GdkDrawable *drawable, for (i = 0; i < vbox_view->subcell_view_count; i++) { /* Now cause our subcells to draw their contents, shifted by subcell_offset pixels */ + int height = e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row); e_cell_draw (vbox_view->subcell_views[i], drawable, vbox_view->model_cols[i], view_col, row, flags, - x1, y1 + subcell_offset, x2, y2); + x1, y1 + subcell_offset, x2, y1 + subcell_offset + height); subcell_offset += e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row); } diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index ad585bdc2b..d983ab36e7 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -599,7 +599,7 @@ e_table_header_move (ETableHeader *eth, int source_index, int target_index) eth_do_insert (eth, target_index, old); eth_update_offsets (eth); - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); + gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], eth->width); gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]); } @@ -838,7 +838,7 @@ eth_calc_widths (ETableHeader *eth) } g_free (widths); if (changed) - gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]); + gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], eth->width); eth_update_offsets (eth); } diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index 6bde250b91..355618b5a6 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -66,7 +66,7 @@ typedef struct { GtkObjectClass parent_class; void (*structure_change) (ETableHeader *eth); - void (*dimension_change) (ETableHeader *eth, int col); + void (*dimension_change) (ETableHeader *eth, int width); void (*expansion_change) (ETableHeader *eth); int (*request_width) (ETableHeader *eth, int col); } ETableHeaderClass; diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c index d3485e1153..67c1292119 100644 --- a/widgets/table/e-table-memory-store.c +++ b/widgets/table/e-table-memory-store.c @@ -42,7 +42,8 @@ duplicate_value (ETableMemoryStore *etms, int col, const void *val) case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING: return g_strdup (val); case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF: - gdk_pixbuf_ref ((GdkPixbuf *) val); + if (val) + gdk_pixbuf_ref ((GdkPixbuf *) val); return (GdkPixbuf *) val; case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM: if (etms->priv->columns[col].custom.duplicate_value) @@ -107,7 +108,8 @@ etms_free_value (ETableModel *etm, int col, void *value) g_free (value); break; case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF: - gdk_pixbuf_unref (value); + if (value) + gdk_pixbuf_unref (value); break; case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM: if (etms->priv->columns[col].custom.free_value) diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 72874991d3..110d7a25e5 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -192,27 +192,37 @@ e_table_state_change (ETable *et) et_signals [STATE_CHANGE]); } +#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header); + static void -e_table_header_change (ETable *et) +set_header_width (ETable *et) { - e_table_state_change (et); if (et->horizontal_resize) { int width = e_table_header_total_width (et->header); - gtk_widget_set_usize (GTK_WIDGET (et->header_canvas), width, + gtk_widget_set_usize (GTK_WIDGET (et->table_canvas), width, -2); + gtk_widget_queue_resize (GTK_WIDGET (et->table_canvas)); } } static void structure_changed (ETableHeader *header, ETable *et) { - e_table_header_change (et); + e_table_state_change (et); + set_header_width (et); } static void expansion_changed (ETableHeader *header, ETable *et) { - e_table_header_change (et); + e_table_state_change (et); + set_header_width (et); +} + +static void +dimension_changed (ETableHeader *header, int total_width, ETable *et) +{ + set_header_width (et); } static void @@ -227,6 +237,9 @@ disconnect_header (ETable *e_table) if (e_table->expansion_change_id) gtk_signal_disconnect (GTK_OBJECT (e_table->header), e_table->expansion_change_id); + if (e_table->dimension_change_id) + gtk_signal_disconnect (GTK_OBJECT (e_table->header), + e_table->dimension_change_id); gtk_object_unref(GTK_OBJECT(e_table->header)); e_table->header = NULL; @@ -246,6 +259,9 @@ connect_header (ETable *e_table, ETableState *state) e_table->expansion_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "expansion_change", expansion_changed, e_table); + e_table->dimension_change_id = + gtk_signal_connect (GTK_OBJECT (e_table->header), "dimension_change", + dimension_changed, e_table); } static void @@ -400,6 +416,7 @@ e_table_init (GtkObject *object) e_table->sort_info_change_id = 0; e_table->structure_change_id = 0; e_table->expansion_change_id = 0; + e_table->dimension_change_id = 0; e_table->reflow_idle_id = 0; e_table->scroll_idle_id = 0; @@ -774,8 +791,7 @@ et_table_row_changed (ETableModel *table_model, int row, ETable *et) if (!et->need_rebuild) { if (e_table_group_remove (et->group, row)) e_table_group_add (et->group, row); - if (et->horizontal_scrolling || et->horizontal_resize) - e_table_header_update_horizontal(et->header); + CHECK_HORIZONTAL(et); } } @@ -796,8 +812,7 @@ et_table_rows_inserted (ETableModel *table_model, int row, int count, ETable *et e_table_group_increment(et->group, row, count); for (i = 0; i < count; i++) e_table_group_add (et->group, row + i); - if (et->horizontal_scrolling || et->horizontal_resize) - e_table_header_update_horizontal(et->header); + CHECK_HORIZONTAL(et); } } @@ -811,8 +826,7 @@ et_table_rows_deleted (ETableModel *table_model, int row, int count, ETable *et) e_table_group_remove (et->group, row + i); if (row != row_count) e_table_group_decrement(et->group, row, count); - if (et->horizontal_scrolling || et->horizontal_resize) - e_table_header_update_horizontal(et->header); + CHECK_HORIZONTAL(et); } } @@ -907,8 +921,7 @@ changed_idle (gpointer data) et->need_rebuild = 0; et->rebuild_idle_id = 0; - if (et->horizontal_scrolling || et->horizontal_resize) - e_table_header_update_horizontal(et->header); + CHECK_HORIZONTAL(et); return FALSE; } @@ -920,6 +933,9 @@ et_canvas_realize (GtkWidget *canvas, ETable *e_table) e_table->white_item, "fill_color_gdk", >K_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL], NULL); + + CHECK_HORIZONTAL(e_table); + set_header_width (e_table); } static void diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 932420bb1b..e3c7623d9d 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -94,6 +94,7 @@ typedef struct { int structure_change_id; int expansion_change_id; + int dimension_change_id; int reflow_idle_id; int scroll_idle_id; |