diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-21 09:42:55 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-21 09:42:55 +0000 |
commit | 5d4e571c9047fde897937a5f73b717382af31bbe (patch) | |
tree | d9438eaa7a9b7addc61773f2b691a9ac97c01972 /rpmdrake.pm | |
parent | 3e7b1254f6901934c99640481de0e6d522ad3cfa (diff) | |
download | rpmdrake-5d4e571c9047fde897937a5f73b717382af31bbe.tar rpmdrake-5d4e571c9047fde897937a5f73b717382af31bbe.tar.gz rpmdrake-5d4e571c9047fde897937a5f73b717382af31bbe.tar.bz2 rpmdrake-5d4e571c9047fde897937a5f73b717382af31bbe.tar.xz rpmdrake-5d4e571c9047fde897937a5f73b717382af31bbe.zip |
make the focus default on "yes" in yes/no dialogs (Emmanuel Blindauer, #39123)
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r-- | rpmdrake.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/rpmdrake.pm b/rpmdrake.pm index 4d2e1c37..4e2a3482 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -207,6 +207,7 @@ sub interactive_msg { } my $banner = $options{banner} ? getbanner() : undef; my $text_w; + my $button_yes; gtkadd( $d->{window}, gtkpack_( @@ -226,23 +227,23 @@ sub interactive_msg { ref($options{yesno}) eq 'ARRAY' ? map { my $label = $_; gtksignal_connect( - Gtk2::Button->new($label), + $button_yes = Gtk2::Button->new($label), clicked => sub { $d->{retval} = $label; Gtk2->main_quit } ); } @{$options{yesno}} : ( $options{yesno} ? ( - gtksignal_connect( - Gtk2::Button->new($options{text}{no} || N("No")), + gtksignal_connect( + Gtk2::Button->new($options{text}{no} || N("No")), clicked => sub { $d->{retval} = 0; Gtk2->main_quit } ), gtksignal_connect( - Gtk2::Button->new($options{text}{yes} || N("Yes")), + $button_yes = Gtk2::Button->new($options{text}{yes} || N("Yes")), clicked => sub { $d->{retval} = 1; Gtk2->main_quit } ), ) : gtksignal_connect( - Gtk2::Button->new(N("Ok")), + $button_yes = Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit } ) ) @@ -250,6 +251,7 @@ sub interactive_msg { ) ) ); + $d->{window}->set_focus($button_yes); $text_w->set_size_request($typical_width*2, $options{scroll} ? 300 : -1); $d->main; return $d->{retval}; @@ -294,6 +296,7 @@ sub interactive_list { } \@radios, $list, ) : gtkpack__(Gtk2::VBox->new(0, 0), @radios); my $choice; + my $button_ok; gtkadd( $d->{window}, gtkpack__( @@ -307,7 +310,7 @@ sub interactive_list { Gtk2::Button->new(N("Cancel")), clicked => sub { Gtk2->main_quit }), ), gtksignal_connect( - Gtk2::Button->new(N("Ok")), clicked => sub { + $button_ok=Gtk2::Button->new(N("Ok")), clicked => sub { each_index { $_->get_active and $choice = $::i } @radios; Gtk2->main_quit; } @@ -315,6 +318,7 @@ sub interactive_list { ) ) ); + $d->{window}->set_focus($button_ok); $d->main; $choice; } |