aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-subset.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-10-19 04:58:34 +0800
committerChris Lahey <clahey@src.gnome.org>2000-10-19 04:58:34 +0800
commit199a9f60a0302679a2c9dd2142bc91e2f97457ae (patch)
tree7d0f96252107898c9adc70d3990dce284db6f306 /widgets/table/e-table-subset.c
parent8fefb8df4b9f1901537ab31cefc3e44e86f4d099 (diff)
downloadgsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.gz
gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.tar.zst
gsoc2013-evolution-199a9f60a0302679a2c9dd2142bc91e2f97457ae.zip
Sped up signal propogation.
2000-10-18 Christopher James Lahey <clahey@helixcode.com> * e-table-subset.c, e-table-subset.h: Sped up signal propogation. svn path=/trunk/; revision=6006
Diffstat (limited to 'widgets/table/e-table-subset.c')
-rw-r--r--widgets/table/e-table-subset.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c
index 6727243778..5b9a014afe 100644
--- a/widgets/table/e-table-subset.c
+++ b/widgets/table/e-table-subset.c
@@ -65,6 +65,7 @@ etss_value_at (ETableModel *etm, int col, int row)
{
ETableSubset *etss = (ETableSubset *)etm;
+ etss->last_access = row;
return e_table_model_value_at (etss->source, col, etss->map_table [row]);
}
@@ -73,6 +74,7 @@ etss_set_value_at (ETableModel *etm, int col, int row, const void *val)
{
ETableSubset *etss = (ETableSubset *)etm;
+ etss->last_access = row;
return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
}
@@ -153,7 +155,13 @@ etss_class_init (GtkObjectClass *klass)
table_class->value_to_string = etss_value_to_string;
}
-E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE);
+static void
+etss_init (ETableSubset *etss)
+{
+ etss->last_access = 0;
+}
+
+E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, etss_init, PARENT_TYPE);
static void
etss_proxy_model_pre_change (ETableModel *etm, ETableSubset *etss)
@@ -170,13 +178,33 @@ etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss)
static void
etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss)
{
+ int limit;
const int n = etss->n_map;
const int * const map_table = etss->map_table;
int i;
-
+
+ limit = MIN(n, etss->last_access + 10);
+ for (i = etss->last_access; i < limit; i++) {
+ if (map_table [i] == row){
+ e_table_model_row_changed (E_TABLE_MODEL (etss), i);
+ etss->last_access = i;
+ return;
+ }
+ }
+
+ limit = MAX(0, etss->last_access - 10);
+ for (i = etss->last_access - 1; i >= limit; i--) {
+ if (map_table [i] == row){
+ e_table_model_row_changed (E_TABLE_MODEL (etss), i);
+ etss->last_access = i;
+ return;
+ }
+ }
+
for (i = 0; i < n; i++){
if (map_table [i] == row){
e_table_model_row_changed (E_TABLE_MODEL (etss), i);
+ etss->last_access = i;
return;
}
}
@@ -185,13 +213,33 @@ etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss)
static void
etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss)
{
+ int limit;
const int n = etss->n_map;
const int * const map_table = etss->map_table;
int i;
+
+ limit = MIN(n, etss->last_access + 10);
+ for (i = etss->last_access; i < limit; i++) {
+ if (map_table [i] == row){
+ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i);
+ etss->last_access = i;
+ return;
+ }
+ }
+
+ limit = MAX(0, etss->last_access - 10);
+ for (i = etss->last_access - 1; i >= limit; i--) {
+ if (map_table [i] == row){
+ e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i);
+ etss->last_access = i;
+ return;
+ }
+ }
for (i = 0; i < n; i++){
if (map_table [i] == row){
e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i);
+ etss->last_access = i;
return;
}
}