… | |
… | |
3518 | my ($self) = @_; |
3518 | my ($self) = @_; |
3519 | $self->ask_for_bind (1); |
3519 | $self->ask_for_bind (1); |
3520 | } |
3520 | } |
3521 | |
3521 | |
3522 | sub ask_for_bind { |
3522 | sub ask_for_bind { |
3523 | my ($self, $commit) = @_; |
3523 | my ($self, $commit, $end_cb) = @_; |
3524 | |
3524 | |
3525 | CFClient::Binder::open_binding_dialog (sub { |
3525 | CFClient::Binder::open_binding_dialog (sub { |
3526 | my ($mod, $sym) = @_; |
3526 | my ($mod, $sym) = @_; |
3527 | $self->{binding} = [$mod, $sym]; # XXX: how to stop that memleak? |
3527 | $self->{binding} = [$mod, $sym]; # XXX: how to stop that memleak? |
3528 | $self->update_binding_widgets; |
3528 | $self->update_binding_widgets; |
3529 | $self->commit if $commit; |
3529 | $self->commit if $commit; |
|
|
3530 | $end_cb->() if $end_cb; |
3530 | }); |
3531 | }); |
3531 | } |
3532 | } |
3532 | |
3533 | |
3533 | # $mod and $sym are the modifiers and key symbol |
3534 | # $mod and $sym are the modifiers and key symbol |
3534 | # $cmds is a array ref of strings (the commands) |
3535 | # $cmds is a array ref of strings (the commands) |
… | |
… | |
3552 | } |
3553 | } |
3553 | |
3554 | |
3554 | # this is a shortcut method that asks for a binding |
3555 | # this is a shortcut method that asks for a binding |
3555 | # and then just binds it. |
3556 | # and then just binds it. |
3556 | sub do_quick_binding { |
3557 | sub do_quick_binding { |
3557 | my ($self, $cmds) = @_; |
3558 | my ($self, $cmds, $end_cb) = @_; |
3558 | $self->set_binding (undef, undef, $cmds, sub { |
3559 | $self->set_binding (undef, undef, $cmds, sub { |
3559 | $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2]; |
3560 | $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2]; |
3560 | }); |
3561 | }); |
3561 | $self->ask_for_bind (1); |
3562 | $self->ask_for_bind (1, $end_cb); |
3562 | } |
3563 | } |
3563 | |
3564 | |
3564 | sub update_binding_widgets { |
3565 | sub update_binding_widgets { |
3565 | my ($self) = @_; |
3566 | my ($self) = @_; |
3566 | my ($mod, $sym, $cmds) = $self->get_binding; |
3567 | my ($mod, $sym, $cmds) = $self->get_binding; |