changeset 575:e72f61a8f492

Hopefully fixes an error with wrong indexes in the containers on GTK after multiple appends.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 10 Feb 2005 09:12:15 +0000
parents 70c8a30c254f
children fa710b6cbba5
files gtk/dw.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Thu Feb 10 00:38:55 2005 +0000
+++ b/gtk/dw.c	Thu Feb 10 09:12:15 2005 +0000
@@ -5888,7 +5888,7 @@
  */
 void *dw_container_alloc(HWND handle, int rowcount)
 {
-	int z, count = 0;
+	int z, count = 0, prevrowcount = 0;
 	GtkWidget *clist;
 	GdkColor *fore, *back;
 	char **blah;
@@ -5903,6 +5903,7 @@
 	}
 
 	count = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_colcount");
+	prevrowcount = (int)gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount");
 
 	if(!count)
 	{
@@ -5920,11 +5921,11 @@
 	{
 		gtk_clist_append(GTK_CLIST(clist), blah);
 		if(fore)
-			gtk_clist_set_foreground(GTK_CLIST(clist), z, fore);
+			gtk_clist_set_foreground(GTK_CLIST(clist), z + prevrowcount, fore);
 		if(back)
-			gtk_clist_set_background(GTK_CLIST(clist), z, back);
-	}
-	gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)rowcount);
+			gtk_clist_set_background(GTK_CLIST(clist), z + prevrowcount, back);
+	}
+	gtk_object_set_data(GTK_OBJECT(clist), "_dw_rowcount", (gpointer)(rowcount + prevrowcount));
 	free(blah);
 	DW_MUTEX_UNLOCK;
 	return (void *)handle;