aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-state.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-table-state.c')
-rw-r--r--widgets/table/e-table-state.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c
index 91f1178a33..c9049b7a18 100644
--- a/widgets/table/e-table-state.c
+++ b/widgets/table/e-table-state.c
@@ -46,6 +46,7 @@ etst_init (ETableState *state)
{
state->columns = NULL;
state->expansions = NULL;
+ state->sort_info = e_table_sort_info_new();
}
E_MAKE_TYPE(e_table_state, "ETableState", ETableState, etst_class_init, etst_init, PARENT_TYPE);
@@ -152,7 +153,7 @@ e_table_state_save_to_string (ETableState *state)
int length;
xmlDoc *doc;
- doc = xmlNewDoc(NULL);
+ doc = xmlNewDoc("1.0");
xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL));
xmlDocDumpMemory(doc, &string, &length);
xmlFreeDoc(doc);
@@ -192,3 +193,23 @@ e_table_state_save_to_node (ETableState *state,
return node;
}
+
+/**
+ * e_table_state_duplicate:
+ * @state: state to duplicate
+ *
+ * This creates a copy of the %ETableState @state
+ *
+ * Returns: The duplicated %ETableState.
+ */
+ETableState *
+e_table_state_duplicate (ETableState *state)
+{
+ ETableState *new_state = e_table_state_new ();
+ char *state_str = e_table_state_save_to_string (state);
+
+ printf ("This is the state: \n%s\n", state_str);
+ e_table_state_load_from_string (new_state, state_str);
+
+ return new_state;
+}