adding to a gtk list object
- From: Keith Geffert <keith penguingurus com>
- To: gtk-app-devel-list gnome org
- Subject: adding to a gtk list object
- Date: 25 Jun 2001 17:08:41 -0400
Hello all,
After banging my head on this for a while I'm going to give in and ask
for some wisdom. I'm really new to GTK so bare with me. I want to add
things to a gtkList widget. I've got the code to work with the
gtk_container_add(), which I found here on the mailing list. While it
works it's not the desired effect. I want new items added to the list
to insert at the top. I figured I'd used gtk_list_insert_items(). But
I continually get a sefault.
I'm just probably not understanding what is supposed to go in the GList
but here's what I got.
add_to_list is called by gtk_timeout_add() every 3 seconds. I want to
make sure the viewport scrolls :P The timer works fine.
gboolean
add_to_list (gpointer data)
{
GtkWidget *myListItem;
GtkWidget *WidgetRef, *listWidget;
GList *mygList = NULL;
WidgetRef= GTK_WIDGET(data);
listWidget = lookup_widget( GTK_WIDGET(WidgetRef), "packet_list"
);
printf("Got here\n");
if (listWidget != NULL ) { printf("myList isn't null\n"); }
printf("1\n");
myListItem = gtk_list_item_new_with_label("New GTK list Item");
printf("2\n");
mygList = g_list_append( mygList, myListItem );
// gtk_container_add( GTK_CONTAINER(listWidget), myListItem);
gtk_list_insert_items( GTK_LIST(listWidget), mygList, 0 );
printf("3\n");
gtk_widget_show(myListItem);
g_list_free( mygList );
printf("4\n");
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]