use strict;
use Gtk2 -init;
use Glib qw / TRUE FALSE /;

# good 
my $good_model = Gtk2::ListStore->new(
    'Glib::Int',
    'Glib::String',
    'Glib::String'
);

populate_model( $good_model );

# bad
my $bad_model = Gtk2::ListStore->new(
    'Glib::Int',
    'Glib::Int',
    'Glib::String'
);

populate_model( $bad_model );

my $window = Gtk2::Window->new;
$window->signal_connect (destroy => sub {Gtk2->main_quit});

my $hbox = Gtk2::HBox->new( 0, 5 );

my $good_combo = create_combo( $good_model );
$hbox->pack_start( $good_combo, TRUE, TRUE, 5 );

my $bad_combo = create_combo( $bad_model );
$hbox->pack_start( $bad_combo, TRUE, TRUE, 5 );

$window->add( $hbox );

$window->show_all;
Gtk2->main;

sub populate_model {
    
    my $model = shift;
    
    $model->set(
        $model->append,
        0, 1,    # 1st column
        1, 1,    # 2nd column
        2, "One" # 3rd column
    );
    
    $model->set(
        $model->append,
        0, 2,
        1, 2,
        2, "Two"
    );
    
    $model->set(
        $model->append,
        0, 3,
        1, 3,
        2, "Three"
    );
    
}

sub create_combo {
    
    my $this_model = shift;
    
    my $combo = Gtk2::ComboBoxEntry->new( $this_model, 1 );
    
    # Create a renderer for the 3rd column ( the text column )
    my $renderer = Gtk2::CellRendererText->new;
    $combo->pack_start( $renderer, FALSE );
    $combo->set_attributes( $renderer, text => 2 );
    
    return $combo;
    
}