Skip to content

Gtk3 migration - get rid of option_menu where possible

Christian Theis requested to merge hoagie/xsane:gtk3-less-option-menus into master

This pack of commits tries to get rid of gtk_option_menu items as far as possible, as these were removed in gtk3. There are two cases, where this is not possible - these are the cases where the application currently offers a popup menu when selecting an item from the option_menu (for sorting and removal). I don't think that this can be mimicked with comboboxes, as those don't have a signal for the case when an item is activated? It seems for those a redesign is needed in gtk3.

I started with the toughest case, the modus option menu, as this one has accelerators. I don't want to touch any sensitive topics, but gtk3 developers probably don't like this use of comboboxes very much, as the handling of key events becomes completely manual? The accel renderer cannot be used, as this one makes the column very wide (in anticipation of accelerator editing by the user?). There also seems to be as a quirk needed for this combobox (and there was another one down the line) to have a manual g_object_ref added, otherwise the active combobox gets destroyed (with obvious error messages)? It also requires a manual hook of the realize event to have the combobox sized so that the accelerators are not displayed. Further to that, there seems to be a need for column rendering functions (which I then used for all comboboxes)?

I made the usage of all comboboxes similar, in that they use an additional column in their model to portray the row number or additional information. I did some tests, and these were fine. One thing to keep in mind is however that the event that can be taken for comboboxes is "changed" instead of activate. In that sense, there might be an additional signal when the application sets the row number of a combobox (this implies changed, whilst I don't think that option_menus creates an activate signal for the menu items when the option menu is set).

Merge request reports