aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-10-12 03:37:46 +0800
committerChris Lahey <clahey@src.gnome.org>2000-10-12 03:37:46 +0800
commitd7c03c7ff097f93239379299ba5ce0843d652025 (patch)
treefe904a5570aeabcb6777c4dc682834d131db3f12 /widgets/table
parent9bf48a86096adc3cf230259c8d73194c5d8a18be (diff)
downloadgsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar.gz
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar.bz2
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar.lz
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar.xz
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.tar.zst
gsoc2013-evolution-d7c03c7ff097f93239379299ba5ce0843d652025.zip
Make saving state work properly.
2000-10-11 Christopher James Lahey <clahey@helixcode.com> * e-table.c: Make saving state work properly. svn path=/trunk/; revision=5859
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index feea12d0e5..e51bc39506 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -733,14 +733,54 @@ void e_table_load_state (ETable *e_table
gtk_object_sink(GTK_OBJECT(state));
}
+static ETableState *
+et_get_state (ETable *e_table)
+{
+ ETableState *state;
+ int full_col_count;
+ int i, j;
+
+ state = e_table_state_new();
+ state->sort_info = e_table->sort_info;
+ gtk_object_ref(GTK_OBJECT(state->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);
+ for (i = 0; i < state->col_count; i++) {
+ int col_idx = e_table_header_index(e_table->header, i);
+ state->columns[i] = -1;
+ for (j = 0; j < full_col_count; j++) {
+ if (col_idx == e_table_header_index(e_table->full_header, j)) {
+ state->columns[i] = j;
+ break;
+ }
+ }
+ }
+
+ return state;
+}
+
gchar *e_table_get_state (ETable *e_table)
{
- return NULL;
+ ETableState *state;
+ gchar *string;
+
+ state = et_get_state(e_table);
+ string = e_table_state_save_to_string(state);
+ gtk_object_sink(state);
+ return string;
}
void e_table_save_state (ETable *e_table,
const gchar *filename)
{
+ ETableState *state;
+
+ state = et_get_state(e_table);
+ e_table_state_save_to_file(state, filename);
+ gtk_object_sink(state);
}
@@ -925,8 +965,6 @@ e_table_new_from_spec_file (ETableModel *etm, ETableExtras *ete, const char *spe
return GTK_WIDGET (e_table);
}
-
-
#if 0
static xmlNode *
et_build_column_spec (ETable *e_table)