sub INSERT_ROW {
my ($model, $position) = @_;
if ($position > 0) {
# if position is a positive integer, set at the given position
@{$model->{data}}[$position] = { col1 => undef, col2 => "Default", };
}
elsif ($position == 0) {
# if position is zero, then prepend
}
else {
# if position is a negative integer, then append
push @{$model->{data}}, { col1 => undef, col2 => undef, };
$position = scalar @{$model->{data}};
}
# return the iterator for the new row
return Glib::Object->new('MyModel::Iter',
model => $model,
row => $position);
}