Skip to content

Commit

Permalink
GUI: basedata import: Rework the column reorder logic
Browse files Browse the repository at this point in the history
The downs were not wrapping, possibly due to Gtk3 differences.

Updates #770
  • Loading branch information
shawnlaffan committed Nov 1, 2020
1 parent 402a078 commit 6c585cd
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions lib/Biodiverse/GUI/BasedataImport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1309,27 +1309,18 @@ sub on_up_down {
return if not $iter;
}

if ( $btn eq 'up' ) {
my $path = $model->get_path($iter);
if ( $path->prev() ) {

my $iter_prev = $model->get_iter($path);
$model->move_before( $iter, $iter_prev );
my $path = $model->get_path($iter);

}

else {
# If at the top already, move to bottom
$model->move_before( $iter, undef );

}
if ( $btn eq 'up' ) {
# If at the top already, will move to bottom
my $iter_prev = $path->prev() ? $model->get_iter($path) : undef;
$model->move_before( $iter, $iter_prev );
}
elsif ( $btn eq 'down' ) {
# need copy as iter_next updates $iter under Gtk3
my $iter_from = $model->iter_copy($iter);
if ($model->iter_next ($iter)) {
$model->move_after( $iter_from, $iter );
}
# If at the bottom already, move to top
$path->next();
my $iter_next = $model->get_iter($path);
$model->move_after( $iter, $iter_next );
}

return;
Expand Down

0 comments on commit 6c585cd

Please sign in to comment.