Re: Reading from a GtkComboBox created with ..._new_text()



Hi

Internally the GtkComboBox created with gtk_combo_box_new_text() uses a
GtkListStore as it's "TreeModel". Just call gtk_combo_box_get_model() to
get it.

> I would like to loop around all items in the combo.

model = gtk_combo_box_get_model( combo );

if( ! gtk_tree_model_get_iter_first( model, &iter ) )
	return -1; // Empty list

do {
	gtk_tree_model_get( model, &iter, 0, &combo_text, -1 );

	g_free( combo_text );
}
while( gtk_tree_model_iter_next( model, &iter ) );

HTH

Jan-Marek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]