## Migrating from GtkCombo to GtkComboBoxEntry

Here is an example of a simple, but typical use of a GtkCombo:

    1
    2
    3
    4
    5
    6
    7
    8
    9

    GtkWidget *combo;
    GList *items = NULL;

    items = g_list_append (items, "First Item");
    items = g_list_append (items, "Second Item");
    items = g_list_append (items, "Third Item");

    combo = gtk_combo_new ();
    gtk_combo_set_popdown_strings (GTK_COMBO (combo), items);

In order to react to the user's selection, connect to the “changed” signal on the combo and use `gtk_entry_get_text (GTK_ENTRY (combo->entry))` to retrieve the selected text.

And here is how it would be done using GtkComboBoxEntry:

    1
    2
    3
    4
    5

    combo_box = gtk_combo_box_text_new_with_entry ();

    gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "First Item");
    gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Second Item");
    gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo_box), "Third Item");

In order to react to the user's selection, connect to the “changed” signal on the combo and use `gtk_entry_get_text (GTK_ENTRY (GTK_BIN (combo_box)->child))` to retrieve the selected text.