summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-11-01 00:47:46 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-11-24 23:28:13 +0100
commit928857551788a8c9ea698cb09c3d50010e8a5c02 (patch)
tree9412d054fcc5e0eaa81398ae2f9fc3a11e0bde3f /perl-install/standalone
parent7452efe684fbb35d5d3095c9c2b384fbaca9944f (diff)
downloaddrakx-928857551788a8c9ea698cb09c3d50010e8a5c02.tar
drakx-928857551788a8c9ea698cb09c3d50010e8a5c02.tar.gz
drakx-928857551788a8c9ea698cb09c3d50010e8a5c02.tar.bz2
drakx-928857551788a8c9ea698cb09c3d50010e8a5c02.tar.xz
drakx-928857551788a8c9ea698cb09c3d50010e8a5c02.zip
split menu closures as real functions
(needed for next commit)
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/harddrake295
1 files changed, 55 insertions, 40 deletions
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 03c86c759..ac10bc3a1 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -196,52 +196,18 @@ my @menu_items =
(
[ N("/_File"), undef, undef, undef, '<Branch>' ],
[ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<Item>' ],
- [ join('', @{$menu_options{MODEMS_DETECTION}}), undef,
- sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->get_active }, undef, '<CheckItem>' ],
- [ join('', @{$menu_options{PARALLEL_ZIP_DETECTION}}), undef,
- sub { $options{PARALLEL_ZIP_DETECTION} = $check_boxes{PARALLEL_ZIP_DETECTION}->get_active }, undef, '<CheckItem>' ],
+ [ join('', @{$menu_options{MODEMS_DETECTION}}), undef, \&handle_modem_option, undef, '<CheckItem>' ],
+ [ join('', @{$menu_options{PARALLEL_ZIP_DETECTION}}), undef, \&handle_zip_option, undef, '<CheckItem>' ],
[ $menus{help}, undef, undef, undef, '<Branch>' ],
if_(-x "/usr/sbin/drakhelp_inst",
- [ $menus{help} . N("/_Help"), undef, sub { run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'harddrake') }, undef, '<Item>' ],
+ [ $menus{help} . N("/_Help"), undef, \&run_help, undef, '<Item>' ],
),
- [ $menus{help} . N("/_Fields description"), undef, sub {
- if ($current_device) {
- create_dialog(N("Harddrake help"),
- '<big><b>' . N("Description of the fields:\n\n") . '</b></big>'
- . join("\n\n", map {
- my $info = lookup_field($_);
- if_($info->[0], formatAlaTeX(qq(<span foreground="royalblue3">$info->[0]:</span> $info->[1])));
- } sort keys %$current_device),
- { use_markup => 1, transient => $w->{real_window}, height => 400, scroll => 1 });
-
- } else {
- create_dialog(N("Select a device!"), N("Once you've selected a device, you'll be able to see the device information in fields displayed on the right frame (\"Information\")"), { transient => $w->{real_window} });
- }
- },
- undef, '<Item>'
+ [ $menus{help} . N("/_Fields description"), undef, \&fields_help, undef, '<Item>'
],
if_(!-e "/etc/sysconfig/oem",
- [ $menus{help} . N("/_Report Bug"), undef, sub { run_program::raw({ detach => 1 }, 'drakbug', '--report', 'harddrake') }, undef, '<Item>' ],
+ [ $menus{help} . N("/_Report Bug"), undef, \&run_drakbug, undef, '<Item>' ],
),
- [ $menus{help} . N("/_About..."), undef, sub {
- my $license = formatAlaTeX(translate($::license));
- $license =~ s/\n/\n\n/sg; # nicer formatting
- my $w = gtknew('AboutDialog', name => N("Harddrake"),
- version => mageia_release_info()->{version},
- copyright => N("Copyright (C) %s by %s", '2001-2008', 'Mandriva') . "\n" . N("Copyright (C) %s by %s", '2011', N("Mageia")),
- license => $license, wrap_license => 1,
- comments => N("This is HardDrake, a %s hardware configuration tool.", $distro_name),
- website => 'http://www.mageia.org',
- website_label => N("Mageia"),
- authors => 'Thierry Vignaud <thierry.vignaud.com>',
- translator_credits =>
- #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
- N("_: Translator(s) name(s) & email(s)\n"),
- transient_for => $::main_window, modal => 1, position_policy => 'center-on-parent',
- );
- $w->show_all;
- $w->run;
- }, undef, '<Item>'
+ [ $menus{help} . N("/_About..."), undef, \&about, undef, '<Item>'
]
);
@@ -539,6 +505,39 @@ fill_default_text($text);
$w->main;
+sub about() {
+ my $license = formatAlaTeX(translate($::license));
+ $license =~ s/\n/\n\n/sg; # nicer formatting
+ my $w = gtknew('AboutDialog', name => N("Harddrake"),
+ version => mageia_release_info()->{version},
+ copyright => N("Copyright (C) %s by %s", '2001-2008', 'Mandriva') . "\n" . N("Copyright (C) %s by %s", '2011', N("Mageia")),
+ license => $license, wrap_license => 1,
+ comments => N("This is HardDrake, a %s hardware configuration tool.", $distro_name),
+ website => 'http://www.mageia.org',
+ website_label => N("Mageia"),
+ authors => 'Thierry Vignaud <thierry.vignaud.com>',
+ translator_credits =>
+ #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
+ N("_: Translator(s) name(s) & email(s)\n"),
+ transient_for => $::main_window, modal => 1, position_policy => 'center-on-parent',
+ );
+ $w->show_all;
+ $w->run;
+}
+
+sub fields_help() {
+ if ($current_device) {
+ create_dialog(N("Harddrake help"),
+ '<big><b>' . N("Description of the fields:\n\n") . '</b></big>'
+ . join("\n\n", map {
+ my $info = lookup_field($_);
+ if_($info->[0], formatAlaTeX(qq(<span foreground="royalblue3">$info->[0]:</span> $info->[1])));
+ } sort keys %$current_device),
+ { use_markup => 1, transient => $w->{real_window}, height => 400, scroll => 1 });
+ } else {
+ create_dialog(N("Select a device!"), N("Once you've selected a device, you'll be able to see the device information in fields displayed on the right frame (\"Information\")"), { transient => $w->{real_window} });
+ }
+}
sub quit_global() {
kill(15, $pid) if $pid;
@@ -546,6 +545,22 @@ sub quit_global() {
ugtk3->exit(0);
}
+sub run_drakbug() {
+ run_program::raw({ detach => 1 }, 'drakbug', '--report', 'harddrake');
+}
+
+sub run_help() {
+ run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'harddrake');
+}
+
+sub handle_modem_option() {
+ $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->get_active;
+}
+
+sub handle_zip_option() {
+ $options{PARALLEL_ZIP_DETECTION} = $check_boxes{PARALLEL_ZIP_DETECTION}->get_active;
+}
+
sub show_hide {
my ($bool, $button) = @_;
if ($bool) { $button->show } else { $button->hide }