aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/e-table/ChangeLog17
-rw-r--r--widgets/e-table/e-table-group-container.c11
-rw-r--r--widgets/e-table/e-table-group-leaf.c8
-rw-r--r--widgets/e-table/e-table-group.c11
-rw-r--r--widgets/e-table/e-table-group.h2
-rw-r--r--widgets/e-table/e-table-sort-info.c24
-rw-r--r--widgets/e-table/e-table-sorted-variable.c25
-rw-r--r--widgets/e-table/e-table-subset-variable.c33
-rw-r--r--widgets/e-table/e-table-subset-variable.h10
-rw-r--r--widgets/e-table/e-table.c8
-rw-r--r--widgets/table/e-table-group-container.c11
-rw-r--r--widgets/table/e-table-group-leaf.c8
-rw-r--r--widgets/table/e-table-group.c11
-rw-r--r--widgets/table/e-table-group.h2
-rw-r--r--widgets/table/e-table-sort-info.c24
-rw-r--r--widgets/table/e-table-sorted-variable.c25
-rw-r--r--widgets/table/e-table-subset-variable.c33
-rw-r--r--widgets/table/e-table-subset-variable.h10
-rw-r--r--widgets/table/e-table.c8
19 files changed, 251 insertions, 30 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 7ba3180f4b..bac9d0b748 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,22 @@
2000-05-04 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-group-container.c, e-table-group-leaf.c,
+ e-table-group.c, e-table-group.h: Add an e_table_group_add_all
+ function and implement it in the different ETableGroup classes.
+
+ * e-table-sort-info.c: Make set_nth not call changed twice if it
+ needs to allocate more space.
+
+ * e-table-sorted-variable.c, e-table-subset-variable.c,
+ e-table-subset-variable.h: Add and implement an
+ e_table_subset_variable_add_all command.
+
+ * e-table.c: Use e_table_group_add_all as appropriate. Fix ETable
+ grouping xml to work if there is a text element at the bottom of
+ the grouping tree.
+
+2000-05-04 Christopher James Lahey <clahey@helixcode.com>
+
* e-cell-text.c: Sped up e_cell_text's get_height function.
2000-05-04 Christopher James Lahey <clahey@helixcode.com>
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index ac93cecc69..b1eaa82d5e 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -612,6 +612,16 @@ etgc_add (ETableGroup *etg, gint row)
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
+static void
+etgc_add_all (ETableGroup *etg)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+ int rows = e_table_model_row_count(etg->model);
+ int i;
+ for (i = 0; i < rows; i++)
+ etgc_add(etg, i);
+}
+
static gboolean
etgc_remove (ETableGroup *etg, gint row)
{
@@ -785,6 +795,7 @@ etgc_class_init (GtkObjectClass *object_class)
etgc_parent_class = gtk_type_class (PARENT_TYPE);
e_group_class->add = etgc_add;
+ e_group_class->add_all = etgc_add_all;
e_group_class->remove = etgc_remove;
e_group_class->increment = etgc_increment;
e_group_class->set_focus = etgc_set_focus;
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index 54aa3748f3..e39afa7f88 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -137,6 +137,13 @@ etgl_add (ETableGroup *etg, gint row)
e_table_subset_variable_add (etgl->subset, row);
}
+static void
+etgl_add_all (ETableGroup *etg)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ e_table_subset_variable_add_all (etgl->subset);
+}
+
static gboolean
etgl_remove (ETableGroup *etg, gint row)
{
@@ -272,6 +279,7 @@ etgl_class_init (GtkObjectClass *object_class)
etgl_parent_class = gtk_type_class (PARENT_TYPE);
e_group_class->add = etgl_add;
+ e_group_class->add_all = etgl_add_all;
e_group_class->remove = etgl_remove;
e_group_class->increment = etgl_increment;
e_group_class->set_focus = etgl_set_focus;
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
index 45fd6e6a79..e47986472b 100644
--- a/widgets/e-table/e-table-group.c
+++ b/widgets/e-table/e-table-group.c
@@ -123,6 +123,16 @@ e_table_group_add (ETableGroup *etg,
ETG_CLASS (etg)->add (etg, row);
}
+void
+e_table_group_add_all (ETableGroup *etg)
+{
+ g_return_if_fail (etg != NULL);
+ g_return_if_fail (E_IS_TABLE_GROUP (etg));
+
+ if (ETG_CLASS (etg)->add_all)
+ ETG_CLASS (etg)->add_all (etg);
+}
+
gboolean
e_table_group_remove (ETableGroup *etg,
gint row)
@@ -332,6 +342,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->row_selection = NULL;
klass->add = NULL;
+ klass->add_all = NULL;
klass->remove = NULL;
klass->get_count = NULL;
klass->increment = NULL;
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
index 43d8884a90..573a4f9547 100644
--- a/widgets/e-table/e-table-group.h
+++ b/widgets/e-table/e-table-group.h
@@ -44,6 +44,7 @@ typedef struct {
void (*row_selection) (ETableGroup *etg, int row, gboolean selected);
void (*add) (ETableGroup *etg, gint row);
+ void (*add_all) (ETableGroup *etg);
gboolean (*remove) (ETableGroup *etg, gint row);
gint (*get_count) (ETableGroup *etg);
void (*increment) (ETableGroup *etg, gint position, gint amount);
@@ -60,6 +61,7 @@ typedef struct {
void e_table_group_add (ETableGroup *etg,
gint row);
+void e_table_group_add_all (ETableGroup *etg);
gboolean e_table_group_remove (ETableGroup *etg,
gint row);
gint e_table_group_get_count (ETableGroup *etg);
diff --git a/widgets/e-table/e-table-sort-info.c b/widgets/e-table/e-table-sort-info.c
index b33784c140..32ba3d9e65 100644
--- a/widgets/e-table/e-table-sort-info.c
+++ b/widgets/e-table/e-table-sort-info.c
@@ -143,8 +143,8 @@ e_table_sort_info_grouping_get_count (ETableSortInfo *info)
return info->group_count;
}
-void
-e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
+static void
+e_table_sort_info_grouping_real_truncate (ETableSortInfo *info, int length)
{
if (length < info->group_count) {
info->group_count = length;
@@ -153,6 +153,12 @@ e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
info->groupings = g_realloc(info->groupings, length * sizeof(ETableSortColumn));
info->group_count = length;
}
+}
+
+void
+e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
+{
+ e_table_sort_info_grouping_real_truncate(info, length);
e_table_sort_info_group_info_changed(info);
}
@@ -171,7 +177,7 @@ void
e_table_sort_info_grouping_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
{
if (n >= info->group_count) {
- e_table_sort_info_grouping_truncate(info, n + 1);
+ e_table_sort_info_grouping_real_truncate(info, n + 1);
}
info->groupings[n] = column;
e_table_sort_info_group_info_changed(info);
@@ -184,8 +190,8 @@ e_table_sort_info_sorting_get_count (ETableSortInfo *info)
return info->sort_count;
}
-void
-e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
+static void
+e_table_sort_info_sorting_real_truncate (ETableSortInfo *info, int length)
{
if (length < info->sort_count) {
info->sort_count = length;
@@ -194,6 +200,12 @@ e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
info->sortings = g_realloc(info->sortings, length * sizeof(ETableSortColumn));
info->sort_count = length;
}
+}
+
+void
+e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
+{
+ e_table_sort_info_sorting_real_truncate (info, length);
e_table_sort_info_sort_info_changed(info);
}
@@ -212,7 +224,7 @@ void
e_table_sort_info_sorting_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
{
if (n >= info->sort_count) {
- e_table_sort_info_sorting_truncate(info, n + 1);
+ e_table_sort_info_sorting_real_truncate(info, n + 1);
}
info->sortings[n] = column;
e_table_sort_info_sort_info_changed(info);
diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c
index 1cc2557133..e3a0fbc8c5 100644
--- a/widgets/e-table/e-table-sorted-variable.c
+++ b/widgets/e-table/e-table-sorted-variable.c
@@ -26,6 +26,7 @@ static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, E
static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv);
static void etsv_sort (ETableSortedVariable *etsv);
static void etsv_add (ETableSubsetVariable *etssv, gint row);
+static void etsv_add_all (ETableSubsetVariable *etssv);
static void
etsv_destroy (GtkObject *object)
@@ -68,6 +69,7 @@ etsv_class_init (GtkObjectClass *object_class)
object_class->destroy = etsv_destroy;
etssv_class->add = etsv_add;
+ etssv_class->add_all = etsv_add_all;
}
static void
@@ -115,6 +117,29 @@ etsv_add (ETableSubsetVariable *etssv,
e_table_model_changed (etm);
}
+static void
+etsv_add_all (ETableSubsetVariable *etssv)
+{
+ ETableModel *etm = E_TABLE_MODEL(etssv);
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv);
+ int rows = e_table_model_row_count(etss->source);
+ int i;
+
+ if (etss->n_map + rows > etssv->n_vals_allocated){
+ etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
+ etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
+ }
+ for (i = 0; i < rows; i++)
+ etss->map_table[etss->n_map++] = i;
+
+ if (etsv->sort_idle_id == 0) {
+ etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL);
+ }
+ if (!etm->frozen)
+ e_table_model_changed (etm);
+}
+
ETableModel *
e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
{
diff --git a/widgets/e-table/e-table-subset-variable.c b/widgets/e-table/e-table-subset-variable.c
index 35cd4f9deb..bd96d5360c 100644
--- a/widgets/e-table/e-table-subset-variable.c
+++ b/widgets/e-table/e-table-subset-variable.c
@@ -38,6 +38,24 @@ etssv_add (ETableSubsetVariable *etssv,
e_table_model_changed (etm);
}
+static void
+etssv_add_all (ETableSubsetVariable *etssv)
+{
+ ETableModel *etm = E_TABLE_MODEL(etssv);
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ int rows = e_table_model_row_count(etss->source);
+ int i;
+
+ if (etss->n_map + rows > etssv->n_vals_allocated){
+ etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
+ etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
+ }
+ for (i = 0; i < rows; i++)
+ etss->map_table[etss->n_map++] = i;
+ if (!etm->frozen)
+ e_table_model_changed (etm);
+}
+
static gboolean
etssv_remove (ETableSubsetVariable *etssv,
gint row)
@@ -64,8 +82,9 @@ etssv_class_init (GtkObjectClass *object_class)
ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class);
etssv_parent_class = gtk_type_class (PARENT_TYPE);
- klass->add = etssv_add;
- klass->remove = etssv_remove;
+ klass->add = etssv_add;
+ klass->add_all = etssv_add_all;
+ klass->remove = etssv_remove;
}
E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE);
@@ -105,6 +124,16 @@ e_table_subset_variable_add (ETableSubsetVariable *etssv,
ETSSV_CLASS (etssv)->add (etssv, row);
}
+void
+e_table_subset_variable_add_all (ETableSubsetVariable *etssv)
+{
+ g_return_if_fail (etssv != NULL);
+ g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv));
+
+ if (ETSSV_CLASS(etssv)->add_all)
+ ETSSV_CLASS (etssv)->add_all (etssv);
+}
+
gboolean
e_table_subset_variable_remove (ETableSubsetVariable *etssv,
gint row)
diff --git a/widgets/e-table/e-table-subset-variable.h b/widgets/e-table/e-table-subset-variable.h
index 8ac0af0382..da932e6c05 100644
--- a/widgets/e-table/e-table-subset-variable.h
+++ b/widgets/e-table/e-table-subset-variable.h
@@ -20,10 +20,11 @@ typedef struct {
typedef struct {
ETableSubsetClass parent_class;
- void (*add) (ETableSubsetVariable *ets,
- gint row);
- gboolean (*remove) (ETableSubsetVariable *ets,
- gint row);
+ void (*add) (ETableSubsetVariable *ets,
+ gint row);
+ void (*add_all) (ETableSubsetVariable *ets);
+ gboolean (*remove) (ETableSubsetVariable *ets,
+ gint row);
} ETableSubsetVariableClass;
GtkType e_table_subset_variable_get_type (void);
@@ -32,6 +33,7 @@ ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv,
ETableModel *source);
void e_table_subset_variable_add (ETableSubsetVariable *ets,
gint row);
+void e_table_subset_variable_add_all (ETableSubsetVariable *ets);
gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets,
gint row);
void e_table_subset_variable_increment (ETableSubsetVariable *ets,
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index 515ca35f95..a05f0219e5 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -145,7 +145,6 @@ e_table_setup_header (ETable *e_table)
}
static void
-
table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
ETable *e_table)
{
@@ -295,6 +294,8 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
{
int count, i;
+ e_table_group_add_all (e_table->group);
+#if 0
count = e_table_model_row_count (model);
gtk_object_set (GTK_OBJECT (e_table->group),
"frozen", TRUE, NULL);
@@ -303,6 +304,7 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
gtk_object_set (GTK_OBJECT (e_table->group),
"frozen", FALSE, NULL);
+#endif
}
static ETableHeader *
@@ -344,14 +346,14 @@ et_grouping_xml_to_sort_info (ETable *table, xmlNode *grouping)
gtk_object_sink (GTK_OBJECT (table->sort_info));
i = 0;
- for (grouping = grouping->childs; grouping && strcmp (grouping->name, "leaf"); grouping = grouping->childs) {
+ for (grouping = grouping->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_integer_prop_by_name (grouping, "ascending");
e_table_sort_info_grouping_set_nth(table->sort_info, i++, column);
}
i = 0;
- for (; grouping; grouping = grouping->childs) {
+ 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_integer_prop_by_name (grouping, "ascending");
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index ac93cecc69..b1eaa82d5e 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -612,6 +612,16 @@ etgc_add (ETableGroup *etg, gint row)
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
+static void
+etgc_add_all (ETableGroup *etg)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+ int rows = e_table_model_row_count(etg->model);
+ int i;
+ for (i = 0; i < rows; i++)
+ etgc_add(etg, i);
+}
+
static gboolean
etgc_remove (ETableGroup *etg, gint row)
{
@@ -785,6 +795,7 @@ etgc_class_init (GtkObjectClass *object_class)
etgc_parent_class = gtk_type_class (PARENT_TYPE);
e_group_class->add = etgc_add;
+ e_group_class->add_all = etgc_add_all;
e_group_class->remove = etgc_remove;
e_group_class->increment = etgc_increment;
e_group_class->set_focus = etgc_set_focus;
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index 54aa3748f3..e39afa7f88 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -137,6 +137,13 @@ etgl_add (ETableGroup *etg, gint row)
e_table_subset_variable_add (etgl->subset, row);
}
+static void
+etgl_add_all (ETableGroup *etg)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ e_table_subset_variable_add_all (etgl->subset);
+}
+
static gboolean
etgl_remove (ETableGroup *etg, gint row)
{
@@ -272,6 +279,7 @@ etgl_class_init (GtkObjectClass *object_class)
etgl_parent_class = gtk_type_class (PARENT_TYPE);
e_group_class->add = etgl_add;
+ e_group_class->add_all = etgl_add_all;
e_group_class->remove = etgl_remove;
e_group_class->increment = etgl_increment;
e_group_class->set_focus = etgl_set_focus;
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index 45fd6e6a79..e47986472b 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -123,6 +123,16 @@ e_table_group_add (ETableGroup *etg,
ETG_CLASS (etg)->add (etg, row);
}
+void
+e_table_group_add_all (ETableGroup *etg)
+{
+ g_return_if_fail (etg != NULL);
+ g_return_if_fail (E_IS_TABLE_GROUP (etg));
+
+ if (ETG_CLASS (etg)->add_all)
+ ETG_CLASS (etg)->add_all (etg);
+}
+
gboolean
e_table_group_remove (ETableGroup *etg,
gint row)
@@ -332,6 +342,7 @@ etg_class_init (GtkObjectClass *object_class)
klass->row_selection = NULL;
klass->add = NULL;
+ klass->add_all = NULL;
klass->remove = NULL;
klass->get_count = NULL;
klass->increment = NULL;
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
index 43d8884a90..573a4f9547 100644
--- a/widgets/table/e-table-group.h
+++ b/widgets/table/e-table-group.h
@@ -44,6 +44,7 @@ typedef struct {
void (*row_selection) (ETableGroup *etg, int row, gboolean selected);
void (*add) (ETableGroup *etg, gint row);
+ void (*add_all) (ETableGroup *etg);
gboolean (*remove) (ETableGroup *etg, gint row);
gint (*get_count) (ETableGroup *etg);
void (*increment) (ETableGroup *etg, gint position, gint amount);
@@ -60,6 +61,7 @@ typedef struct {
void e_table_group_add (ETableGroup *etg,
gint row);
+void e_table_group_add_all (ETableGroup *etg);
gboolean e_table_group_remove (ETableGroup *etg,
gint row);
gint e_table_group_get_count (ETableGroup *etg);
diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c
index b33784c140..32ba3d9e65 100644
--- a/widgets/table/e-table-sort-info.c
+++ b/widgets/table/e-table-sort-info.c
@@ -143,8 +143,8 @@ e_table_sort_info_grouping_get_count (ETableSortInfo *info)
return info->group_count;
}
-void
-e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
+static void
+e_table_sort_info_grouping_real_truncate (ETableSortInfo *info, int length)
{
if (length < info->group_count) {
info->group_count = length;
@@ -153,6 +153,12 @@ e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
info->groupings = g_realloc(info->groupings, length * sizeof(ETableSortColumn));
info->group_count = length;
}
+}
+
+void
+e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
+{
+ e_table_sort_info_grouping_real_truncate(info, length);
e_table_sort_info_group_info_changed(info);
}
@@ -171,7 +177,7 @@ void
e_table_sort_info_grouping_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
{
if (n >= info->group_count) {
- e_table_sort_info_grouping_truncate(info, n + 1);
+ e_table_sort_info_grouping_real_truncate(info, n + 1);
}
info->groupings[n] = column;
e_table_sort_info_group_info_changed(info);
@@ -184,8 +190,8 @@ e_table_sort_info_sorting_get_count (ETableSortInfo *info)
return info->sort_count;
}
-void
-e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
+static void
+e_table_sort_info_sorting_real_truncate (ETableSortInfo *info, int length)
{
if (length < info->sort_count) {
info->sort_count = length;
@@ -194,6 +200,12 @@ e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
info->sortings = g_realloc(info->sortings, length * sizeof(ETableSortColumn));
info->sort_count = length;
}
+}
+
+void
+e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
+{
+ e_table_sort_info_sorting_real_truncate (info, length);
e_table_sort_info_sort_info_changed(info);
}
@@ -212,7 +224,7 @@ void
e_table_sort_info_sorting_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
{
if (n >= info->sort_count) {
- e_table_sort_info_sorting_truncate(info, n + 1);
+ e_table_sort_info_sorting_real_truncate(info, n + 1);
}
info->sortings[n] = column;
e_table_sort_info_sort_info_changed(info);
diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c
index 1cc2557133..e3a0fbc8c5 100644
--- a/widgets/table/e-table-sorted-variable.c
+++ b/widgets/table/e-table-sorted-variable.c
@@ -26,6 +26,7 @@ static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, E
static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv);
static void etsv_sort (ETableSortedVariable *etsv);
static void etsv_add (ETableSubsetVariable *etssv, gint row);
+static void etsv_add_all (ETableSubsetVariable *etssv);
static void
etsv_destroy (GtkObject *object)
@@ -68,6 +69,7 @@ etsv_class_init (GtkObjectClass *object_class)
object_class->destroy = etsv_destroy;
etssv_class->add = etsv_add;
+ etssv_class->add_all = etsv_add_all;
}
static void
@@ -115,6 +117,29 @@ etsv_add (ETableSubsetVariable *etssv,
e_table_model_changed (etm);
}
+static void
+etsv_add_all (ETableSubsetVariable *etssv)
+{
+ ETableModel *etm = E_TABLE_MODEL(etssv);
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv);
+ int rows = e_table_model_row_count(etss->source);
+ int i;
+
+ if (etss->n_map + rows > etssv->n_vals_allocated){
+ etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
+ etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
+ }
+ for (i = 0; i < rows; i++)
+ etss->map_table[etss->n_map++] = i;
+
+ if (etsv->sort_idle_id == 0) {
+ etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL);
+ }
+ if (!etm->frozen)
+ e_table_model_changed (etm);
+}
+
ETableModel *
e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
{
diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c
index 35cd4f9deb..bd96d5360c 100644
--- a/widgets/table/e-table-subset-variable.c
+++ b/widgets/table/e-table-subset-variable.c
@@ -38,6 +38,24 @@ etssv_add (ETableSubsetVariable *etssv,
e_table_model_changed (etm);
}
+static void
+etssv_add_all (ETableSubsetVariable *etssv)
+{
+ ETableModel *etm = E_TABLE_MODEL(etssv);
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ int rows = e_table_model_row_count(etss->source);
+ int i;
+
+ if (etss->n_map + rows > etssv->n_vals_allocated){
+ etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
+ etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
+ }
+ for (i = 0; i < rows; i++)
+ etss->map_table[etss->n_map++] = i;
+ if (!etm->frozen)
+ e_table_model_changed (etm);
+}
+
static gboolean
etssv_remove (ETableSubsetVariable *etssv,
gint row)
@@ -64,8 +82,9 @@ etssv_class_init (GtkObjectClass *object_class)
ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class);
etssv_parent_class = gtk_type_class (PARENT_TYPE);
- klass->add = etssv_add;
- klass->remove = etssv_remove;
+ klass->add = etssv_add;
+ klass->add_all = etssv_add_all;
+ klass->remove = etssv_remove;
}
E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE);
@@ -105,6 +124,16 @@ e_table_subset_variable_add (ETableSubsetVariable *etssv,
ETSSV_CLASS (etssv)->add (etssv, row);
}
+void
+e_table_subset_variable_add_all (ETableSubsetVariable *etssv)
+{
+ g_return_if_fail (etssv != NULL);
+ g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv));
+
+ if (ETSSV_CLASS(etssv)->add_all)
+ ETSSV_CLASS (etssv)->add_all (etssv);
+}
+
gboolean
e_table_subset_variable_remove (ETableSubsetVariable *etssv,
gint row)
diff --git a/widgets/table/e-table-subset-variable.h b/widgets/table/e-table-subset-variable.h
index 8ac0af0382..da932e6c05 100644
--- a/widgets/table/e-table-subset-variable.h
+++ b/widgets/table/e-table-subset-variable.h
@@ -20,10 +20,11 @@ typedef struct {
typedef struct {
ETableSubsetClass parent_class;
- void (*add) (ETableSubsetVariable *ets,
- gint row);
- gboolean (*remove) (ETableSubsetVariable *ets,
- gint row);
+ void (*add) (ETableSubsetVariable *ets,
+ gint row);
+ void (*add_all) (ETableSubsetVariable *ets);
+ gboolean (*remove) (ETableSubsetVariable *ets,
+ gint row);
} ETableSubsetVariableClass;
GtkType e_table_subset_variable_get_type (void);
@@ -32,6 +33,7 @@ ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv,
ETableModel *source);
void e_table_subset_variable_add (ETableSubsetVariable *ets,
gint row);
+void e_table_subset_variable_add_all (ETableSubsetVariable *ets);
gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets,
gint row);
void e_table_subset_variable_increment (ETableSubsetVariable *ets,
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 515ca35f95..a05f0219e5 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -145,7 +145,6 @@ e_table_setup_header (ETable *e_table)
}
static void
-
table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
ETable *e_table)
{
@@ -295,6 +294,8 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
{
int count, i;
+ e_table_group_add_all (e_table->group);
+#if 0
count = e_table_model_row_count (model);
gtk_object_set (GTK_OBJECT (e_table->group),
"frozen", TRUE, NULL);
@@ -303,6 +304,7 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
gtk_object_set (GTK_OBJECT (e_table->group),
"frozen", FALSE, NULL);
+#endif
}
static ETableHeader *
@@ -344,14 +346,14 @@ et_grouping_xml_to_sort_info (ETable *table, xmlNode *grouping)
gtk_object_sink (GTK_OBJECT (table->sort_info));
i = 0;
- for (grouping = grouping->childs; grouping && strcmp (grouping->name, "leaf"); grouping = grouping->childs) {
+ for (grouping = grouping->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_integer_prop_by_name (grouping, "ascending");
e_table_sort_info_grouping_set_nth(table->sort_info, i++, column);
}
i = 0;
- for (; grouping; grouping = grouping->childs) {
+ 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_integer_prop_by_name (grouping, "ascending");