From df4ba1f5dfad7c66ceeec37e5fdfb88ec12776b9 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 14 Feb 2003 13:12:38 +0000 Subject: - update steps window to 9.1 theme (blue/white bullets) - don't destroy steps window between each step => better looking --- perl-install/install_gtk.pm | 46 ++++++++++++++++++++++++++++--------- perl-install/install_steps_gtk.pm | 5 ++-- perl-install/pixmaps/steps_off.png | Bin 0 -> 401 bytes perl-install/pixmaps/steps_on.png | Bin 0 -> 372 bytes 4 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 perl-install/pixmaps/steps_off.png create mode 100644 perl-install/pixmaps/steps_on.png diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index bebf9eb6c..c211b6ea4 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -110,35 +110,59 @@ sub create_help_window { } #------------------------------------------------------------------------------ +my %steps; sub create_steps_window { my ($o) = @_; return if $::stepswidth == 0; - $o->{steps_window}->destroy if $o->{steps_window}; - my $w = bless {}, 'ugtk2'; $w->{rwindow} = $w->{window} = Gtk2::Window->new('toplevel'); - $w->{rwindow}->set_uposition(0, 100); + $w->{rwindow}->set_uposition(8, 160); $w->{rwindow}->set_size_request($::stepswidth, $::stepsheight); $w->{rwindow}->set_name('Steps'); $w->{rwindow}->set_title('skip'); - my @l = ('', '', N("System installation")); - my $s; + $steps{$_} = gtkcreate_pixbuf("steps_$_") foreach qw(on off); + + gtkpack__(my $vb = Gtk2::VBox->new(0, 3), $steps{inst} = Gtk2::Label->new(N("System installation")), ''); foreach (grep { !eval $o->{steps}{$_}{hidden} } @{$o->{orderedSteps}}) { - if ($_ eq 'setRootPassword') { - push @l, $s, N("System configuration"); - $s = ''; - } - $s .= ($o->{steps}{$_}{done} ? '+' : '-') . ' ' . translate($o->{steps}{$_}{text}) . "\n"; + $_ eq 'setRootPassword' + and gtkpack__($vb, '', '', $steps{conf} = Gtk2::Label->new(N("System configuration")), ''); + $steps{steps}{$_} = { img => gtkcreate_img('steps_off.png'), + txt => Gtk2::Label->new($o->{steps}{$_}{text}) }; + gtkpack__($vb, gtkpack__(Gtk2::HBox->new(0, 7), $steps{steps}{$_}{img}, $steps{steps}{$_}{txt})); + } - gtkadd($w->{window}, gtkpack__(Gtk2::VBox->new(0,15), @l, $s)); + gtkadd($w->{window}, $vb); $w->show; $o->{steps_window} = $w; } +sub update_steps_position { + my ($o) = @_; + return if !$steps{steps}; + my $last_step; + foreach (@{$o->{orderedSteps}}) { + exists $steps{steps}{$_} or next; + if ($o->{steps}{$_}{entered} && !$o->{steps}{$_}{done}) { + $steps{steps}{$_}{img}->set_from_pixbuf($steps{on}); + $last_step and $steps{steps}{$last_step}{img}->set_from_pixbuf($steps{off}); + return; + } + $last_step = $_; + } +} + +sub update_steps_labels { + my ($o) = @_; + return if !$steps{steps}; + $steps{inst}->set_label(N("System installation")); + $steps{conf}->set_label(N("System configuration")); + $steps{steps}{$_}{txt}->set_label(translate($o->{steps}{$_}{text})) foreach keys %{$steps{steps}}; +} + #------------------------------------------------------------------------------ sub create_logo_window { my ($o) = @_; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 28da2e56a..34043ec7d 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -124,6 +124,7 @@ sub new($$) { install_gtk::init_sizes(); install_gtk::install_theme($o); install_gtk::create_logo_window($o); + install_gtk::create_steps_window($o); $ugtk2::force_center = [ $::rootwidth - $::windowwidth, $::logoheight, $::windowwidth, $::windowheight ]; @@ -137,7 +138,7 @@ sub enteringStep { printf "Entering step `%s'\n", $o->{steps}{$step}{text}; $o->SUPER::enteringStep($step); - install_gtk::create_steps_window($o); + install_gtk::update_steps_position($o); # install_gtk::create_help_window($o); #- HACK: without this it doesn't work (reaches step doPartitionDisks then fail) } sub leavingStep { @@ -149,7 +150,7 @@ sub leavingStep { sub charsetChanged { my ($o) = @_; Gtk2->set_locale; - install_gtk::create_steps_window($o); + install_gtk::update_steps_labels($o); } #-###################################################################################### diff --git a/perl-install/pixmaps/steps_off.png b/perl-install/pixmaps/steps_off.png new file mode 100644 index 000000000..66d4235a9 Binary files /dev/null and b/perl-install/pixmaps/steps_off.png differ diff --git a/perl-install/pixmaps/steps_on.png b/perl-install/pixmaps/steps_on.png new file mode 100644 index 000000000..21872e396 Binary files /dev/null and b/perl-install/pixmaps/steps_on.png differ -- cgit v1.2.1