diff options
Diffstat (limited to 'mdkonline')
-rwxr-xr-x | mdkonline | 51 |
1 files changed, 29 insertions, 22 deletions
@@ -69,7 +69,6 @@ $o->{mw}{rwindow}->set_position('center'); $o->{mw}{window}->signal_connect( "delete_event", sub { Gtk2->main_quit} ); $o->{nb} = Gtk2::Notebook->new; $o->{nb}->set_show_tabs(0); $o->{nb}->set_show_border(0); -$o->{bottomHbox} = Gtk2::HBox->new; my %stage = ( 0 => sub { if ($o->{account_cb}->get_active) { subsOnline() } else { $o->{nb}->next_page} }, 1 => sub { $o->{nb}->next_page(); setEntryWithConf() }, @@ -77,27 +76,35 @@ my %stage = ( 3 => sub { log::l("[mdkonline] Sending configuration to remote server"); sendConfig() }, 4 => sub { log::l("[mdkonline] Writing local configuration dir"); setConf() } ); -$o->{actions} = { - Next => sub { - $p = $o->{nb}->get_current_page; - $stage{$p}->(); - $p <= 0 and $o->{Prev}->set_sensitive(1); - $p == 4 and mainQuit() - }, - SkipWiz => sub { - mainQuit() - }, - Prev => sub { - $p = $o->{nb}->get_current_page; - $o->{nb}->prev_page(); - $p <= 1 and init(0) - } - }; -foreach my $l (['Next', 'gtk-go-forward', 'stock'], ['SkipWiz', N("Skip Wizard")], ['Prev', 'gtk-go-back', 'stock']) { - $o->{$l->[0]} = $l->[2] ? Gtk2::Button->new_from_stock($l->[1]) : Gtk2::Button->new(" " . $l->[1] . " "); - $l->[2] ? $o->{bottomHbox}->pack_end($o->{$l->[0]}, 0, 0, 1) : $o->{bottomHbox}->pack_start($o->{$l->[0]}, 0, 0, 1); - $o->{$l->[0]}->signal_connect( clicked => sub { $o->{actions}{$l->[0]}->() }); -} +$o->{bottomHbox} = create_okcancel(my $w = + { + cancel_clicked => \&mainQuit, + ok_clicked => sub { + $p = $o->{nb}->get_current_page; + $stage{$p}->(); + $p <= 0 and $o->{Prev}->set_sensitive(1); + $p == 4 and mainQuit() + }, + }, + undef, undef, '', + [ "gtk-go-back", sub { + $p = $o->{nb}->get_current_page; + $o->{nb}->prev_page(); + $p <= 1 and init(0) + }, + 0, 1, + ], + ); +$w->{cancel}->set_label(N("Skip Wizard")); +$o->{Next} = $w->{ok}; +$o->{SkipWiz} = $w->{cancel}; + +$w->{ok}->set_label(N("gtk-go-forward")); +$w->{ok}->set_use_stock(1); + +$o->{Prev} = $w->{buttons}{'gtk-go-back'}; +$o->{Prev}->set_use_stock(1); + gtkadd($o->{mw}{window}, gtkpack_(Gtk2::VBox->new(0, 2), 1, $o->{nb}, |