/* This is the signal handler that got connected to button * press/release events of the List */ void sigh_button_event( GtkWidget *gtklist, GdkEventButton *event, GtkWidget *frame ) { /* We only do something if the third (rightmost mouse button * was released */ if (event->type==GDK_BUTTON_RELEASE && event->button==3) { GList *dlist, *free_list; GtkWidget *new_prisoner; /* Fetch the currently selected list item which * will be our next prisoner ;) */ dlist=GTK_LIST(gtklist)->selection; if (dlist) new_prisoner=GTK_WIDGET(dlist->data); else new_prisoner=NULL; /* Look for already imprisoned list items, we * will put them back into the list. * Remember to free the doubly linked list that * gtk_container_children() returns */ dlist=gtk_container_children(GTK_CONTAINER(frame)); free_list=dlist; while (dlist) { GtkWidget *list_item; list_item=dlist->data; gtk_widget_reparent(list_item, gtklist); dlist=dlist->next; } g_list_free(free_list); /* If we have a new prisoner, remove him from the * List and put him into the frame "Prison". * We need to unselect the item first. */ if (new_prisoner) { GList static_dlist; static_dlist.data=new_prisoner; static_dlist.next=NULL; static_dlist.prev=NULL; gtk_list_unselect_child(GTK_LIST(gtklist), new_prisoner); gtk_widget_reparent(new_prisoner, frame); } } }
/* Unselects the given child. The signal GtkList::unselect-child will be emitted. */ int clip_GTK_LISTUNSELECTCHILD(ClipMachine * ClipMachineMemory) { C_widget *clst = _fetch_cw_arg(ClipMachineMemory); C_widget *cchild = CWIDGET_ARG(ClipMachineMemory, 2); CHECKCWID(clst, GTK_IS_LIST); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWID(cchild, GTK_IS_LIST_ITEM); gtk_list_unselect_child(GTK_LIST(clst->widget), cchild->widget); return 0; err: return 1; }
static void gtk_combo_update_list (GtkEntry * entry, GtkCombo * combo) { GtkList *list = GTK_LIST (combo->list); GList *slist = list->selection; GtkListItem *li; gtk_grab_remove (GTK_WIDGET (combo)); gtk_signal_handler_block (GTK_OBJECT (entry), combo->entry_change_id); if (slist && slist->data) gtk_list_unselect_child (list, GTK_WIDGET (slist->data)); li = gtk_combo_find (combo); if (li) gtk_list_select_child (list, GTK_WIDGET (li)); gtk_signal_handler_unblock (GTK_OBJECT (entry), combo->entry_change_id); }