summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rwxr-xr-xmdkapplet-upgrade-helper4
-rw-r--r--mdkapplet_gui.pm64
-rw-r--r--mdkonline.pm21
4 files changed, 62 insertions, 30 deletions
diff --git a/NEWS b/NEWS
index b75b4dfd..1d804649 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
-- fix translating utf8 strings in mdkapplet-add-media-helper (#59509)
+- Updated powerpack offering upgrade dialogs
+- Fix translating utf8 strings in mdkapplet-add-media-helper (#59509)
Version 2.77.17 - 26 May 2010, Eugeni Dodonov
- updated translations.
diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper
index dc767f8f..ec3ba43e 100755
--- a/mdkapplet-upgrade-helper
+++ b/mdkapplet-upgrade-helper
@@ -227,8 +227,8 @@ sub try_to_add_powerpack_media {
my $choice; # will be 'powerpack', 'free' or undef
while ($auth_info
or ($choice = mdkapplet_gui::open_ask_powerpack_dialog(
- $product_id->{product},
- $new_distro_version)) eq 'powerpack') {
+ $product_id->{product},
+ $new_distro_version))) {
$auth_info and return $auth_info;
# Get the new authentication info from user...
diff --git a/mdkapplet_gui.pm b/mdkapplet_gui.pm
index 94f4b84d..df9de9b9 100644
--- a/mdkapplet_gui.pm
+++ b/mdkapplet_gui.pm
@@ -274,38 +274,48 @@ sub run_no_rights_dialog {
# Returns a string of user's choice: 'powerpack' or 'free'.
sub open_ask_powerpack_dialog {
- my ($product, $new_version) = @_;
-
- # Setup radio buttons...
-
- my %radio_str = (
- free => N("Upgrade to Mandriva Linux Free %s", $new_version),
- powerpack => N("Upgrade to Mandriva Powerpack %s", $new_version),
- );
- my @radio_order = $product !~ /powerpack|flash/i
- ? ('free', 'powerpack') : ('powerpack', 'free');
- my @radios = gtkradio('', map { $radio_str{$_} } @radio_order);
-
+ my ($current_product, $new_version) = @_;
+
+ # Setup powerpack offering radio buttons...
+
+ my @radio_widgets;
+ my $rbutton;
+ # pwp/flash users will be offered powerpack by default
+ my $want_powerpack = $current_product =~ /powerpack|flash/i;
+ for my $product ($want_powerpack
+ ? ('powerpack', 'free') : ('free', 'powerpack')) {
+ my $info = mdkonline::get_product_info($product);
+ $rbutton
+ = Gtk2::RadioButton->new_with_label($rbutton
+ ? $rbutton->get_group
+ : undef,
+ $info->{name});
+ $rbutton->signal_connect('toggled',
+ sub {
+ my ($button, $is_pwp) = @_;
+ $want_powerpack = $is_pwp
+ unless not $button->get_active();
+ },
+ $product eq 'powerpack');
+ push @radio_widgets, [ $rbutton, $info->{description} ];
+ }
# Setup dialog widgets...
my $title = N("Choose your upgrade version");
my $w = new_portable_dialog($title);
- my @widgets = (
- mdkonline::get_banner($product =~ /powerpack/i
- ? N("Your Powerpack access has ended")
- : $title),
- gtknew('Label_Left',
- text => N("You can now") . "\n",
- @common),
- @radios,
- ugtk2::create_okcancel($w,
- N("Next"),
- N("Cancel, don't upgrade now")),
- );
+ my @widgets
+ = (mdkonline::get_banner($current_product =~ /powerpack/i
+ ? N("Your Powerpack access has ended")
+ : $title),
+ gtknew('Label_Left',
+ text => N("%s is now available, you can upgrade to:",
+ $new_version),
+ @common),
+ gtknew('Table', children => \@radio_widgets, row_spacings => 10),
+ ugtk2::create_okcancel($w, N("Next"), N("Cancel")),
+ );
fill_n_run_portable_dialog($w, \@widgets) or return undef;
- for (my $i = 0; $i < @radios; $i++) {
- return $radio_order[$i] if $radios[$i]->get_active();
- }
+ return $want_powerpack;
}
diff --git a/mdkonline.pm b/mdkonline.pm
index 928e3aca..f98e6cfa 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -57,6 +57,7 @@ our @EXPORT = qw(find_current_distro
$product_id
$root);
our @EXPORT_OK = qw(
+ get_product_info
get_my_mdv_profile
add_medium_powerpack
add_medium_enterprise
@@ -183,6 +184,26 @@ sub translate_product {
$strings{$product} || $product;
}
+# TODO Move all product.id handling to a separate module
+# (MDV::ProductId?)
+sub get_product_info {
+ my ($product) = @_;
+ my %info = (
+ powerpack => {
+ name => N("Mandriva PowerPack"),
+ description => N("The Mandriva Linux distribution with even " .
+ "more softwares and official support."),
+ },
+ free => {
+ name => N("Mandiva Free"),
+ description => N("The 100%% Open Source distribution freely " .
+ "available."),
+ },
+ );
+ $product ||= lc $product_id->{product};
+ return $info{$product};
+}
+
sub get_banner_icon() {
find { -e $_ }
qw(/usr/share/mcc/themes/default/rpmdrake-mdk.png /usr/share/icons/large/mdkonline.png);