From b54fb710f233d76f7fc3c05a5279b747fd2912aa Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 25 Feb 2009 09:43:46 +0000 Subject: hide module configuration button if needed (#16678) --- perl-install/standalone/harddrake2 | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'perl-install/standalone/harddrake2') diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index 1325d767d..6d4d2f738 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -14,6 +14,7 @@ BEGIN { unshift @::textdomains, 'drakconf' } use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version use ugtk2 qw(:create :helpers :wrappers); use interactive; +use modules::parameters; use harddrake::data; #- needs to stay after use-ugtk2 as long as this module defines globals containing some N() use fsedit; use pkgs; @@ -302,6 +303,7 @@ sub fill_default_text { $text->get_buffer->set_text(N("Click on a device in the left tree in order to display its information here.")); } +my %has_parameter; $tree->get_selection->signal_connect('changed' => sub { my ($select) = @_; my ($model, $iter) = $select->get_selected; @@ -352,6 +354,15 @@ $tree->get_selection->signal_connect('changed' => sub { $current_configurator = $configurators[$idx]; show_hide($current_configurator && -x first(split /\s+/, $current_configurator), $config_button); # strip arguments for -x test + + # hide module configuration button if needed: + my $driver = $current_device->{driver}; + if (!defined $has_parameter{$driver}) { + local $SIG{CHLD} = undef; + $has_parameter{$driver} ||= to_bool(scalar modules::parameters::parameters($driver)); + } + show_hide($has_parameter{$driver}, $module_cfg_button); + return 1; } } -- cgit v1.2.1