Skip to content

Commit

Permalink
Avoid shared variable warning in DrawingTool by using an explicit ano…
Browse files Browse the repository at this point in the history
…nymous function (#713)
  • Loading branch information
nicomen authored Oct 31, 2024
1 parent be6df92 commit 66c21b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions share/shutter/resources/modules/Shutter/Draw/DrawingTool.pm
Original file line number Diff line number Diff line change
Expand Up @@ -675,16 +675,16 @@ sub setup_right_vbox_c {
#get current pixbuf
my $pixbuf = $self->{_view}->get_pixbuf || $self->{_drawing_pixbuf};

sub value_callback {
my $value_callback = sub {
$self->{_selector}->set_selection({x=>$self->{_x_spin_w}->get_value, y=>$self->{_y_spin_w}->get_value, width=>$self->{_width_spin_w}->get_value, height=>$self->{_height_spin_w}->get_value});
}
};

#X
my $xw_label = Gtk3::Label->new($self->{_d}->get("X") . ":");
$self->{_x_spin_w} = Gtk3::SpinButton->new_with_range(0, $pixbuf->get_width, 1);
$self->{_x_spin_w}->set_value(0);
$self->{_x_spin_w_handler} = $self->{_x_spin_w}->signal_connect(
'value-changed' => \&value_callback);
'value-changed' => $value_callback);

my $xw_hbox = Gtk3::HBox->new(FALSE, 5);
$xw_hbox->pack_start($xw_label, FALSE, FALSE, 5);
Expand All @@ -695,7 +695,7 @@ sub setup_right_vbox_c {
$self->{_y_spin_w} = Gtk3::SpinButton->new_with_range(0, $pixbuf->get_height, 1);
$self->{_y_spin_w}->set_value(0);
$self->{_y_spin_w_handler} = $self->{_y_spin_w}->signal_connect(
'value-changed' => \&value_callback);
'value-changed' => $value_callback);

my $yw_hbox = Gtk3::HBox->new(FALSE, 5);
$yw_hbox->pack_start($yw_label, FALSE, FALSE, 5);
Expand All @@ -706,7 +706,7 @@ sub setup_right_vbox_c {
$self->{_width_spin_w} = Gtk3::SpinButton->new_with_range(0, $pixbuf->get_width, 1);
$self->{_width_spin_w}->set_value(0);
$self->{_width_spin_w_handler} = $self->{_width_spin_w}->signal_connect(
'value-changed' => \&value_callback);
'value-changed' => $value_callback);

my $ww_hbox = Gtk3::HBox->new(FALSE, 5);
$ww_hbox->pack_start($widthw_label, FALSE, FALSE, 5);
Expand All @@ -717,7 +717,7 @@ sub setup_right_vbox_c {
$self->{_height_spin_w} = Gtk3::SpinButton->new_with_range(0, $pixbuf->get_height, 1);
$self->{_height_spin_w}->set_value(0);
$self->{_height_spin_w_handler} = $self->{_height_spin_w}->signal_connect(
'value-changed' => \&value_callback);
'value-changed' => $value_callback);

my $hw_hbox = Gtk3::HBox->new(FALSE, 5);
$hw_hbox->pack_start($heightw_label, FALSE, FALSE, 5);
Expand Down

0 comments on commit 66c21b2

Please sign in to comment.