summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-16 20:22:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-16 20:22:24 +0000
commit8c847f02b2ff79db0f8ecc0a3041d964f0658c37 (patch)
tree49faccdef1a9d3b80b347f43f4f2154ba74dcf92 /perl-install
parent65476d975761958788bef066c0640f56cc213b64 (diff)
downloaddrakx-backup-do-not-use-8c847f02b2ff79db0f8ecc0a3041d964f0658c37.tar
drakx-backup-do-not-use-8c847f02b2ff79db0f8ecc0a3041d964f0658c37.tar.gz
drakx-backup-do-not-use-8c847f02b2ff79db0f8ecc0a3041d964f0658c37.tar.bz2
drakx-backup-do-not-use-8c847f02b2ff79db0f8ecc0a3041d964f0658c37.tar.xz
drakx-backup-do-not-use-8c847f02b2ff79db0f8ecc0a3041d964f0658c37.zip
- factorize "Help"-button handling
- fix interactive_help_get_id (happily, it was no pb :)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm7
-rw-r--r--perl-install/diskdrake/hd_gtk.pm2
-rw-r--r--perl-install/install_interactive.pm2
-rw-r--r--perl-install/install_steps_gtk.pm2
-rw-r--r--perl-install/interactive.pm24
5 files changed, 25 insertions, 12 deletions
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
index 0efdc6671..b84b5731e 100644
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ b/perl-install/Xconfig/resolution_and_depth.pm
@@ -253,6 +253,7 @@ sub choose_gtk {
};
$set_chosen_x_res->($chosen_x_res, $chosen_y_res);
+ my $help_sub = $in->interactive_help_sub_display_id('configureX_resolution');
gtkadd($W->{window},
gtkpack_($W->create_box_with_title(N("Choose the resolution and the color depth"),
if_($card->{BoardName}, "(" . N("Graphics card: %s", $card->{BoardName}) . ")"),
@@ -268,11 +269,7 @@ sub choose_gtk {
),
),
),
- 0, gtkadd($W->create_okcancel(N("Ok"), N("Cancel"), '',
- [ N("Help"), sub {
- my $message = $in->interactive_help_get_id('configureX_resolution') or return;
- $in->ask_warn(N("Help"), $message);
- }, 1 ])),
+ 0, gtkadd($W->create_okcancel(N("Ok"), N("Cancel"), '', if_($help_sub, [ N("Help"), $help_sub, 1 ]))),
));
$depth_combo->disable_activate;
$depth_combo->set_use_arrows_always(1);
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index 0ee38fc49..804c57f8c 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -154,7 +154,7 @@ sub general_action_box {
my ($box, $nowizard, $interactive_help) = @_;
$_->widget->destroy foreach $box->children;
- gtkadd($box, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { $in->ask_warn(N("Help"), $interactive_help->()) })) if $interactive_help;
+ gtkadd($box, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => $interactive_help->())) if $interactive_help;
my @actions = (if_($::isInstall && !$nowizard, N_("Wizard")),
diskdrake::interactive::general_possible_actions($in, $all_hds),
diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm
index f543b502d..7ec90b709 100644
--- a/perl-install/install_interactive.pm
+++ b/perl-install/install_interactive.pm
@@ -49,7 +49,7 @@ sub partition_with_diskdrake {
require diskdrake::interactive;
{
local $::expert = $::expert;
- diskdrake::interactive::main($o, $all_hds, $nowizard, $do_force_reload, sub { $o->interactive_help_get_id('partition_with_diskdrake') });
+ diskdrake::interactive::main($o, $all_hds, $nowizard, $do_force_reload, $o->interactive_help_sub_display_id('partition_with_diskdrake'));
}
if (delete $o->{wizard}) {
partitionWizard($o, 'nodiskdrake') or redo;
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index bd90b37a5..8aee1b171 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -260,7 +260,7 @@ sub reallyChooseGroups {
)),
1, '',
0, gtkadd(Gtk2::HBox->new(0, 0),
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { $o->ask_warn(N("Help"), $o->interactive_help_get_id('choosePackages')) }),
+ gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => $o->interactive_help_sub_display_id('choosePackages')),
$w_size,
if_($individual, do {
my $check = Gtk2::CheckButton->new(N("Individual package selection"));
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 2af88092a..d9c4b2f3b 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -364,7 +364,7 @@ sub ask_from_normalize {
($common->{title} = $0) =~ s|.*/||;
}
$common->{interactive_help} ||= $o->{interactive_help};
- $common->{interactive_help} ||= $common->{interactive_help_id} && sub { $o->interactive_help_get_id($common->{interactive_help_id}) };
+ $common->{interactive_help} ||= $common->{interactive_help_id} && $o->interactive_help_sub_get_id($common->{interactive_help_id});
$common->{advanced_label} ||= N("Advanced");
$common->{advanced_label_close} ||= N("Basic");
$common->{$_} = [ deref($common->{$_}) ] foreach qw(messages advanced_messages);
@@ -394,7 +394,7 @@ sub ask_from_real {
sub ask_browse_tree_info {
my ($o, $title, $message, $common) = @_;
- $common->{interactive_help} ||= $common->{interactive_help_id} && sub { $o->interactive_help_get_id($common->{interactive_help_id}) };
+ $common->{interactive_help} ||= $common->{interactive_help_id} && $o->interactive_help_sub_get_id($common->{interactive_help_id});
add2hash_($common, { ok => $::isWizard ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok"),
cancel => $::isWizard ? N("<- Previous") : N("Cancel") });
add2hash_($common, { title => $title, message => $message });
@@ -470,11 +470,27 @@ sub helper_separator_tree_to_tree {
}
+sub interactive_help_has_id {
+ my ($_o, $id) = @_;
+ exists $help::steps{$id};
+}
+
sub interactive_help_get_id {
- my @l = map {
+ my ($_o, @l) = @_;
+ @l = map {
join("\n\n", map { s/\n/ /mg; $_ } split("\n\n", translate($help::steps{$_})))
- } grep { exists $help::steps{$_} } @_;
+ } grep { exists $help::steps{$_} } @l;
join("\n\n\n", @l);
}
+sub interactive_help_sub_get_id {
+ my ($o, $id) = @_;
+ $o->interactive_help_has_id($id) && sub { $o->interactive_help_get_id($id) };
+}
+
+sub interactive_help_sub_display_id {
+ my ($o, $id) = @_;
+ $o->interactive_help_has_id($id) && sub { $o->ask_warn(N("Help"), $o->interactive_help_get_id($id)) };
+}
+
1;