Issues with gtkcombobox
gtk+ 3.24, linux.
- create a gtkcombobox
- add a list store type TreeModel, populated with a few items.
- connect a callback to the combobox "changed" signal
- clear the list store with gtk_list_store_clear()
Results: "changed" signal / callback is called for every single item in the list store. This seems rather wasteful, would it not be better to clear the the list store / tree model FIRST, THEN call the changed callback ?
In addition, this signal appears impossible to block. I maybe doing something wrong, but have tried the following: guint sigid = g_signal_lookup("changed", GTK_TYPE_COMBO_BOX); g_signal_handlers_block_matched(combo, G_SIGNAL_MATCH_ID, sigid, 0, NULL, NULL, NULL);
before clearing the list store, but the signal is emitted despite this.
N.B. none of the following have any effect on this:
- setting the entry text to ""
- setting the active index to -1
- setting the active iter to NULL.
The only workaround I have found is to set the entry text to "", then block the signal using the normal g_signal_handler_block / g_signal_handler_unblock, however having to do this for every single combobox is somewhat inconvenient. In addition, doing it this way means that the "changed" signal is called BEFORE the tree model is cleared (clearing the text afterwards does not call the callback)