aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/table/e-table-col.c8
-rw-r--r--widgets/table/e-table-col.h3
-rw-r--r--widgets/table/e-table-column-specification.c2
-rw-r--r--widgets/table/e-table-sort-info.c51
-rw-r--r--widgets/table/e-table-sort-info.h3
-rw-r--r--widgets/table/e-table-state.c9
-rw-r--r--widgets/table/e-table.c2
7 files changed, 51 insertions, 27 deletions
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c
index f1f2fb452d..143c8a1693 100644
--- a/widgets/table/e-table-col.c
+++ b/widgets/table/e-table-col.c
@@ -30,9 +30,9 @@ etc_destroy (GtkObject *object)
gtk_object_unref (GTK_OBJECT(etc->ecell));
- if (etc->is_pixbuf)
+ if (etc->pixbuf)
gdk_pixbuf_unref (etc->pixbuf);
- else
+ if (etc->text)
g_free (etc->text);
(*parent_class->destroy)(object);
@@ -174,7 +174,7 @@ e_table_col_new (int col_idx, const char *text, double expansion, int min_width,
* Returns: the newly created ETableCol object.
*/
ETableCol *
-e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, double expansion, int min_width,
+e_table_col_new_with_pixbuf (int col_idx, const char *text, GdkPixbuf *pixbuf, double expansion, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
@@ -190,7 +190,7 @@ e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, double expansion, i
etc->is_pixbuf = TRUE;
etc->col_idx = col_idx;
- etc->text = NULL;
+ etc->text = g_strdup(text);
etc->pixbuf = pixbuf;
etc->expansion = expansion;
etc->min_width = min_width;
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
index 012fa10267..fd15108ab9 100644
--- a/widgets/table/e-table-col.h
+++ b/widgets/table/e-table-col.h
@@ -50,7 +50,8 @@ ETableCol *e_table_col_new (int col_idx, const char *text,
double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
-ETableCol *e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf,
+ETableCol *e_table_col_new_with_pixbuf (int col_idx, const char *text,
+ GdkPixbuf *pixbuf,
double expansion, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c
index 88604e03ea..c22bde9eef 100644
--- a/widgets/table/e-table-column-specification.c
+++ b/widgets/table/e-table-column-specification.c
@@ -80,7 +80,7 @@ e_table_column_specification_load_from_node (ETableColumnSpecification *etcs,
etcs->model_col = e_xml_get_integer_prop_by_name(node, "model_col");
etcs->title_ = e_xml_get_translated_string_prop_by_name(node, "_title");
- etcs->pixbuf = e_xml_get_translated_string_prop_by_name(node, "pixbuf");
+ etcs->pixbuf = e_xml_get_string_prop_by_name(node, "pixbuf");
etcs->expansion = e_xml_get_double_prop_by_name(node, "expansion");
etcs->minimum_width = e_xml_get_integer_prop_by_name(node, "minimum_width");
diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c
index bea5bde0eb..c7f5f12525 100644
--- a/widgets/table/e-table-sort-info.c
+++ b/widgets/table/e-table-sort-info.c
@@ -240,24 +240,42 @@ e_table_sort_info_new (void)
void
e_table_sort_info_load_from_node (ETableSortInfo *info,
- xmlNode *node)
+ xmlNode *node,
+ gdouble state_version)
{
int i;
xmlNode *grouping;
- i = 0;
- for (grouping = node->childs; grouping && !strcmp (grouping->name, "group"); grouping = grouping->childs) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_grouping_set_nth(info, i++, column);
- }
- i = 0;
- for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->childs) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_sorting_set_nth(info, i++, column);
+ if (state_version <= 0.05) {
+ i = 0;
+ for (grouping = node->childs; grouping && !strcmp (grouping->name, "group"); grouping = grouping->childs) {
+ ETableSortColumn column;
+ column.column = e_xml_get_integer_prop_by_name (grouping, "column");
+ column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
+ e_table_sort_info_grouping_set_nth(info, i++, column);
+ }
+ i = 0;
+ for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->childs) {
+ ETableSortColumn column;
+ column.column = e_xml_get_integer_prop_by_name (grouping, "column");
+ column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
+ e_table_sort_info_sorting_set_nth(info, i++, column);
+ }
+ } else {
+ i = 0;
+ for (grouping = node->childs; grouping && !strcmp (grouping->name, "group"); grouping = grouping->next) {
+ ETableSortColumn column;
+ column.column = e_xml_get_integer_prop_by_name (grouping, "column");
+ column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
+ e_table_sort_info_grouping_set_nth(info, i++, column);
+ }
+ i = 0;
+ for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->next) {
+ ETableSortColumn column;
+ column.column = e_xml_get_integer_prop_by_name (grouping, "column");
+ column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
+ e_table_sort_info_sorting_set_nth(info, i++, column);
+ }
}
}
@@ -272,11 +290,10 @@ e_table_sort_info_save_to_node (ETableSortInfo *info,
const int group_count = e_table_sort_info_grouping_get_count (info);
grouping = xmlNewChild (parent, NULL, "grouping", NULL);
- node = grouping;
for (i = 0; i < group_count; i++) {
ETableSortColumn column = e_table_sort_info_grouping_get_nth(info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "group", NULL);
+ xmlNode *new_node = xmlNewChild(grouping, NULL, "group", NULL);
e_xml_set_integer_prop_by_name (new_node, "column", column.column);
e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending);
@@ -285,7 +302,7 @@ e_table_sort_info_save_to_node (ETableSortInfo *info,
for (i = 0; i < sort_count; i++) {
ETableSortColumn column = e_table_sort_info_sorting_get_nth(info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "leaf", NULL);
+ xmlNode *new_node = xmlNewChild(grouping, NULL, "leaf", NULL);
e_xml_set_integer_prop_by_name (new_node, "column", column.column);
e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending);
diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h
index 78ecbed29f..71822337b7 100644
--- a/widgets/table/e-table-sort-info.h
+++ b/widgets/table/e-table-sort-info.h
@@ -66,7 +66,8 @@ void e_table_sort_info_sorting_set_nth (ETableSortInfo *info,
ETableSortInfo *e_table_sort_info_new (void);
void e_table_sort_info_load_from_node (ETableSortInfo *info,
- xmlNode *node);
+ xmlNode *node,
+ gdouble state_version);
xmlNode *e_table_sort_info_save_to_node (ETableSortInfo *info,
xmlNode *parent);
diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c
index b36bbf41c7..5bfc9c390b 100644
--- a/widgets/table/e-table-state.c
+++ b/widgets/table/e-table-state.c
@@ -18,6 +18,8 @@
#define PARENT_TYPE (gtk_object_get_type())
+#define STATE_VERSION 0.1
+
static GtkObjectClass *etst_parent_class;
static void
@@ -83,8 +85,11 @@ e_table_state_load_from_node (ETableState *state,
{
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);
+
if (state->sort_info)
gtk_object_unref(GTK_OBJECT(state->sort_info));
state->sort_info = NULL;
@@ -97,7 +102,7 @@ e_table_state_load_from_node (ETableState *state,
list = g_list_append(list, column);
} 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);
+ e_table_sort_info_load_from_node(state->sort_info, children, state_version);
}
}
g_free(state->columns);
@@ -151,7 +156,7 @@ e_table_state_save_to_node (ETableState *state,
else
node = xmlNewNode (NULL, "ETableState");
- e_xml_set_double_prop_by_name(node, "state-version", 0.0);
+ e_xml_set_double_prop_by_name(node, "state-version", STATE_VERSION);
for (i = 0; i < state->col_count; i++) {
int column = state->columns[i];
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 12a23bfdd7..5c7697c10a 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -660,7 +660,7 @@ et_col_spec_to_col (ETable *e_table, ETableColumnSpecification *col_spec, ETable
pixbuf = e_table_extras_get_pixbuf(ete, col_spec->pixbuf);
if (pixbuf) {
- col = e_table_col_new_with_pixbuf (col_spec->model_col, pixbuf,
+ col = e_table_col_new_with_pixbuf (col_spec->model_col, col_spec->title_, pixbuf,
col_spec->expansion, col_spec->minimum_width,
cell, compare, col_spec->resizable);
}