diff options
author | Miguel de Icaza <miguel@gnu.org> | 2001-01-17 14:56:04 +0800 |
---|---|---|
committer | Miguel de Icaza <miguel@src.gnome.org> | 2001-01-17 14:56:04 +0800 |
commit | d645d1f2362a623b037cbfa09405e09b0f530c71 (patch) | |
tree | 300548e4e904c3852ebbf3259ad8de58ffef76a8 /widgets/table/e-table-state.c | |
parent | a57329a173148e4804fe09a196fb73f87e047a02 (diff) | |
download | gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.gz gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.tar.zst gsoc2013-evolution-d645d1f2362a623b037cbfa09405e09b0f530c71.zip |
Load frames.
2001-01-16 Miguel de Icaza <miguel@gnu.org>
* 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
Diffstat (limited to 'widgets/table/e-table-state.c')
-rw-r--r-- | widgets/table/e-table-state.c | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index c9049b7a18..c978487368 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -2,8 +2,9 @@ /* * E-table-state.c: Savable state of a table. * - * Author: + * Authors: * Chris Lahey <clahey@ximian.com> + * Miguel de Icaza (miguel@ximian.com) * * (C) 2000 Ximian, Inc. */ @@ -87,37 +88,44 @@ e_table_state_load_from_string (ETableState *state, } } -typedef struct -{ +typedef struct { int column; double expansion; } int_and_double; void -e_table_state_load_from_node (ETableState *state, - const xmlNode *node) +e_table_state_load_from_node (ETableState *state, + const xmlNode *node) { xmlNode *children; GList *list = NULL, *iterator; gdouble state_version; int i; - state_version = e_xml_get_double_prop_by_name_with_default(node, "state-version", STATE_VERSION); + state_version = e_xml_get_double_prop_by_name_with_default ( + node, "state-version", STATE_VERSION); if (state->sort_info) - gtk_object_unref(GTK_OBJECT(state->sort_info)); + gtk_object_unref (GTK_OBJECT(state->sort_info)); + state->sort_info = NULL; - for (children = node->xmlChildrenNode; children; children = children->next) { - if (!strcmp(children->name, "column")) { + children = node->xmlChildrenNode; + for (; children; children = children->next) { + if (!strcmp (children->name, "column")) { int_and_double *column_info = g_new(int_and_double, 1); - column_info->column = e_xml_get_integer_prop_by_name(children, "source"); - column_info->expansion = e_xml_get_double_prop_by_name_with_default(children, "expansion", -2); + column_info->column = e_xml_get_integer_prop_by_name( + children, "source"); + column_info->expansion = + e_xml_get_double_prop_by_name_with_default( + children, "expansion", -2); - list = g_list_append(list, column_info); - } else if (state->sort_info == NULL && !strcmp(children->name, "grouping")) { + list = g_list_append (list, column_info); + } else if (state->sort_info == NULL && + !strcmp (children->name, "grouping")) { state->sort_info = e_table_sort_info_new(); - e_table_sort_info_load_from_node(state->sort_info, children, state_version); + e_table_sort_info_load_from_node( + state->sort_info, children, state_version); } } g_free(state->columns); @@ -125,11 +133,14 @@ e_table_state_load_from_node (ETableState *state, state->col_count = g_list_length(list); state->columns = g_new(int, state->col_count); state->expansions = g_new(double, state->col_count); - for (iterator = list, i = 0; iterator; iterator = g_list_next(iterator), i++) { + + for (iterator = list, i = 0; iterator; i++) { int_and_double *column_info = iterator->data; - state->columns[i] = column_info->column; - state->expansions[i] = column_info->expansion; - g_free(column_info); + + state->columns [i] = column_info->column; + state->expansions [i] = column_info->expansion; + g_free (column_info); + iterator = g_list_next (iterator); } g_list_free(list); } @@ -196,7 +207,7 @@ e_table_state_save_to_node (ETableState *state, /** * e_table_state_duplicate: - * @state: state to duplicate + * @state: The ETableState to duplicate * * This creates a copy of the %ETableState @state * @@ -205,11 +216,17 @@ e_table_state_save_to_node (ETableState *state, 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); + ETableState *new_state; + char *copy; + g_return_val_if_fail (state != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_STATE (state), NULL); + + new_state = e_table_state_new (); + copy = e_table_state_save_to_string (state); + e_table_state_load_from_string (new_state, copy); + g_free (copy); + return new_state; } + |