summaryrefslogtreecommitdiffstats
path: root/mdkonline
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-06-15 06:28:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-06-15 06:28:19 +0000
commitbcbb1b8cd9963b7dfce475a08408ac62b237c3fd (patch)
treebaf75156d4c0ce731e1b38bf645ff5e317e005f6 /mdkonline
parenteb01cd3f33bb126b0f5ffbfbcb16a98e42accde7 (diff)
downloadmgaonline-bcbb1b8cd9963b7dfce475a08408ac62b237c3fd.tar
mgaonline-bcbb1b8cd9963b7dfce475a08408ac62b237c3fd.tar.gz
mgaonline-bcbb1b8cd9963b7dfce475a08408ac62b237c3fd.tar.bz2
mgaonline-bcbb1b8cd9963b7dfce475a08408ac62b237c3fd.tar.xz
mgaonline-bcbb1b8cd9963b7dfce475a08408ac62b237c3fd.zip
fix button layout (all buttons got the same spacing) and reuse ugtk2
infrastructure
Diffstat (limited to 'mdkonline')
-rwxr-xr-xmdkonline51
1 files changed, 29 insertions, 22 deletions
diff --git a/mdkonline b/mdkonline
index 8f66f9dc..90d6e617 100755
--- a/mdkonline
+++ b/mdkonline
@@ -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},