gtk_clist_insert() on empty clist
- From: Marc Ewing <marc redhat com>
- To: gtk-list redhat com
- Subject: gtk_clist_insert() on empty clist
- Date: Fri, 20 Feb 1998 14:11:59 -0500
The follow patch appears to allow you to do:
gtk_clist_insert(GTK_CLIST(clist), 0, text);
on a newly created clist (previously there had to be something
in the list before you could use gtk_clist_insert()). I think
it also happens to allow you to do:
gtk_clist_insert(GTK_CLIST(clist), last_row, text);
to get gtk_clist_append()-like behaviour.
-Marc
Index: gtkclist.c
===================================================================
RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkclist.c,v
retrieving revision 1.25
diff -u -r1.25 gtkclist.c
--- gtkclist.c 1998/02/20 05:29:02 1.25
+++ gtkclist.c 1998/02/20 19:11:04
@@ -1221,7 +1221,7 @@
g_return_if_fail (text != NULL);
/* return if out of bounds */
- if (row < 0 || row > (clist->rows - 1))
+ if (row < 0 || row > clist->rows)
return;
/* create the row */
@@ -1236,7 +1236,12 @@
/* reset the row end pointer if we're inserting at the
* end of the list */
if (row == clist->rows)
- clist->row_list_end = (g_list_append (clist->row_list_end, clist_row))->next;
+ if (clist->row_list) {
+ clist->row_list_end = (g_list_append (clist->row_list_end, clist_row))->next;
+ } else {
+ clist->row_list = g_list_append(clist->row_list, clist_row);
+ clist->row_list_end = clist->row_list;
+ }
else
clist->row_list = g_list_insert (clist->row_list, clist_row, row);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]