From c1c5688c54f8da7ee968f59132cc1878d0138f89 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 16 Jan 2001 20:45:56 +0000 Subject: Added a bit of documentation. (config_sort_config_show, 2001-01-16 Christopher James Lahey * e-table-config.c: Added a bit of documentation. (config_sort_config_show, config_group_config_show): gnome_dialog_set_parent on the config->dialog_toplevel instead of the config. * e-table-specification: Pass "1.0" instead of NULL to xmlNewDoc here. * e-table-state.c, e-table-state.h: Pass "1.0" instead of NULL to xmlNewDoc here. Make sure that sort_info is never NULL if this object exists. Added ETableStateDuplicate. svn path=/trunk/; revision=7542 --- widgets/table/e-table-config.c | 22 +++++++++++++++++++--- widgets/table/e-table-specification.c | 4 ++-- widgets/table/e-table-state.c | 23 ++++++++++++++++++++++- widgets/table/e-table-state.h | 1 + 4 files changed, 44 insertions(+), 6 deletions(-) (limited to 'widgets') diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index 1c84dae657..bcefb1b53c 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -86,7 +86,7 @@ config_sort_config_show (GtkWidget *widget, ETableConfig *config) etcf, FALSE, FALSE, 0); gnome_dialog_set_parent ( GNOME_DIALOG (config->sort_dialog), - GTK_WINDOW(config)); + GTK_WINDOW(config->dialog_toplevel)); gtk_signal_connect ( GTK_OBJECT (config->sort_dialog), "destroy", @@ -117,7 +117,7 @@ config_group_config_show (GtkWidget *widget, ETableConfig *config) TRUE)); gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(config->group_dialog)->vbox), etcf, FALSE, FALSE, 0); gnome_dialog_set_parent(GNOME_DIALOG(config->group_dialog), - GTK_WINDOW(config)); + GTK_WINDOW(config->dialog_toplevel)); gtk_signal_connect(GTK_OBJECT(config->group_dialog), "destroy", GTK_SIGNAL_FUNC(config_clear_group), config); @@ -212,7 +212,7 @@ config_fields_info_update (ETableConfig *config) int i, items = 0; for (i = 0; i < config->state->col_count; i++){ - for (column = config->spec->columns; *column; *column++){ + for (column = config->spec->columns; *column; column++){ if (config->state->columns [i] != (*column)->model_col) continue; @@ -339,6 +339,16 @@ e_table_config_construct (ETableConfig *config, return E_TABLE_CONFIG (config); } +/** + * e_table_config_new: + * @header: The title of the dialog for the ETableConfig. + * @spec: The specification for the columns to allow. + * @state: The current state of the configuration. + * + * Creates a new ETable config object. + * + * Returns: The config object. + */ ETableConfig * e_table_config_new (const char *header, ETableSpecification *spec, @@ -355,6 +365,12 @@ e_table_config_new (const char *header, return E_TABLE_CONFIG (config); } +/** + * e_table_config_raise: + * @config: The ETableConfig object. + * + * Raises the dialog associated with this ETableConfig object. + */ void e_table_config_raise (ETableConfig *config) { diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 1a630e7c5c..fa80d6a40c 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -228,7 +228,7 @@ e_table_specification_save_to_file (ETableSpecification *specification, { xmlDoc *doc; - doc = xmlNewDoc (NULL); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); return xmlSaveFile (filename, doc); } @@ -251,7 +251,7 @@ e_table_specification_save_to_string (ETableSpecification *specification) int length; xmlDoc *doc; - doc = xmlNewDoc (NULL); + doc = xmlNewDoc ("1.0"); xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); xmlDocDumpMemory (doc, &string, &length); 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; +} diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h index c699f3a1b3..32956bd5f8 100644 --- a/widgets/table/e-table-state.h +++ b/widgets/table/e-table-state.h @@ -40,5 +40,6 @@ void e_table_state_save_to_file (ETableState *state, char *e_table_state_save_to_string (ETableState *state); xmlNode *e_table_state_save_to_node (ETableState *state, xmlNode *parent); +ETableState *e_table_state_duplicate (ETableState *spec); #endif /* _E_TABLE_STATE_H_ */ -- cgit