#include #include static GtkWidget *combo1; static GtkWidget *combo2; static GList *one_list; static GList *two_list; static GList *three_list; void callback (GtkEntry *entry) { if (strcmp ("one", gtk_entry_get_text (entry)) == 0) gtk_combo_set_popdown_strings (GTK_COMBO (combo2), one_list); else if (strcmp ("two", gtk_entry_get_text (entry)) == 0) gtk_combo_set_popdown_strings (GTK_COMBO (combo2), two_list); else if (strcmp ("three", gtk_entry_get_text (entry)) == 0) gtk_combo_set_popdown_strings (GTK_COMBO (combo2), three_list); else ; // no list for this one } int main (int argc, char *argv[]) { GtkWidget *win; GtkWidget *vbox; GList *popdown_list; gtk_init (&argc, &argv); win = gtk_window_new (GTK_WINDOW_TOPLEVEL); vbox = gtk_vbox_new (TRUE, 0); gtk_container_add (GTK_CONTAINER (win), vbox); combo1 = gtk_combo_new (); gtk_box_pack_start (GTK_BOX (vbox), combo1, FALSE, FALSE, 0); popdown_list = NULL; popdown_list = g_list_prepend (popdown_list, "three"); popdown_list = g_list_prepend (popdown_list, "two"); popdown_list = g_list_prepend (popdown_list, "one"); gtk_combo_set_popdown_strings (GTK_COMBO (combo1), popdown_list); gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo1)->entry), "changed", GTK_SIGNAL_FUNC (callback), NULL); combo2 = gtk_combo_new (); gtk_box_pack_start (GTK_BOX (vbox), combo2, FALSE, FALSE, 0); one_list = NULL; one_list = g_list_prepend (one_list, "nsa"); one_list = g_list_prepend (one_list, "fbi"); one_list = g_list_prepend (one_list, "cia"); two_list = NULL; two_list = g_list_prepend (two_list, "justice"); two_list = g_list_prepend (two_list, "infinite"); three_list = NULL; three_list = g_list_prepend (three_list, "pgp"); three_list = g_list_prepend (three_list, "gpg"); three_list = g_list_prepend (three_list, "rsa"); gtk_combo_set_popdown_strings (GTK_COMBO (combo2), one_list); gtk_widget_show_all (win); gtk_main (); return 0; }