This is why many GTK + widgets that show data are model based. The model contains data, not a widget. A widget acts as a “view” in the data, and models can be shared between several widgets.
You just need to use the same model in both lists:
GtkListStore *model; GtkWidget *c1, *c2; model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INTEGER); c1 = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); c2 = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
source share