Re: gtk_combo_box_new_text() API



On Wed, 2011-02-23 at 03:46 +0900, Tristan Van Berkom wrote:

Hi,

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).

Agreed. Otherwise the whole convenience wrapper-function stuff would
just replicate the existing API for everything.

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).

Ok, I will take a look at the VCS-head and see if I can come up with a
small patch to the documentation that clarifies the meaning of the "If
you use this function to create a text combo box, you should only
manipulate its data source with the following convenience functions:"
sentence. (If this isn't done already, so far I only looked at the stuff
packaged in debian, not at the actual upstream documents.)

Regards,
Timo


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