Using associative arrays with a text-based GtkComboBox

Sometimes I need to create a combobox to manage associative arrays. I need something which works like HTML comboboxes, where the value chosen by the user, is different from the one sent to the application.

Just like that:

<option value="Red">Apple</option>

so I wrote a component which doesn't use a GtkTreeModel to manage data.

class GtkAssociativeComboBox {
private $data;
public $box;

public function __construct ()
$this->box = GtkCombobox::new_text();
$this->data = null;


Syndicate content