summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-17 16:02:49 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-17 16:02:49 +0000
commit8679124a6f88b1ff0c0d69e07633a6d7c7a30e75 (patch)
treef23a1595d1bb374b57367d4ec735a86fba0c1ac4
parentff052d48eac1c77d39a958022876a432f2fdc902 (diff)
downloadmgaonline-8679124a6f88b1ff0c0d69e07633a6d7c7a30e75.tar
mgaonline-8679124a6f88b1ff0c0d69e07633a6d7c7a30e75.tar.gz
mgaonline-8679124a6f88b1ff0c0d69e07633a6d7c7a30e75.tar.bz2
mgaonline-8679124a6f88b1ff0c0d69e07633a6d7c7a30e75.tar.xz
mgaonline-8679124a6f88b1ff0c0d69e07633a6d7c7a30e75.zip
* mdkonline.pm (translate_product): Updated to translate a product
passed as parameter. * mdkapplet_gui.pm: Moved run_no_rights_dialog.
-rwxr-xr-xmdkapplet-add-media-helper32
-rw-r--r--mdkapplet_gui.pm25
-rw-r--r--mdkonline.pm17
3 files changed, 40 insertions, 34 deletions
diff --git a/mdkapplet-add-media-helper b/mdkapplet-add-media-helper
index 61180634..df20d12a 100755
--- a/mdkapplet-add-media-helper
+++ b/mdkapplet-add-media-helper
@@ -130,30 +130,6 @@ sub run_authentication_dialog {
ugtk2::exit(0);
}
-sub run_no_rights_dialog() {
- my $w = mdkapplet_gui::new_portable_dialog($title);
- my @widgets = (
- mdkonline::get_banner($title),
- gtknew('Label_Left',
- text => N("Your Mandriva account does not have %s " .
- "download subscription enabled.",
- mdkonline::translate_product()),
- @mdkapplet_gui::common),
- gtknew('HButtonBox',
- layout => 'start',
- children_tight => [
- interactive::gtk::add_padding(
- mdkapplet_gui::new_link_button(
- $product{$up_product}->{info_url},
- N("More Information")
- )
- )
- ]),
- create_okcancel($w, N("Close"), undef)
- );
- mdkapplet_gui::fill_n_run_portable_dialog($w, \@widgets);
-}
-
sub authenticate_callback {
my ($email, $passwd) = @_;
my $product = $product{$up_product};
@@ -166,7 +142,13 @@ sub authenticate_callback {
goto &run_authentication_dialog;
}
elsif (!$product->{has_rights}->($profile)) {
- run_no_rights_dialog();
+ mdkapplet_gui::run_no_rights_dialog(
+ $title,
+ N("Your Mandriva account does not have %s download " .
+ "subscription enabled.",
+ mdkonline::translate_product($up_product)),
+ $product{$up_product}->{info_url}
+ );
}
else {
add_medium_for_product($product, $email, $passwd);
diff --git a/mdkapplet_gui.pm b/mdkapplet_gui.pm
index 6978bc88..cb0c5afa 100644
--- a/mdkapplet_gui.pm
+++ b/mdkapplet_gui.pm
@@ -41,7 +41,10 @@ our @EXPORT = qw(
setVar
);
-our @EXPORT_OK = qw(run_ask_credentials_dialog);
+our @EXPORT_OK = qw(
+ run_ask_credentials_dialog
+ run_no_rights_dialog
+);
use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
use ugtk2 qw(:all);
@@ -209,3 +212,23 @@ sub run_ask_credentials_dialog {
}
}
}
+
+sub run_no_rights_dialog {
+ my ($title, $info, $info_url) = @_;
+ my $w = new_portable_dialog($title);
+ my @widgets = (
+ mdkonline::get_banner($title),
+ gtknew('Label_Left',
+ text => $info,
+ @mdkapplet_gui::common),
+ gtknew('HButtonBox',
+ layout => 'start',
+ children_tight => [
+ interactive::gtk::add_padding(
+ new_link_button($info_url, N("More Information"))
+ )
+ ]),
+ create_okcancel($w, N("Close"), undef)
+ );
+ fill_n_run_portable_dialog($w, \@widgets);
+}
diff --git a/mdkonline.pm b/mdkonline.pm
index d6964d98..86f9e19d 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -165,16 +165,17 @@ sub fork_exec {
run_program::raw({ detach => 1 }, @_);
}
-sub translate_product() {
+sub translate_product {
+ my ($product) = @_;
my %strings = (
- Flash => N("Mandriva Flash"),
- Free => N("Mandriva Free"),
- Mini => N("Mandriva Mini"),
- One => N("Mandriva One"),
- PowerPack => N("Mandriva PowerPack"),
- Server => N("Mandriva Enterprise Server"),
+ flash => N("Mandriva Flash"),
+ free => N("Mandriva Free"),
+ mini => N("Mandriva Mini"),
+ one => N("Mandriva One"),
+ powerPack => N("Mandriva PowerPack"),
+ server => N("Mandriva Enterprise Server"),
);
- my $product = $product_id->{product};
+ $product or $product = lc $product_id->{product};
$strings{$product} || $product;
}