From d645d1f2362a623b037cbfa09405e09b0f530c71 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 17 Jan 2001 06:56:04 +0000 Subject: Load frames. 2001-01-16 Miguel de Icaza * e-table-config.c (configure_sort_dialog): Load frames. * Kill e-table-config-field.c * e-table-specification.c (e_table_specification_save_to_file): Specify version to xmlNewDoc. * e-table-state.c (e_table_state_save_to_string): Specify version to xmlNewDoc. * e-table-config.c (config_destroy): Destroy the copies. Unref the originals. (e_table_config_construct): Duplicate values of configuration here. (configure_sort_dialog): New function that populates the sort gtk combo boxes. * e-table.c (et_col_spec_to_col): Fixup use of title here. Do the actual translation here. * e-table-column-specification.c: Remove title_, it is now called title. Translation needs to take place elsewhere, not here * e-table-specification.c (e_table_specification_duplicate): Add preconditions here. (e_table_specification_save_to_node): ditto. (e_table_specification_save_to_string): ditto. (e_table_specification_save_to_file): ditto. * e-table-state.c (e_table_state_duplicate): Implement. * e-table-config.glade (dialog_sort): Change drop down menus to use GtkComboText widgets. * e-table-config.c (configure_dialog): New function, used to set up dialogs. svn path=/trunk/; revision=7563 --- widgets/table/e-table-specification.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'widgets/table/e-table-specification.c') diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index fa80d6a40c..b9a3c4ee98 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -228,6 +228,10 @@ e_table_specification_save_to_file (ETableSpecification *specification, { xmlDoc *doc; + g_return_val_if_fail (specification != NULL, -1); + g_return_val_if_fail (filename != NULL, -1); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), -1); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); return xmlSaveFile (filename, doc); @@ -251,6 +255,9 @@ e_table_specification_save_to_string (ETableSpecification *specification) int length; xmlDoc *doc; + g_return_val_if_fail (specification != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); xmlDocDumpMemory (doc, &string, &length); @@ -275,9 +282,14 @@ xmlNode * e_table_specification_save_to_node (ETableSpecification *specification, xmlDoc *doc) { - xmlNode *node = xmlDocGetRootElement (doc); + xmlNode *node; char *s; - + + g_return_val_if_fail (doc != NULL, NULL); + g_return_val_if_fail (specification != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); + + node = xmlNewNode (NULL, "ETableSpecification"); e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers); e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add); e_xml_set_bool_prop_by_name (node, "draw-grid", specification->draw_grid); @@ -328,11 +340,17 @@ e_table_specification_save_to_node (ETableSpecification *specification, ETableSpecification * e_table_specification_duplicate (ETableSpecification *spec) { - ETableSpecification *new_spec = e_table_specification_new (); - char *spec_str = e_table_specification_save_to_string (spec); + ETableSpecification *new_spec; + char *spec_str; + g_return_val_if_fail (spec != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (spec), NULL); + + new_spec = e_table_specification_new (); + spec_str = e_table_specification_save_to_string (spec); printf ("This is the spec: \n%s\n", spec_str); e_table_specification_load_from_string (new_spec, spec_str); + g_free (spec_str); return new_spec; } -- cgit v1.2.3