aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-02 09:52:27 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-02 09:52:27 +0800
commit2b418bb61aea51d04c289a958398c5b416572130 (patch)
tree0ccf918b4ba9857c92a648559bbcbcacd0c1f8c2 /widgets/e-table
parent5ab6198e11a0ca19e7fcb99ee483b95eb46a8ee8 (diff)
downloadgsoc2013-evolution-2b418bb61aea51d04c289a958398c5b416572130.tar.gz
gsoc2013-evolution-2b418bb61aea51d04c289a958398c5b416572130.tar.zst
gsoc2013-evolution-2b418bb61aea51d04c289a958398c5b416572130.zip
Made the sort when inserting a signal row be syncronous.
2000-06-01 Christopher James Lahey <clahey@helixcode.com> * e-table-sorted-variable.c: Made the sort when inserting a signal row be syncronous. svn path=/trunk/; revision=3358
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog5
-rw-r--r--widgets/e-table/e-table-sorted-variable.c49
2 files changed, 49 insertions, 5 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 895d2b7ce9..4c3d9b4cc3 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,10 @@
2000-06-01 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-sorted-variable.c: Made the sort when inserting a signal
+ row be syncronous.
+
+2000-06-01 Christopher James Lahey <clahey@helixcode.com>
+
* e-cell-text.c, e-cell-text.h: Added "text_filter" argument that
takes a const void * and returns an allocated char *.
diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c
index 0d2ecce800..7ea2eac04b 100644
--- a/widgets/e-table/e-table-sorted-variable.c
+++ b/widgets/e-table/e-table-sorted-variable.c
@@ -98,6 +98,41 @@ etsv_sort_idle(ETableSortedVariable *etsv)
return FALSE;
}
+/* This takes source rows. */
+static int
+etsv_compare(ETableSortedVariable *etsv, int row1, int row2)
+{
+ int j;
+ int sort_count = e_table_sort_info_sorting_get_count(etsv->sort_info);
+ int comp_val = 0;
+ int ascending = 1;
+ ETableSubset *etss = E_TABLE_SUBSET(etsv);
+
+ for (j = 0; j < sort_count; j++) {
+ ETableSortColumn column = e_table_sort_info_sorting_get_nth(etsv->sort_info, j);
+ ETableCol *col;
+ if (column.column > e_table_header_count (etsv->full_header))
+ col = e_table_header_get_column (etsv->full_header, e_table_header_count (etsv->full_header) - 1);
+ else
+ col = e_table_header_get_column (etsv->full_header, column.column);
+ comp_val = (*col->compare)(e_table_model_value_at (etss->source, col->col_idx, row1),
+ e_table_model_value_at (etss->source, col->col_idx, row2));
+ ascending = column.ascending;
+ if (comp_val != 0)
+ break;
+ }
+ if (comp_val == 0) {
+ if (row1 < row2)
+ comp_val = -1;
+ if (row1 > row2)
+ comp_val = 1;
+ }
+ if (!ascending)
+ comp_val = -comp_val;
+ return comp_val;
+}
+
+
static void
etsv_add (ETableSubsetVariable *etssv,
gint row)
@@ -107,7 +142,7 @@ etsv_add (ETableSubsetVariable *etssv,
ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv);
int i;
- if (etss->n_map + 1 > etssv->n_vals_allocated){
+ if (etss->n_map + 1 > etssv->n_vals_allocated) {
etssv->n_vals_allocated += INCREMENT_AMOUNT;
etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated) * sizeof(int));
}
@@ -115,13 +150,17 @@ etsv_add (ETableSubsetVariable *etssv,
for ( i = 0; i < etss->n_map; i++ )
if (etss->map_table[i] >= row)
etss->map_table[i] ++;
- etss->map_table[etss->n_map] = row;
- etss->n_map++;
+ i = etss->n_map;
if (etsv->sort_idle_id == 0) {
- etsv->sort_idle_id = g_idle_add_full(30, (GSourceFunc) etsv_sort_idle, etsv, NULL);
+ i = 0;
+ while (etsv_compare(etsv, etss->map_table[i], row) < 0)
+ i++;
+ memmove(etss->map_table + i + 1, etss->map_table + i, etss->n_map - i);
}
+ etss->map_table[i] = row;
+ etss->n_map++;
if (!etm->frozen)
- e_table_model_row_inserted (etm, etss->n_map - 1);
+ e_table_model_row_inserted (etm, i);
}
static void
m?h=master&id=2def4325b59efd4363653af8c38ac34a29631de9'>- set NO_CDROMdinoex2009-02-161-0/+1 * - set USE_XORGdinoex2008-03-181-0/+1 * - fix build for gcc42dinoex2007-08-182-1/+58 * - Welcome X.org 7.2 \o/.flz2007-05-201-0/+1 * - add SHA checksumdinoex2005-11-131-0/+8 * - downdate urldinoex2005-10-022-3/+2 * - update MASTER_SITESdinoex2005-02-211-4/+4 * - make portlint happydinoex2004-03-222-37/+25 * - add SIZEdinoex2004-02-261-1/+8 * - fix MASTER_SITESdinoex2003-11-161-1/+0 * - fix MASTER_SIITESdinoex2003-09-071-1/+1 * - add more sitesdinoex2003-04-061-1/+3 * - rmove offline site xanim.va.pubnix.comdinoex2003-04-062-4/+6 * After repo copy from graphics category to newly create multimedialioux2003-04-041-1/+1 * - retire pkg-commentdinoex2003-02-211-1/+0 * - add COMMENTdinoex2003-02-211-0/+1 * Add more sites to MASTER_SITESdinoex2003-01-031-1/+4 * - Update to 2.92.0dinoex2003-01-024-38/+86 * - Take maintainership, Update pending.dinoex2002-12-101-1/+1 * o Rollback PORTCOMMENT modifications while this feature's implementationlioux2002-11-112-4/+1 * Use PORTCOMMENT in the Makefile, and whack the pkg-comment.adamw2002-11-072-1/+2 * Make this build and install cleanly on alpha so as to unblock the kdegallatin2002-06-023-23/+35 * Fix build problem on 5-current.motoyuki2002-04-111-0/+14 * Massive style enforcement - use ^I instead of spaces for variables identation.sobomax2001-01-171-3/+3 * Update to version 2.80.2.steve2000-12-112-1/+7 * Convert to PORTNAME/PORTVERSION. lfview had an invalid versionasami2000-04-141-3/+3 * Correct man page entrycpiazza1999-12-051-2/+1 * The manpage is in section n and isn't compressed.steve1999-11-271-1/+2 * FreeBSD.ORG -> FreeBSD.orgmharo1999-08-311-1/+1 * Change Id->FreeBSD.obrien1999-08-251-1/+1 * Commit #2/4 to enforce Caps, no period. I ran this oe ashoek1999-06-271-1/+1 * Turn off sound support except on the i386 port.steve1999-06-231-5/+7 * Fix path for shareds objects.tg1999-06-071-1/+1 * Use FreeBSD-ELF shared objects for the new supported codecs.tg1999-05-314-34/+49 * More WWW: additionsmharo1999-05-071-1/+1 * Add homepage. Incidentally, this DESCR is a little long.hoek1999-04-271-0/+2 * Update to 2.80.1flathill1999-03-313-49/+53 * Remove extraneous x11 from CATEGORIES.steve1998-11-211-2/+2 * Use bsd.port.{pre,post}.mk. Either use them to avoid having to defineasami1998-11-111-13/+13 * Provide replacements for the NetBSD (a.out) .o modules from the Linux (ELF)markm1998-09-272-5/+15 * Convert to ELF.markm1998-09-152-20/+21 * Wow. Checkout the number of manpages that are in EZWGL. I think that'shoek1998-08-191-1/+0 * Upgrade to 2.70.7.0.tg1998-04-283-88/+70 * "$(INCDIR)" -> "$(INCDIR)/X11" to make XFree86-3.3 config files happy.asami1997-06-131-0/+17 * Upgrade, 2.70.6.3 -> 2.70.6.4.max1997-06-103-17/+19 * Master site has moved.asami1996-12-071-8/+5 * Compress a bunch of manpages. Remove unnecessary @ directives fromasami1996-11-181-1/+0 * Use MAN? macros. CATEGORIES+= -> CATEGORIES.asami1996-11-181-2/+2 * Upgrade to 2.70.6.3ache1996-09-27