Wireshark-dev: Re: [Wireshark-dev] Remaining GtkOptionMenu to GtkComboBox cases

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Thu, 18 Feb 2010 23:19:21 -0500
It appears that most (all ?) of the remaining cases of GtkOptionMenu use the same style:

-Connect a callback (with an associated "user data" pointer or value)
 to each individual entry of a GtkOptionMenu;
-Upon the callback when a specific entry is selected, use the associated
 value as needed.


I decided to generalize the work I did for firewall_dlg.c to create

ws_combo_box_new_text_and_pointer() and associated functions.

Essentially: The functions are a slight generalization of gtk_combo_box_new_text() and associated.

They store a pointer along with the combo_box dropdown text in the list_store associated with the combo_box.

When an entry is selected and a callback is invoked, a simple ws_combo_box_get_active_pointer() gets the pointer associated with the selected (active) entry.


With these functions I think it should be a fairy simple matter to replace all the remaining usage of GtkOptionMenu.

I'll mark the remaining GtkOptionMenu cases as "in progress" on the Wiki "Deprecated GTK and Glib Functions Replacement" page.


Bill