diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-27 04:13:10 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-02 22:34:09 +0800 |
commit | a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b (patch) | |
tree | cd56cc63ee06deb083b6ffaae89b2dc3075df86e /e-util/e-table.c | |
parent | 93987da1f5e4733e0eb0ba944f06809b4e4d52cb (diff) | |
download | gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar.gz gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar.bz2 gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar.lz gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar.xz gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.tar.zst gsoc2013-evolution-a26bdd4ed4fe7e9fe511b53a013ae7b7e029710b.zip |
ETableState: Convert the column index array to a column spec array.
Diffstat (limited to 'e-util/e-table.c')
-rw-r--r-- | e-util/e-table.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/e-util/e-table.c b/e-util/e-table.c index 0aae2032b6..9b97c8b227 100644 --- a/e-util/e-table.c +++ b/e-util/e-table.c @@ -1677,31 +1677,39 @@ ETableState * e_table_get_state_object (ETable *e_table) { ETableState *state; + GPtrArray *columns; gint full_col_count; gint i, j; + columns = e_table_specification_ref_columns (e_table->spec); + state = e_table_state_new (e_table->spec); - if (state->sort_info) - g_object_unref (state->sort_info); - state->sort_info = e_table->sort_info; - g_object_ref (state->sort_info); + + g_clear_object (&state->sort_info); + state->sort_info = g_object_ref (e_table->sort_info); state->col_count = e_table_header_count (e_table->header); full_col_count = e_table_header_count (e_table->full_header); - state->columns = g_new (int, state->col_count); - state->expansions = g_new (double, state->col_count); + + state->column_specs = g_new ( + ETableColumnSpecification *, state->col_count); + state->expansions = g_new (gdouble, state->col_count); + for (i = 0; i < state->col_count; i++) { ETableCol *col = e_table_header_get_column (e_table->header, i); - state->columns[i] = -1; + state->column_specs[i] = NULL; for (j = 0; j < full_col_count; j++) { if (col->spec->model_col == e_table_header_index (e_table->full_header, j)) { - state->columns[i] = j; + state->column_specs[i] = + g_object_ref (columns->pdata[j]); break; } } state->expansions[i] = col->expansion; } + g_ptr_array_unref (columns); + return state; } |