diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-04 14:25:49 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-04 14:25:49 +0000 |
commit | 51d6259470fb1d02503a2c0de2c806026d87c396 (patch) | |
tree | 5c7671b3a9121c099648c82007f8615aaaa022c8 | |
parent | 823defcb7c1e66a5aafb9d94ca9c7ecef238f12c (diff) | |
download | drakx-backup-do-not-use-51d6259470fb1d02503a2c0de2c806026d87c396.tar drakx-backup-do-not-use-51d6259470fb1d02503a2c0de2c806026d87c396.tar.gz drakx-backup-do-not-use-51d6259470fb1d02503a2c0de2c806026d87c396.tar.bz2 drakx-backup-do-not-use-51d6259470fb1d02503a2c0de2c806026d87c396.tar.xz drakx-backup-do-not-use-51d6259470fb1d02503a2c0de2c806026d87c396.zip |
use if_() where possible (as reported by perl_checker)
-rw-r--r-- | perl-install/bootloader.pm | 4 | ||||
-rw-r--r-- | perl-install/crypto.pm | 4 | ||||
-rw-r--r-- | perl-install/fs.pm | 2 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 4 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 2 | ||||
-rw-r--r-- | perl-install/my_gtk.pm | 2 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 12 | ||||
-rw-r--r-- | perl-install/network/network.pm | 2 | ||||
-rw-r--r-- | perl-install/printer/main.pm | 13 | ||||
-rw-r--r-- | perl-install/printer/printerdrake.pm | 112 | ||||
-rw-r--r-- | perl-install/ugtk.pm | 4 | ||||
-rw-r--r-- | perl-install/ugtk2.pm | 4 |
12 files changed, 72 insertions, 93 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 63751aee0..952c54d4b 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -738,8 +738,8 @@ sub install_silo { } log::l("Installing boot loader..."); $::testing and return; - run_program::rooted($::prefix, "silo", "2>", "/tmp/.error", $silo->{use_partition} ? "-t" : ()) or - run_program::rooted_or_die($::prefix, "silo", "2>", "/tmp/.error", "-p", "2", $silo->{use_partition} ? "-t" : ()); + run_program::rooted($::prefix, "silo", "2>", "/tmp/.error", if_($silo->{use_partition}, "-t")) or + run_program::rooted_or_die($::prefix, "silo", "2>", "/tmp/.error", "-p", "2", if_($silo->{use_partition}, "-t")); unlink "$::prefix/tmp/.error"; #- try writing in the prom. diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm index c44723e14..36912dc69 100644 --- a/perl-install/crypto.pm +++ b/perl-install/crypto.pm @@ -114,8 +114,8 @@ sub getFile { my $dir = dir($host) . ($file =~ /\.rpm$/ && "/RPMS"); log::l("getting crypto file $file on directory $dir with login $mirrors{$host}[2]"); my ($ftp, $retr) = ftp::new($host, $dir, - $mirrors{$host}[2] ? $mirrors{$host}[2] : (), - $mirrors{$host}[3] ? $mirrors{$host}[3] : () + if_($mirrors{$host}[2], $mirrors{$host}[2]), + if_($mirrors{$host}[3], $mirrors{$host}[3]) ); $$retr->close if $$retr; $$retr = $ftp->retr($file) or ftp::rewindGetFile(); diff --git a/perl-install/fs.pm b/perl-install/fs.pm index cd78bbe69..7ad3d0949 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -579,7 +579,7 @@ sub real_format_part { my $dev = $part->{real_device} || $part->{device}; - my @options = $part->{toFormatCheck} ? "-c" : (); + my @options = if_($part->{toFormatCheck}, "-c"); log::l("formatting device $dev (type ", type2name($part->{type}), ")"); if (isExt2($part)) { diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 4a46dd95c..731824dd5 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -59,9 +59,9 @@ my @partitions_signatures = ( [ 0x82, 4086, "SWAPSPACE2" ], [ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ], [ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ], -arch() !~ /^sparc/ ? ( +if_(arch() !~ /^sparc/, [ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ], -) : (), +), ); sub typeOfPart { diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 026ee1742..3709c4582 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -44,7 +44,7 @@ sub new($$) { unless (-d "/var/log") { mkdir("/var/log") } local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 }; unless (fork()) { - exec $_[0], (arch() =~ /^sparc/ || arch() eq "ppc" ? () : "-kb"), 'tty7', "-dpms", "-s", "240", + exec $_[0], if_(arch() !~ /^sparc/ && arch() ne "ppc", "-kb"), 'tty7', "-dpms", "-s", "240", ($_[0] =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : "-mach64" : ()), ($_[0] =~ /Xsun/ || $_[0] =~ /Xpmac/ ? ("-fp", "/usr/X11R6/lib/X11/fonts:unscaled") : ("-allowMouseOpenFail", "-xf86config", $f)) or exit 1; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 91b6310d6..12fba09be 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -161,7 +161,7 @@ sub create_okcancel { my $b1 = gtksignal_connect($w->{ok} = new Gtk::Button($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk->main_quit }); my $b2 = $cancel && gtksignal_connect($w->{cancel} = new Gtk::Button($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk->main_quit }); $::isWizard and gtksignal_connect($w->{wizcancel} = new Gtk::Button(N("Cancel")), clicked => sub { die 'wizcancel' }); - my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, $::Wizard_no_previous ? () : $b2, $b1) : ($b1, $b2); + my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, if_(!$::Wizard_no_previous, $b2, $b1)) : ($b1, $b2); push @l, map { gtksignal_connect(new Gtk::Button($_->[0]), clicked => $_->[1]) } @other; $_->can_default($::isWizard) foreach @l; diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 09cbba81c..6409ba791 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -33,14 +33,10 @@ sub intro { $connected = 0; } my @l = ( - !$connected && -e $connect_file ? { description => N("Connect"), - c => 1 } : (), - $connected && -e $disconnect_file ? { description => N("Disconnect"), - c => 2 } : (), - { description => N("Configure the connection"), - c => 3 }, - { description => N("Cancel"), - c => 4 }, + if_(!$connected && -e $connect_file, { description => N("Connect"), c => 1 }), + if_($connected && -e $disconnect_file, { description => N("Disconnect"), c => 2 }), + { description => N("Configure the connection"), c => 3 }, + { description => N("Cancel"), c => 4 }, ); my $e = $in->ask_from_listf(N("Internet connection & configuration"), translate($text), diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index a7994a18a..9043e9699 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -133,7 +133,7 @@ sub write_interface_conf { ONBOOT => bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::probeall())), if_($::o->{miscellaneous}{track_network_id}, HWADDR => $hwaddr) }); - setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), $intf->{wireless_eth} ? qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV) : ()); + setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), if_($intf->{wireless_eth}, qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV))); } sub add2hosts { diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 757cf35f9..d1b3764d6 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -59,15 +59,10 @@ sub spooler { sub printer_type($) { my ($printer) = @_; for ($printer->{SPOOLER}) { - /cups/ && return @printer_type_inv{qw(LOCAL), - qw(LPD SOCKET SMB), - $::expert ? qw(URI) : ()}; - /lpd/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), - $::expert ? qw(POSTPIPE URI) : ()}; - /lprng/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), - $::expert ? qw(POSTPIPE URI) : ()}; - /pdq/ && return @printer_type_inv{qw(LOCAL LPD SOCKET), - $::expert ? qw(URI) : ()}; + /cups/ && return @printer_type_inv{qw(LOCAL), qw(LPD SOCKET SMB), if_($::expert, qw(URI))}; + /lpd/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), if_($::expert, qw(POSTPIPE URI))}; + /lprng/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), if_($::expert, qw(POSTPIPE URI))}; + /pdq/ && return @printer_type_inv{qw(LOCAL LPD SOCKET), if_($::expert, qw(URI))}; } } diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index e52e6fd34..9df93a5d3 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -27,9 +27,9 @@ sub choose_printer_type { $in->ask_from_( { title => N("Select Printer Connection"), messages => N("How is the printer connected?") . - ($printer->{SPOOLER} eq "cups" ? + if_($printer->{SPOOLER} eq "cups", N(" -Printers on remote CUPS servers you do not have to configure here; these printers will be automatically detected.") : ()) +Printers on remote CUPS servers you do not have to configure here; these printers will be automatically detected.")), }, [ { val => \$printer->{str_type}, @@ -83,8 +83,8 @@ sub config_cups { { title => ($::expert ? N("CUPS configuration") : N("Specify CUPS server")), messages => N("To get access to printers on remote CUPS servers in your local network you do not have to configure anything; the CUPS servers inform your machine automatically about their printers. All printers currently known to your machine are listed in the \"Remote printers\" section in the main window of Printerdrake. When your CUPS server is not in your local network, you have to enter the CUPS server IP address and optionally the port number to get the printer information from the server, otherwise leave these fields blank.") . - ($::expert ? "\n" . N(" -Normally, CUPS is automatically configured according to your network environment, so that you can access the printers on the CUPS servers in your local network. If this does not work correctly, turn off \"Automatic CUPS configuration\" and edit your file /etc/cups/cupsd.conf manually. Do not forget to restart CUPS afterwards (command: \"service cups restart\").") : ()), + if_($::expert, "\n" . N(" +Normally, CUPS is automatically configured according to your network environment, so that you can access the printers on the CUPS servers in your local network. If this does not work correctly, turn off \"Automatic CUPS configuration\" and edit your file /etc/cups/cupsd.conf manually. Do not forget to restart CUPS afterwards (command: \"service cups restart\").")), callbacks => { complete => sub { if ($server && !network::is_ip($server)) { $in->ask_warn('', N("The IP address should look like 192.168.1.20")); @@ -100,9 +100,9 @@ Normally, CUPS is automatically configured according to your network environment [ { label => N("CUPS server IP"), val => \$server }, { label => N("Port"), val => \$port }, - ($::expert ? + if_($::expert, { text => N("Automatic CUPS configuration"), type => 'bool', - val => \$autoconf } : ()), + val => \$autoconf }), ] )) { # We have clicked "OK" @@ -308,12 +308,12 @@ If you have printer(s) connected to this machine, Please plug it/them in on this [ { text => N("Auto-detect printers connected to this machine"), type => 'bool', val => \$autodetectlocal }, - ($havelocalnetworks ? - ({ text => N("Auto-detect printers connected directly to the local network"), type => 'bool', - val => \$autodetectnetwork }, - ($printer->{SPOOLER} ne "pdq" ? - { text => N("Auto-detect printers connected to machines running Microsoft Windows"), type => 'bool', - val => \$autodetectsmb } : ())) : ()) + if_($havelocalnetworks, + { text => N("Auto-detect printers connected directly to the local network"), type => 'bool', + val => \$autodetectnetwork }, + if_($printer->{SPOOLER} ne "pdq", + { text => N("Auto-detect printers connected to machines running Microsoft Windows"), type => 'bool', + val => \$autodetectsmb })), ]); $printer->{AUTODETECTLOCAL} = $autodetectlocal ? 1 : undef; $printer->{AUTODETECTNETWORK} = $autodetectnetwork ? 1 : undef; @@ -559,9 +559,8 @@ sub setup_local_autoscan { ($::expert ? N("Please choose the port where your printer is connected to or enter a device name/file name in the input line") : N("Please choose the port where your printer is connected to."))) . - ($::expert ? - N(" (Parallel Ports: /dev/lp0, /dev/lp1, ..., equivalent to LPT1:, LPT2:, ..., 1st USB printer: /dev/usb/lp0, 2nd USB printer: /dev/usb/lp1, ...).") : - ())), + if_($::expert, + N(" (Parallel Ports: /dev/lp0, /dev/lp1, ..., equivalent to LPT1:, LPT2:, ..., 1st USB printer: /dev/usb/lp0, 2nd USB printer: /dev/usb/lp1, ...)."))), callbacks => { complete => sub { unless ($menuchoice ne "") { @@ -579,14 +578,13 @@ sub setup_local_autoscan { } } }, [ - ($::expert ? - { val => \$device } : ()), + if_($::expert, { val => \$device }), { val => \$menuchoice, list => \@menuentrieslist, not_edit => !$::expert, format => \&translate, sort => 0, allow_empty_list => 1, type => 'list' }, - ((!$::expert && $do_auto_detect && $printer->{NEW}) ? + if_(!$::expert && $do_auto_detect && $printer->{NEW}, { text => N("Manual configuration"), type => 'bool', - val => \$manualconf } : ()), + val => \$manualconf }), ] )) { return 0; @@ -806,12 +804,11 @@ sub setup_smb { { label => N("User name"), val => \$smbuser }, { label => N("Password"), val => \$smbpassword, hidden => 1 }, { label => N("Workgroup"), val => \$workgroup }, - ($autodetect ? + if_($autodetect, { label => N("Auto-detected"), val => \$menuchoice, list => \@menuentrieslist, not_edit => 1, format => \&translate, sort => 0, - allow_empty_list => 1, type => 'combo' } : - ()) ], + allow_empty_list => 1, type => 'combo' }) ], complete => sub { if (!network::is_ip($smbserverip) && $smbserverip ne "") { $in->ask_warn('', N("IP address should be in format 1.2.3.4")); @@ -1064,11 +1061,10 @@ sub setup_socket { { label => ($autodetect ? "" : N("Printer host name or IP")), val => \$remotehost }, { label => ($autodetect ? "" : N("Port")), val => \$remoteport }, - ($autodetect ? + if_($autodetect, { val => \$menuchoice, list => \@menuentrieslist, not_edit => 0, format => \&translate, sort => 0, - allow_empty_list => 1, type => 'list' } : - ()) + allow_empty_list => 1, type => 'list' }) ] ); @@ -1277,9 +1273,8 @@ sub setup_common { /usr/bin/xsane /etc/sane.d/dll.conf /usr/lib/libsane-hpoj.so.1), - (files_exist('/usr/bin/gimp') ? - '/usr/bin/xsane-gimp' : - ()))) { + if_(files_exist('/usr/bin/gimp'), + '/usr/bin/xsane-gimp'))) { my $w = $in->wait_message( N("Printerdrake"), N("Installing SANE packages...")); @@ -2120,18 +2115,18 @@ Note: the photo test page can take a rather long time to get printed and on lase [ { text => N("Standard test page"), type => 'bool', val => \$standard }, - ($::expert ? + if_($::expert, { text => N("Alternative test page (Letter)"), type => 'bool', - val => \$altletter } : ()), - ($::expert ? + val => \$altletter }), + if_($::expert, { text => N("Alternative test page (A4)"), type => 'bool', - val => \$alta4 } : ()), + val => \$alta4 }), { text => N("Photo test page"), type => 'bool', val => \$photo }, #{ text => N("Plain text test page"), type => 'bool', # val => \$ascii } - ($::isWizard ? + if_($::isWizard, { text => N("Do not print any test page"), type => 'bool', - val => \$res2 } : ()) + val => \$res2 }) ]); $res2 = 1 if !($standard || $altletter || $alta4 || $photo || $ascii); if ($res1 && !$res2) { @@ -2379,8 +2374,8 @@ Not all queues can be transferred due to the following reasons: N("LPD and LPRng do not support IPP printers. "))) . N("In addition, queues not created with this program or \"foomatic-configure\" cannot be transferred.") . -($oldspooler eq "cups" ? N(" -Also printers configured with the PPD files provided by their manufacturers or with native CUPS drivers cannot be transferred.") : ()) . N(" +if_($oldspooler eq "cups", N(" +Also printers configured with the PPD files provided by their manufacturers or with native CUPS drivers cannot be transferred.")) . N(" Mark the printers which you want to transfer and click \"Transfer\"."), cancel => N("Do not transfer printers"), @@ -2779,8 +2774,7 @@ sub main { /usr/bin/nmap /usr/bin/scli ), - (files_exist("/usr/bin/gimp") ? - "/usr/lib/gimp/1.2/plug-ins/print" : ()) + if_(files_exist("/usr/bin/gimp"), "/usr/lib/gimp/1.2/plug-ins/print") )) { $in->do_pkgs->install('foomatic', 'printer-utils', 'printer-testpages', 'nmap', 'scli', if_($in->do_pkgs->is_installed('gimp'), 'gimpprint')); @@ -2926,7 +2920,7 @@ sub main { ok => (""), }, # List the queues - [ ($noprinters ? () : + [ if_(!$noprinters, { val => \$menuchoice, format => \&translate, sort => 0, separator => "!",tree_expanded => 1, quit_if_double_click => 1,allow_empty_list =>1, @@ -3125,8 +3119,7 @@ sub main { setasdefault($printer, $in); $cursorpos = $printer->{configured}{$printer->{QUEUE}}{queuedata}{menuentry} . - ($printer->{QUEUE} eq $printer->{DEFAULT} ? - N(" (Default)") : ()); + ($printer->{QUEUE} eq $printer->{DEFAULT} ? N(" (Default)") : ''); my $testpages = print_testpages($printer, $in, $printer->{TYPE} !~ /LOCAL/ && $upNetwork); if ($testpages == 1) { # User was content with test pages @@ -3177,8 +3170,7 @@ sub main { setasdefault($printer, $in); $cursorpos = $printer->{configured}{$printer->{QUEUE}}{queuedata}{menuentry} . - ($printer->{QUEUE} eq $printer->{DEFAULT} ? - N(" (Default)") : ()); + ($printer->{QUEUE} eq $printer->{DEFAULT} ? N(" (Default)") : ''); my $testpages = print_testpages($printer, $in, $printer->{TYPE} !~ /LOCAL/ && $upNetwork); if ($testpages == 1) { # User was content with test pages @@ -3204,13 +3196,13 @@ sub main { $printer->{configured}{$queue}{queuedata}{menuentry} =~ /!([^!]+)$/; $infoline = $1 . - ($queue eq $printer->{DEFAULT} ? N(" (Default)") : ()) . + ($queue eq $printer->{DEFAULT} ? N(" (Default)") : '') . ($printer->{configured}{$queue}{queuedata}{desc} ? - ", Descr.: $printer->{configured}{$queue}{queuedata}{desc}" : ()) . + ", Descr.: $printer->{configured}{$queue}{queuedata}{desc}" : '') . ($printer->{configured}{$queue}{queuedata}{loc} ? - ", Loc.: $printer->{configured}{$queue}{queuedata}{loc}" : ()) . + ", Loc.: $printer->{configured}{$queue}{queuedata}{loc}" : '') . ($::expert ? - ", Driver: $printer->{configured}{$queue}{queuedata}{driver}" : ()); + ", Driver: $printer->{configured}{$queue}{queuedata}{driver}" : ''); } else { # The parameters of a remote CUPS queue cannot be changed, # so we can simply take the menu entry. @@ -3234,22 +3226,18 @@ What do you want to modify on this printer?", ($::expert ? N("Printer manufacturer, model, driver") : N("Printer manufacturer, model")), - ($printer->{configured}{$queue}{queuedata}{make} ne - "" && - ($printer->{configured}{$queue}{queuedata}{model} ne - N("Unknown model") && - $printer->{configured}{$queue}{queuedata}{model} ne - N("Raw printer")) ? - N("Printer options") : ())) : ()), - ($queue ne $printer->{DEFAULT} ? - N("Set this printer as the default") : ()), - ($printer->{configured}{$queue} ? () : - (N("Add this printer to Star Office/OpenOffice.org/GIMP"), - N("Remove this printer from Star Office/OpenOffice.org/GIMP"))), + if_($printer->{configured}{$queue}{queuedata}{make} ne "" && + $printer->{configured}{$queue}{queuedata}{model} ne N("Unknown model") && + $printer->{configured}{$queue}{queuedata}{model} ne N("Raw printer"), + N("Printer options"))) : ()), + if_($queue ne $printer->{DEFAULT}, + N("Set this printer as the default")), + if_(!$printer->{configured}{$queue}, + N("Add this printer to Star Office/OpenOffice.org/GIMP"), + N("Remove this printer from Star Office/OpenOffice.org/GIMP")), N("Print test pages"), N("Know how to use this printer"), - ($printer->{configured}{$queue} ? - N("Remove printer") : ()) ] } ])) { + if_($printer->{configured}{$queue}, N("Remove printer")) ] } ])) { # Stay in the queue edit window until the user clicks "Close" # or deletes the queue $editqueue = 1; @@ -3363,7 +3351,7 @@ What do you want to modify on this printer?", if ($printer->{configured}{$printer->{QUEUE}}) { $cursorpos = $printer->{configured}{$printer->{QUEUE}}{queuedata}{menuentry} . - ($printer->{QUEUE} eq $printer->{DEFAULT} ? N(" (Default)") : ()); + if_($printer->{QUEUE} eq $printer->{DEFAULT}, N(" (Default)")); } else { my $s1 = N(" (Default)"); my $s2 = $s1; diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm index 3ec92e77f..4e7045835 100644 --- a/perl-install/ugtk.pm +++ b/perl-install/ugtk.pm @@ -112,7 +112,7 @@ sub gtkbuttonset { sub create_pixbutton { my ($label, $pix, $reverse_order) = @_; - gtkadd(new Gtk::Button(), gtkpack_(new Gtk::HBox(0, 3), 1, "", $reverse_order ? (0, $label, $pix ? (0, $pix) : ()) : ($pix ? (0, $pix) : (), 0, $label), 1, "")); + gtkadd(new Gtk::Button(), gtkpack_(new Gtk::HBox(0, 3), 1, "", $reverse_order ? (0, $label, if_($pix, 0, $pix)) : (if_($pix, 0, $pix), 0, $label), 1, "")); } sub gtkentry { @@ -137,7 +137,7 @@ sub gtkcolor { sub gtkradio { my $def = shift; my $radio; - map { $radio = new Gtk::RadioButton($_, $radio ? $radio : ()); + map { $radio = new Gtk::RadioButton($_, if_($radio, $radio)); $radio->set_active($_ eq $def); $radio } @_; } diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 00b44ab1c..0e70d8136 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -248,7 +248,7 @@ sub gtktreeview_children { sub create_pixbutton { my ($label, $pix, $reverse_order) = @_; - my @label_and_pix = (0, $label, $pix ? (0, $pix) : ()); + my @label_and_pix = (0, $label, if_($pix, 0, $pix)); gtkadd(Gtk2::Button->new, gtkpack_(Gtk2::HBox->new(0, 3), 1, "", @@ -436,7 +436,7 @@ sub create_okcancel { my $b1 = gtksignal_connect($w->{ok} = Gtk2::Button->new($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk2->main_quit }); my $b2 = $cancel && gtksignal_connect($w->{cancel} = Gtk2::Button->new($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk2->main_quit }); $::isWizard and gtksignal_connect($w->{wizcancel} = Gtk2::Button->new(N("Cancel")), clicked => sub { die 'wizcancel' }); - my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, $::Wizard_no_previous ? () : $b2, $b1) : ($b1, $b2); + my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, if_(!$::Wizard_no_previous, $b2, $b1)) : ($b1, $b2); push @l, map { gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => $_->[1]) } @other; $_->can_default($::isWizard) foreach @l; |