2011/2/23 Timo Schneider <ti...@hrz.tu-chemnitz.de>:
> On Tue, 2011-02-22 at 08:51 -0700, Kevin DeKorte wrote:
>
>> On 02/22/2011 08:46 AM, Allin Cottrell wrote:
>> >
>> > It seems that you are in fact OK using the GtkComboBox API for
>> > this purpose, as in
>> >
>> > void depopulate_combo_box (GtkComboBox *box)
>> > {
>> >     GtkTreeModel *model = gtk_combo_box_get_model(box);
>> >     GtkTreeIter iter;
>> >
>> >     while (gtk_tree_model_get_iter_first(model, &iter)) {
>> >         gtk_combo_box_remove_text(box, 0);
>> >     }
>> > }
>> >
>> > Allin Cottrell
>> > _______________________________________________
>>
>> If your going to use the model, then perhaps this will work...
>>
>> gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box))));
>
> Yes, I can do that. But I think it's a bug in the API if I have to rely
> on a specific implementation of an API function to do something that
> simple. Why isn't there a funtion like
>
> guint gtk_combo_box_text_num_elements()

Sure, there is gtk_tree_model_n_children() or such (it would
be a worse idea to add api to the combo box when a perfectly
valid method of counting the liststore elements already exists).

>
> which returns the number of the remaining elements in the list? Because
> as of now it would be perfectly legal to _not_ use a GtkTreeModel to
> store list entries in case the ComboBox was created with the _text_
> convenience functions.
> Or the API specs should say that a combo box created with the
> convenience functions will always result in normal combo box with a
> GtkTreeModel and thus all functions are usable.

A combo box using the text api uses an internally created
liststore to store the text, it cannot use anything else but
a treemodel.

Sure, the api docs are not so clear about this, which is why
all of your documentation patches are welcome in bugzilla (the
GtkComboBoxText class new in GTK+ 2.24 might have
better documentation, but you are welcome to improve
those docs too).

Cheers,
         -Tristan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to