diff options
author | Derek Jennings <derekjenn@gmail.com> | 2013-08-21 13:49:25 +0100 |
---|---|---|
committer | Derek Jennings <derekjenn@gmail.com> | 2013-08-21 13:49:25 +0100 |
commit | 331e242249bec7f80b303c1d37f3c9c8829988f5 (patch) | |
tree | 8e97d565ca341e0edcdff24fe647de9256e04d54 /perl-install/install/steps_gtk.pm | |
parent | 67bc2a78c587ab4659c0f0e936d2eb98573136aa (diff) | |
download | drakx-331e242249bec7f80b303c1d37f3c9c8829988f5.tar drakx-331e242249bec7f80b303c1d37f3c9c8829988f5.tar.gz drakx-331e242249bec7f80b303c1d37f3c9c8829988f5.tar.bz2 drakx-331e242249bec7f80b303c1d37f3c9c8829988f5.tar.xz drakx-331e242249bec7f80b303c1d37f3c9c8829988f5.zip |
stage2: add Feature:Independently_install_desktop_environments
Diffstat (limited to 'perl-install/install/steps_gtk.pm')
-rw-r--r-- | perl-install/install/steps_gtk.pm | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/perl-install/install/steps_gtk.pm b/perl-install/install/steps_gtk.pm index 1e715d0a8..eeaa3b42f 100644 --- a/perl-install/install/steps_gtk.pm +++ b/perl-install/install/steps_gtk.pm @@ -243,24 +243,37 @@ sub setPackages { } sub reallyChooseDesktop { - my ($o, $title, $message, $choices, $choice) = @_; - + my ($o, $title, $message, $choices, $default_choice) = @_; my $w = ugtk2->new($title); + my %choice; + my $n; my %tips = ( KDE => N("Install %s KDE Desktop", N("Mageia")), GNOME => N("Install %s GNOME Desktop", N("Mageia")), + MATE => N("Install %s MATE Desktop", N("Mageia")), + XFCE => N("Install %s XFCE Desktop", N("Mageia")), + LXDE => N("Install %s LXDE Desktop", N("Mageia")), + RAZOR => N("Install %s RazorQT Desktop", N("Mageia")), + E17 => N("Install %s E17 Desktop", N("Mageia")), Custom => N("Custom install"), ); my $prev; + my $default_set = 0; my @l = map { my $val = $_; - $prev = gtknew('RadioButton', child => - gtknew('Label', text => $val->[1]), + my $sensitive = grep { $_->[0] =~ /$val->[0]/ or $val->[0] eq 'Custom' } map { $_->{flags} } grep { $_->{path} eq 'Graphical Environment' } map { @$_ } $o->{compssUsers}; + $default_set++ if $sensitive; + $choice{$val->[0]} = '0'; + $prev = gtknew('CheckButton', + text => $val->[1], tip => $tips{$val->[0]}, - toggled => sub { $choice = $val if $_[0]->get_active }, - active => $choice == $val, - $prev ? (group => $prev->get_group) : ()); + sensitive => $sensitive ? '1' : '0', + toggled => sub { $choice{$val->[0]} = $_[0]->get_active }, + active => $default_set == 1 && $sensitive ? ($choice{$val->[0]} = '1') : '0', + ); + + $prev->signal_connect(key_press_event => sub { my (undef, $event) = @_; if (!$event || ($event->keyval & 0x7f) == 0xd) { @@ -268,11 +281,16 @@ sub reallyChooseDesktop { } }); my $img = gtksignal_connect( - gtkadd(Gtk2::EventBox->new, gtknew('Image', file => "desktop-$val->[0]")), + gtkadd(Gtk2::EventBox->new, gtknew('Image', sensitive => $sensitive ? '1' : '0', file => "desktop-$val->[0]")), 'button-press-event' => sub { my %title = ( KDE => N("KDE Desktop"), GNOME => N("GNOME Desktop"), + MATE => N("MATE Desktop"), + XFCE => N("XFCE Desktop"), + LXDE => N("LXDE Desktop"), + RAZOR => N("RazorQT Desktop"), + E17 => N("E17 Desktop"), Custom => N("Custom Desktop"), ); @@ -295,19 +313,26 @@ sub reallyChooseDesktop { $wp->{real_window}->show_all; $wp->main; }); - gtknew('VBox', border_width => 15, spacing => 10, children_tight => [ + gtknew('VBox', border_width => 5, spacing => 10, children_tight => [ $img, $prev, ]); } @$choices; - +my @l1 = grep { !($n++ % 2) } @l; +my @l2 = grep { !(++$n % 2) } @l; ugtk2::gtkadd($w->{window}, gtknew('VBox', children => [ 0, gtknew('Title2', # workaround infamous 6 years old gnome bug #101968: width => mygtk2::get_label_width(), label => $message . ' ' . N("Click on images in order to see a bigger preview")), - 1, gtknew('HButtonBox', children_loose => \@l), + 1, gtknew('ScrolledWindow', h_policy => 'never', child => + gtknew('VBox', children => [ + 1, gtknew('HButtonBox', spacing => 5, layout => 'edge', children_loose => \@l1), + 1, gtknew('HButtonBox', spacing => 5, layout => 'edge', children_loose => \@l2), + ] + ), + ), 0, $w->create_okcancel(N("Next"), undef, '', [ gtknew('Install_Button', text => N("Help"), clicked => sub { @@ -316,7 +341,7 @@ sub reallyChooseDesktop { ])); $w->main; - $choice; + %choice; } sub reallyChooseGroups { |