summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/harddrake2
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/harddrake2')
-rwxr-xr-xperl-install/standalone/harddrake2296
1 files changed, 159 insertions, 137 deletions
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 6763f77a1..9210f5ca7 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -12,11 +12,11 @@ use common;
# i18n: IMPORTANT: to get correct namespace (drakconf instead of only libDrakX)
BEGIN { unshift @::textdomains, 'drakconf' }
-use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
-use ugtk2 qw(:create :helpers :wrappers);
+use mygtk3 qw(gtknew); #- do not import gtkadd which conflicts with ugtk3 version
+use ugtk3 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 harddrake::data; #- needs to stay after use-ugtk3 as long as this module defines globals containing some N()
use fsedit;
use pkgs;
use POSIX qw(:sys_wait_h);
@@ -69,25 +69,23 @@ my %fields =
},
CPU =>
{
+ "system type" => [ "Sytem Type", "Name of the system" ],
+ "BogoMIPS" => [ N("Bogomips"), N("the GNU/Linux kernel needs to run a calculation loop at boot time to initialize a timer counter. Its result is stored as bogomips as a way to \"benchmark\" the cpu.") ],
"bogomips" => [ N("Bogomips"), N("the GNU/Linux kernel needs to run a calculation loop at boot time to initialize a timer counter. Its result is stored as bogomips as a way to \"benchmark\" the cpu.") ],
"cache size" => [ N("Cache size"), N("size of the (second level) cpu cache") ],
- "coma_bug" => [
- #-PO: here "comas" is the medical coma, not the lexical coma!!
- N("Coma bug"), N("whether this cpu has the Cyrix 6x86 Coma bug") ],
"cpu family" => [ N("Cpuid family"), N("family of the cpu (eg: 6 for i686 class)") ],
"cpuid level" => [ N("Cpuid level"), N("information level that can be obtained through the cpuid instruction") ],
"cpu MHz" => [ N("Frequency (MHz)"), N("the CPU frequency in MHz (Megahertz which in first approximation may be coarsely assimilated to number of instructions the cpu is able to execute per second)") ],
"flags" => [ N("Flags"), N("CPU flags reported by the kernel") ],
- "fdiv_bug" => [ N("Fdiv bug"),
- N("Early Intel Pentium chips manufactured have a bug in their floating point processor which did not achieve the required precision when performing a Floating point DIVision (FDIV)") ],
- "fpu" => [ N("Is FPU present"), N("yes means the processor has an arithmetic coprocessor") ],
- "fpu_exception" => [ N("Whether the FPU has an irq vector"), N("yes means the arithmetic coprocessor has an exception vector attached") ],
- "f00f_bug" => [ N("F00f bug"), N("early pentiums were buggy and freezed when decoding the F00F bytecode") ],
- "hlt_bug" => [ N("Halt bug"),
- N("Some of the early i486DX-100 chips cannot reliably return to operating mode after the \"halt\" instruction is used") ],
+ "cpu cores" => [ N("Cores"), N("CPU cores") ],
+ "core id" => [ N("Core ID"), N("Core ID") ],
+ "physical id" => [ N("Physical ID"), N("Physical ID") ],
+ "apicid" => [ N("ACPI ID"), N("ACPI ID") ],
+ "siblings" => [ N("Siblings"), N("Siblings") ],
"level" => [ N("Level"), N("sub generation of the cpu") ],
"model" => [ N("Model"), N("generation of the cpu (eg: 8 for Pentium III, ...)") ],
"model name" => [ N("Model name"), N("official vendor name of the cpu") ],
+ "cpu model" => [ N("Model name"), N("official vendor name of the cpu") ],
"name" => [ N("Name"), N("the name of the CPU") ],
"processor" => [ N("Processor ID"), N("the number of the processor") ],
"stepping" => [ N("Model stepping"), N("stepping of the cpu (sub model (generation) number)") ],
@@ -102,7 +100,8 @@ my %fields =
{
channel => [ N("Channel"), N("EIDE/SCSI channel") ],
info => [ N("Disk identifier"), N("usually the disk serial number") ],
- lun => [ N("Logical unit number"), N("the SCSI target number (LUN). SCSI devices connected to a host are uniquely identified by a
+ id => [ N("Target id number"), N("the SCSI target identifier") ],
+ lun => [ N("Logical unit number"), N("the SCSI Logical Unit Number (LUN). SCSI devices connected to a host are uniquely identified by a
channel number, a target id and a logical unit number") ],
},
MEMORY =>
@@ -115,6 +114,10 @@ channel number, a target id and a logical unit number") ],
'Current Speed' => [ N("Speed"), N("Speed of the memory bank") ],
'Bank Connections' => [ N("Bank connections"), '' ],
'Socket Designation' => [ N("Name"), N("Socket designation of the memory bank") ],
+ # for Memory Device:
+ 'Locator' => [ N("Location"), ],
+ 'Size' => [ N("Size"), N("Size of the memory device") ],
+ 'Speed' => [ N("Speed"), N("Speed of the memory bank") ],
},
MOUSE =>
{
@@ -128,10 +131,11 @@ channel number, a target id and a logical unit number") ],
}
);
+my $identification = N("Identification");
my %groups = (
generic =>
{
- N("Identification") => [ qw(Vendor model description info media_type) ],
+ $identification => [ qw(Vendor model description info media_type) ],
N("Connection") => [ qw(bus pci_domain pci_bus pci_device pci_function pci_revision vendor id subvendor subid) ],
},
AUDIO =>
@@ -140,22 +144,21 @@ my %groups = (
},
CPU =>
{
- N("Identification") => [ qw(processor vendor_id), "model name", "cpu family", qw(model level stepping) ],
+ $identification => [ qw(processor vendor_id), "model name", "cpu family", qw(model level stepping), "cpuid level" ],
+ N("Cores") => [ 'cpu cores', 'core id', 'physical id', 'apicid', 'siblings' ],
N("Performances") => [ "cpu MHz", "cache size", "bogomips" ],
- N("Bugs") => [ qw(fdiv_bug coma_bug f00f_bug hlt_bug) ],
- N("FPU") => [ qw(fpu fpu_exception) ],
},
HARDDISK =>
{
- N("Identification") => [ qw(Vendor Model description info media_type) ],
- N("Connection") => [ qw(bus channel lun) ],
+ $identification => [ qw(Vendor Model description info media_type) ],
+ N("Connection") => [ qw(bus channel lun id) ],
N("Bus identification") => [ qw(vendor id subvendor subid) ],
N("Device") => [ qw(device) ],
N("Partitions") => [ qw(primary_partitions extended_partitions) ],
},
MOUSE =>
{
- N("Identification") => [ qw(name type MOUSETYPE Protocol) ],
+ $identification => [ qw(name type MOUSETYPE Protocol) ],
N("Features") => [ qw(EmulateWheel nbuttons) ],
},
);
@@ -176,82 +179,52 @@ my ($current_device, $current_class, $current_configurator);
my %sysh = distrib();
my $distro_name = $sysh{system};
-my %menus = (
- 'options' =>
- #-PO: please keep all "/" characters !!!
- N("/_Options"),
- 'help' => N("/_Help")
- );
-
my %menu_options = (
- 'PRINTERS_DETECTION' => [ $menus{options}, N("/Autodetect _printers") ],
- 'MODEMS_DETECTION' => [ $menus{options}, N("/Autodetect _modems") ],
- 'JAZZ_DETECTION' => [ $menus{options}, N("/Autodetect _jaz drives") ],
- 'PARALLEL_ZIP_DETECTION' => [ $menus{options}, N("/Autodetect parallel _zip drives") ],
+ 'MODEMS_DETECTION' => N("Autodetect _modems"),
+ 'PARALLEL_ZIP_DETECTION' => N("Autodetect parallel _zip drives"),
);
-$ugtk2::wm_icon = "harddrake";
-$w = ugtk2->new(N("Hardware Configuration"));
+$ugtk3::wm_icon = "harddrake";
+$w = ugtk3->new(N("Hardware Configuration"));
# fake diagnostics pragma:
local $::main_window = $w->{real_window};
-my @menu_items =
- (
- [ N("/_File"), undef, undef, undef, '<Branch>' ],
- [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<Item>' ],
- [ join('', @{$menu_options{PRINTERS_DETECTION}}), undef,
- sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->get_active }, undef, '<CheckItem>' ],
- [ join('', @{$menu_options{MODEMS_DETECTION}}), undef,
- sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->get_active }, undef, '<CheckItem>' ],
- [ join('', @{$menu_options{JAZZ_DETECTION}}), undef,
- sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_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>' ],
- [ $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("/_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>'
- ],
- 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("/_About..."), undef, sub {
- my $license = formatAlaTeX(translate($::license));
- $license =~ s/\n/\n\n/sg; # nicer formatting
- my $w = gtknew('AboutDialog', name => N("Harddrake"),
- version => mandrake_release_info()->{version},
- copyright => N("Copyright (C) %s by Mandriva", '2001-2008'),
- license => $license, wrap_license => 1,
- comments => N("This is HardDrake, a %s hardware configuration tool.", $distro_name),
- website => 'http://mandrivalinux.com',
- website_label => N("Mandriva Linux"),
- authors => 'Thierry Vignaud <vignaud@mandriva.com>',
- artists => 'Hélène Durosini <ln@mandriva.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>'
- ]
- );
+my $has_help = -x "/usr/sbin/drakhelp_inst";
+my $ui = gtknew('UIManager', actions => [
+ # [name, stock_id, value, label, accelerator, tooltip, callback]
+ [ 'FileMenu', undef, N("_File") ],
+ [ 'Quit', undef, N("_Quit"), N("<control>Q"), undef, \&quit_global ],
+ [ 'OptionsMenu', undef, N("_Options") ],
+ [ 'HelpMenu', undef, N("_Help") ],
+ if_($has_help, [ 'Help', undef, N("_Help"), N("<control>H"), undef, \&run_help ]),
+ [ 'Fields description', undef, N("_Fields description"), undef, undef, \&fields_help ],
+ [ 'Report Bug', undef, N("_Report Bug"), undef, undef, \&run_drakbug ],
+ [ 'About', undef, N("_About..."), '', undef, \&about ],
+ ],
+ toggle_actions => [
+ [ 'MODEMS_DETECTION', undef, $menu_options{MODEMS_DETECTION}, undef, undef, \&handle_modem_option ],
+ [ 'PARALLEL_ZIP_DETECTION', undef, $menu_options{PARALLEL_ZIP_DETECTION}, undef, undef, \&handle_zip_option ],
+ ],
+ string =>
+ join("\n",
+ qq(<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ <menuitem action='Quit'/>
+ </menu>
+ <menu action='OptionsMenu'>
+ <menuitem action='MODEMS_DETECTION'/>
+ <menuitem action='PARALLEL_ZIP_DETECTION'/>
+ </menu>
+ <menu action='HelpMenu'>),
+ if_($has_help, "<menuitem action='Help'/>"),
+ qq(
+ <menuitem action='Fields description'/>
+ <menuitem action='Report Bug'/>
+ <menuitem action='About'/>
+ </menu>
+ </menubar>
+</ui>)));
$in = 'interactive'->vnew('su'); #require_root_capability();
@@ -263,26 +236,25 @@ add_icon_path('/usr/share/pixmaps/harddrake2/');
$::noborderWhenEmbedded = 1;
-my ($menubar, $factory) = create_factory_menu($w->{real_window}, @menu_items);
+my $menubar = $ui->get_widget('/MenuBar');
$w->{window}->set_size_request(805, 550) if !$::isEmbedded;
-my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int");
-$w->{window}->add(gtkpack_(0, Gtk2::VBox->new(0, 0),
+my $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", "Glib::String", "Glib::Int");
+$w->{window}->add(gtkpack_(0, Gtk3::VBox->new(0, 0),
0, $menubar,
- 0, Gtk2::Banner->new("/usr/share/mcc/themes/default/harddrake-mdk.png", translate("Hardware")),
- 1, create_hpaned(gtkadd(Gtk2::Frame->new(N("Detected hardware")),
- create_scrolled_window(gtkset_size_request(my $tree = Gtk2::TreeView->new_with_model($tree_model), 350, -1), ['automatic', 'automatic'])),
- gtkpack_(0, Gtk2::VBox->new(0, 0),
- 1, gtkadd(my $frame = Gtk2::Frame->new(N("Information")),
- create_scrolled_window(my $text = Gtk2::TextView->new)),
- 0, my $module_cfg_button = gtksignal_connect(Gtk2::Button->new(N("Set current driver options")),
+ 0, Gtk3::Banner->new("/usr/share/mcc/themes/default/harddrake-mdk.png", translate("Hardware")),
+ 1, create_hpaned(my $f = gtkadd(Gtk3::Frame->new(N("Detected hardware")),
+ create_scrolled_window(gtkset_size_request(my $tree = Gtk3::TreeView->new_with_model($tree_model), 350, -1), ['automatic', 'automatic'])),
+ gtkpack_(0, Gtk3::VBox->new(0, 0),
+ 1, gtkadd(my $frame = Gtk3::Frame->new(N("Information")),
+ create_scrolled_window(my $text = Gtk3::TextView->new)),
+ 0, my $module_cfg_button = gtksignal_connect(Gtk3::Button->new(N("Set current driver options")),
clicked => sub {
local $SIG{CHLD} = undef;
require modules::interactive;
modules::interactive::config_window($in, $current_device);
- gtkset_mousecursor_normal();
}),
- 0, my $config_button = gtksignal_connect(Gtk2::Button->new(N("Run config tool")),
+ 0, my $config_button = gtksignal_connect(Gtk3::Button->new(N("Run config tool")),
# we've a configurator, let's add a button for it and show it
clicked => sub {
return 1 if defined $pid;
@@ -293,16 +265,23 @@ $w->{window}->add(gtkpack_(0, Gtk2::VBox->new(0, 0),
)
);
+$f->set_size_request(350, -1);
$text->set_wrap_mode('word');
$frame->set_size_request(300, 450) unless $::isEmbedded;
# $tree->set_column_auto_resize(0, 1);
my (@data, @configurators);
-$tree->append_column(my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::MDV::CellRendererPixWithLabel->new, 'pixbuf' => 0, label => 1));
+$tree->append_column(my $textcolumn = Gtk3::TreeViewColumn->new);
+$textcolumn->pack_start(my $img_renderer = Gtk3::CellRendererPixbuf->new, 0);
+$textcolumn->set_attributes($img_renderer, pixbuf => 0);
+
+$textcolumn->pack_start(my $text_renderer = Gtk3::CellRendererText->new, 1);
+$textcolumn->set_attributes($text_renderer, text => 1);
+
$tree->set_headers_visible(0);
sub fill_default_text {
my ($text) = @_;
- $text->get_buffer->set_text(N("Click on a device in the left tree in order to display its information here."));
+ $text->get_buffer->set_text(N("Click on a device in the tree on the left in order to display its information here."));
}
my %has_parameter;
@@ -314,7 +293,6 @@ $tree->get_selection->signal_connect('changed' => sub {
($current_device, $current_class) = @{$data[$idx]};
if ($idx ne -1) {
- use Gtk2::Pango;
my %device_fields = map {
# The U+200E character is to force LTR display, as what what follows the colon is always in LTR (device names, paths, etc),
# this ensures proper displaying of names like /dev/fd0 (otherwise it gets 'dev/fd0/').
@@ -322,7 +300,7 @@ $tree->get_selection->signal_connect('changed' => sub {
my $field = lookup_field($_);
if_($_ && $field->[0], $_ =>
[
- [ $field->[0] . ": \x{200e}", { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD } ],
+ [ $field->[0] . ": \x{200e}", { 'foreground' => 'royalblue3', 'weight' => 'bold' } ],
[ ($current_device->{$_} =~ /^(unknown)/ ? N("unknown") :
$current_device->{$_} =~ /^(Unknown)/ ? N("Unknown") :
$current_device->{$_} eq 'yes' ? N("Yes") :
@@ -334,9 +312,9 @@ $tree->get_selection->signal_connect('changed' => sub {
my ($grouped, $ungrouped) = partition {
my $field = $_;
member($field, map { @$_ } values %groups);
- } keys %device_fields;
+ } sort keys %device_fields;
my @formated;
- foreach my $group (N("Identification"), grep { $_ ne N("Identification") } keys %groups) {
+ foreach my $group ($identification, grep { $_ ne $identification } keys %groups) {
my @fields = @{$groups{$group}};
# have we at least a member in that group?
next unless any { member($_, @fields) } @$grouped;
@@ -375,10 +353,11 @@ $tree->get_selection->signal_connect('changed' => sub {
$module_cfg_button->hide;
});
+$w->{rwindow}->add_accel_group($ui->get_accel_group);
# show the main window earlier (so that sub dialogs can use main
# window's icon and so that no Gtk+ critical message got displayed):
$w->{rwindow}->show_all;
-my $flush_guard = Gtk2::GUI_Update_Guard->new;
+my $flush_guard = Gtk3::GUI_Update_Guard->new;
$_->hide foreach $module_cfg_button, $config_button; # hide buttons while no device
my $wait = $in->wait_message(N("Please wait"), N("Detection in progress"));
gtkflush() if !$::isEmbedded;
@@ -392,9 +371,7 @@ my @classes;
foreach my $hw_class (@harddrake::data::tree) {
my ($Ident, $title, $icon, $configurator, $detector) = @$hw_class{qw(class string icon configurator detector)};
next if ref($detector) ne "CODE"; #skip class witouth detector
- next if $Ident =~ /(MODEM|PRINTER)/ && $::testing;
- next if $Ident =~ /JAZZ/ && !$options{JAZZ_DETECTION};
- next if $Ident =~ /PRINTER/ && !$options{PRINTERS_DETECTION};
+ next if $Ident =~ /MODEM/ && $::testing;
$detect_devices::detect_serial_modem = 0 if $Ident =~ /MODEM/ && !$options{MODEMS_DETECTION};
my @devices = $detector->(\%options);
@@ -437,13 +414,6 @@ foreach (@classes) {
$_->{capacity} =~ s/DVD/$dvd/;
}
$configurator .= harddrake::data::set_removable_configurator($Ident, $_);
- if ($Ident eq "AUDIO") {
- require harddrake::sound;
- my @alter = harddrake::sound::get_alternative($_->{driver});
- if (my $alternative_drivers = join(', ', @alter)) {
- $_->{alternative_drivers} = $alternative_drivers;
- }
- }
if ($Ident eq "HARDDISK") {
my $hd = $_;
my $info = find { $_->{device} eq $hd->{device} } @{$all_hds->{hds}};
@@ -474,10 +444,7 @@ foreach (@classes) {
foreach my $field (qw(device)) {
$_->{$field} = "/dev/$_->{$field}" if $_->{$field};
}
- foreach my $field (qw(vendor id subvendor subid)) {
- $_->{$field} = sprintf("0x%04x", $_->{$field});
- delete $_->{$field} if $_->{$field} eq "0xffff"; # 0xffff equals to '*'
- }
+ format_bus_ids($_);
if ($_->{pci_revision}) {
$_->{pci_revision} = sprintf("0x%02x", $_->{pci_revision});
} else {
@@ -492,6 +459,17 @@ foreach (@classes) {
undef $flush_guard;
+sub format_bus_ids {
+ my ($device) = @_;
+ # do not vivify ids:
+ return if !($device->{vendor} && $device->{id});
+ foreach my $field (qw(vendor id subvendor subid)) {
+ next if !$device->{$field};
+ $device->{$field} = sprintf("0x%04x", $device->{$field});
+ delete $device->{$field} if $device->{$field} eq "0xffff"; # 0xffff equals to '*'
+ }
+}
+
sub reap_children() {
# reap zombies
my $child_pid;
@@ -504,9 +482,8 @@ $w->{rwindow}->signal_connect(delete_event => \&quit_global);
$w->{rwindow}->set_position('center') unless $::isEmbedded;
foreach (keys %menu_options) {
- my $title = strip_first_underscore(@{$menu_options{$_}});
$options{$_} = 0 unless defined($options{$_}); # force detection by default
- $check_boxes{$_} = $factory->get_widget("<main>" . $title);
+ $check_boxes{$_} = $ui->get_widget('/MenuBar/OptionsMenu/' . $_);
$check_boxes{$_}->set_active($options{$_}); # restore saved values
}
@@ -514,19 +491,20 @@ $textcolumn->set_min_width(350);
#$textcolumn->set_minmax_width(400);
$textcolumn->set_sizing('GTK_TREE_VIEW_COLUMN_AUTOSIZE');#GROW_ONLY
#$tree->columns_autosize();
-$tree->signal_connect(realize => sub { $tree->get_selection->select_path(Gtk2::TreePath->new_first) });
+$tree->signal_connect(realize => sub { $tree->get_selection->select_path(Gtk3::TreePath->new_first) });
{
$SIG{CHLD} = undef;
#local $SIG{CHLD} = sub {};
- if (my @packages = difference2([ pkgs::detect_hardware_packages($in->do_pkgs) ], [ qw(ati.2 dmraid gnome-alsamixer mdadm xmms-alsa) ])) {
+ # do no try to install too generic hw packages:
+ my @blacklist = [ qw(dmraid mdadm) ];
+ if (my @packages = difference2([ pkgs::detect_hardware_packages($in->do_pkgs) ], @blacklist)) {
@packages = difference2(\@packages, [ $in->do_pkgs->are_installed(@packages) ]);
# we use uniq() because on biarch machines, we got packages twice:
my @packages2install = uniq($in->do_pkgs->are_available(@packages));
undef $wait;
- gtkset_mousecursor_normal();
if (@packages2install && $in->ask_yesorno(N("Warning"), N("The following packages need to be installed:\n") . join(', ', @packages2install))) {
$in->do_pkgs->install(@packages2install);
@@ -535,28 +513,72 @@ $tree->signal_connect(realize => sub { $tree->get_selection->select_path(Gtk2::T
}
$SIG{CHLD} = \&reap_children;
undef $wait;
-gtkset_mousecursor_normal();
# fill in default right text since no device is selected on startup:
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},
+ logo => '/usr/share/icons/harddrake.png',
+ 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;
setVarsInSh($conffile, \%options) if !$::testing;
- ugtk2->exit(0);
+ ugtk3->exit(0);
}
-sub show_hide {
- my ($bool, $button) = @_;
- if ($bool) { $button->show } else { $button->hide }
+sub run_drakbug() {
+ run_program::raw({ detach => 1 }, 'drakbug', '--report', 'harddrake');
}
+sub run_help() {
+ run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'harddrake');
+}
-sub strip_first_underscore {
- join '', map { s/_//; $_ } @_;
+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 }
}
sub lookup_field {
@@ -567,7 +589,7 @@ sub lookup_field {
sub titleFormat {
my ($title) = @_;
- [ $title . "\n", { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD, scale => Gtk2::Pango->PANGO_SCALE_LARGE } ];
+ [ $title . "\n", { 'weight' => 'bold', scale => 1.4399999999999 } ]; # Pango->PANGO_SCALE_LARGE
}
sub force_rename_field {
> $e->{help}); } } $e->{list}, \@radios; $boxradio, sub { my ($v, $full_struct) = @_; mapn { $_[0]->set_active($_[1] eq $v); $full_struct->{focus_w} = $_[0] if $_[1] eq $v; } \@radios, $e->{list}; }, $radios[0]; } sub create_treeview_list { my ($e, $onchange_f, $double_click) = @_; my $curr; my $list = Gtk2::ListStore->new("Glib::String"); my $list_tv = Gtk2::TreeView->new_with_model($list); $list_tv->set_headers_visible(0); $list_tv->get_selection->set_mode('browse'); my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, my $renderer = Gtk2::CellRendererText->new, 'text' => 0); $list_tv->append_column($textcolumn); $renderer->set_property('ellipsize', 'end'); my $select = sub { my ($path) = @_; return if !$list_tv->get_model; $list_tv->set_cursor($path, undef, 0); Glib::Timeout->add(100, sub { $list_tv->scroll_to_cell($path, undef, 1, 0.5, 0); 0 }); }; my ($starting_word, $start_reg) = ('', '^'); my $timeout; $list_tv->set_enable_search(0); $list_tv->signal_connect(key_press_event => sub { my ($_w, $event) = @_; my $c = chr($event->keyval & 0xff); Glib::Source->remove($timeout) if $timeout; $timeout = ''; if ($event->keyval >= 0x100) { $e->{may_go_to_next}(), return 1 if member($event->keyval, ($Gtk2::Gdk::Keysyms{Return}, $Gtk2::Gdk::Keysyms{KP_Enter})); $starting_word = '' if !member($event->keyval, ($Gtk2::Gdk::Keysyms{Control_L}, $Gtk2::Gdk::Keysyms{Control_R})); } else { if (member('control-mask', @{$event->state})) { $c eq 's' or return 1; $start_reg and $start_reg = '', return 1; $curr++; } else { $e->{may_go_to_next}(), return 1 if $c eq ' '; $curr++ if $starting_word eq '' || $starting_word eq $c; $starting_word .= $c unless $starting_word eq $c; } my @l = @{$e->{formatted_list}}; my $word = quotemeta $starting_word; my $j; for ($j = 0; $j < @l; $j++) { $l[($j + $curr) % @l] =~ /$start_reg$word/i and last; } if ($j == @l) { $starting_word = ''; } else { $select->(Gtk2::TreePath->new_from_string(($j + $curr) % @l)); } $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); } 0; }); $list_tv->show; $list->append_set([ 0 => $_ ]) foreach @{$e->{formatted_list}}; $list_tv->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; $model && $iter or return; $onchange_f->(sub { my $row = $model->get_path_str($iter); $e->{list}[$curr = $row]; }); }); $list_tv->signal_connect(button_press_event => $double_click) if $double_click; $list_tv, sub { my ($v) = @_; eval { my $nb = find_index { $_ eq $v } @{$e->{list}}; my ($old_path) = $list_tv->get_cursor; if (!$old_path || $nb != $old_path->to_string) { $select->(Gtk2::TreePath->new_from_string($nb)); } undef $old_path if $old_path; }; }; } sub __create_tree_model { my ($e) = @_; my $sep = quotemeta $e->{separator}; my $tree_model = Gtk2::TreeStore->new("Glib::String", if_($e->{image2f}, "Gtk2::Gdk::Pixbuf")); my $build_value = sub { my ($v) = @_; my $type = 0; if ($e->{image2f}) { my $image = $e->{image2f}->($_[0]); ($type, $v) = (1, gtkcreate_pixbuf($image)) if $image; } [ $type => $v ]; }; my (%wtree, $parent); $parent = sub { if (my $w = $wtree{"$_[0]$e->{separator}"}) { return $w } my $s = ''; foreach (split $sep, $_[0]) { $wtree{"$s$_$e->{separator}"} ||= $tree_model->append_set($s ? $parent->($s) : undef, $build_value->($_)); $s .= "$_$e->{separator}"; } $wtree{$s}; }; $tree_model->{path_str_list} = [ map { my ($root, $leaf) = /(.*)$sep(.+)/ ? ($1, $2) : ('', $_); my $iter = $tree_model->append_set($parent->($root), $build_value->($leaf)); $tree_model->get_path_str($iter); } @{$e->{formatted_list}} ]; undef $_ foreach values %wtree; undef %wtree; $tree_model; } sub create_treeview_tree { my ($e, $onchange_f, $double_click) = @_; my $tree_model = __create_tree_model($e); my $tree = Gtk2::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); { my $col = Gtk2::TreeViewColumn->new; $col->pack_start(my $texrender = Gtk2::CellRendererText->new, 0); $col->add_attribute($texrender, text => 0); if ($e->{image2f}) { $col->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0); $col->add_attribute($pixrender, pixbuf => 1); } $tree->append_column($col); } $tree->set_headers_visible(0); my $select = sub { my ($path_str) = @_; my $path = Gtk2::TreePath->new_from_string($path_str); $tree->expand_to_path($path); $tree->set_cursor($path, undef, 0); gtkflush(); #- workaround gtk2 bug not honouring centering on the given row if node was closed $tree->scroll_to_cell($path, undef, 1, 0.5, 0); }; my $curr = $tree_model->get_iter_first; #- default value $tree->expand_all if $e->{tree_expanded}; my $selected_via_click; $tree->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; $model && $iter or return; undef $curr if ref $curr; my $path = $tree_model->get_path($curr = $iter); if (!$tree_model->iter_has_child($iter)) { $onchange_f->(sub { my $path_str = $path->to_string; my $i = find_index { $path_str eq $_ } @{$tree_model->{path_str_list}}; $e->{list}[$i]; }); } else { $tree->expand_row($path, 0) if $selected_via_click; } }); my ($starting_word, $start_reg) = ('', "^"); my $timeout; my $toggle = sub { if ($tree_model->iter_has_child($curr)) { $tree->toggle_expansion($tree_model->get_path($curr), 0); } else { &{$e->{may_go_to_next}}; } }; $tree->set_enable_search(0); $tree->signal_connect(key_press_event => sub { my ($_w, $event) = @_; $selected_via_click = 0; my $c = chr($event->keyval & 0xff); $curr or return 0; Glib::Source->remove($timeout) if $timeout; $timeout = ''; if ($event->keyval >= 0x100) { &$toggle and return 1 if member($event->keyval, ($Gtk2::Gdk::Keysyms{Return}, $Gtk2::Gdk::Keysyms{KP_Enter})); $starting_word = '' if !member($event->keyval, ($Gtk2::Gdk::Keysyms{Control_L}, $Gtk2::Gdk::Keysyms{Control_R})); } else { my $next; if (member('control-mask', @{$event->state})) { $c eq "s" or return 1; $start_reg and $start_reg = '', return 0; $next = 1; } else { &$toggle and return 1 if $c eq ' '; $next = 1 if $starting_word eq '' || $starting_word eq $c; $starting_word .= $c unless $starting_word eq $c; } my $word = quotemeta $starting_word; my ($after, $best); my $sep = quotemeta $e->{separator}; my $currpath = $tree_model->get_path_str($curr); mapn { my ($path_str, $v) = @_; $next &&= !$after; $after ||= $path_str eq $currpath; $v =~ s/.*$sep//; if ($v =~ /$start_reg$word/i) { if ($after && !$next) { ($best, $after) = ($path_str, 0); } else { $best ||= $path_str; } } } $tree_model->{path_str_list}, $e->{formatted_list}; if (defined $best) { $select->($best); } else { $starting_word = ''; } $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); } 0; }); $tree->signal_connect(button_press_event => sub { $selected_via_click = 1; &$double_click if $curr && !$tree_model->iter_has_child($curr) && $double_click; }); $tree, sub { my $v = may_apply($e->{format}, $_[0]); eval { my $i = find_index { $v eq $_ } @{$e->{formatted_list}}; my ($model, $iter) = $tree->get_selection->get_selected; my $new_path_str = $tree_model->{path_str_list}[$i]; my $old_path_str = $model && $tree_model->get_path_str($iter); $select->($new_path_str) if $new_path_str ne $old_path_str; undef $iter if ref $iter; }; }; } #- $actions is a ref list of $action #- $action is a { kind => $kind, action => sub { ... }, button => Gtk2::Button->new(...) } #- where $kind is one of '', 'modify', 'remove', 'add' sub add_modify_remove_action { my ($button, $buttons, $e, $treelist) = @_; if (member($button->{kind}, 'modify', 'remove')) { @{$e->{list}} or return; } my $r = $button->{action}->(${$e->{val}}); defined $r or return; if ($button->{kind} eq 'add') { ${$e->{val}} = $r; } elsif ($button->{kind} eq 'remove') { ${$e->{val}} = $e->{list}[0]; } ugtk2::gtk_set_treelist($treelist, [ map { may_apply($e->{format}, $_) } @{$e->{list}} ]); add_modify_remove_sensitive($buttons, $e); 1; } sub add_padding { my ($w) = @_; gtknew('HBox', children => [ 0, gtknew('Alignment', width => $mygtk2::left_padding), 1, $w ]); } sub create_widget { my ($o, $common, $e, $onchange_f, $update, $ignore_ref) = @_; my $onchange = sub { my ($f) = @_; sub { $onchange_f->($f, @_) }; }; my ($w, $real_w, $focus_w, $set); if ($e->{type} eq 'iconlist') { $w = Gtk2::Button->new; $set = sub { gtkdestroy($e->{icon}); my $f = $e->{icon2f}->($_[0]); $e->{icon} = -e $f ? gtkcreate_img($f) : Gtk2::WrappedLabel->new(may_apply($e->{format}, $_[0])); $w->add(gtkshow($e->{icon})); }; $w->signal_connect(clicked => sub { $onchange_f->(sub { next_val_in_array(${$e->{val}}, $e->{list}) }); $set->(${$e->{val}}); }); if ($e->{alignment} eq 'right') { $real_w = gtknew('HButtonBox', layout => 'start', children_tight => [ $w ]); } else { $real_w = gtkpack_(Gtk2::HBox->new(0,10), 1, Gtk2::HBox->new(0,0), 0, $w, 1, Gtk2::HBox->new(0,0)); } } elsif ($e->{type} eq 'bool') { if ($e->{image}) { $w = ugtk2::gtkadd(Gtk2::CheckButton->new, gtkshow(gtkcreate_img($e->{image}))); } else { #- warn "\"text\" member should have been used instead of \"label\" one at:\n", common::backtrace(), "\n" if $e->{label} && !$e->{text}; $w = Gtk2::CheckButton->new_with_label($e->{text}); } $w->signal_connect(clicked => $onchange->(sub { $w->get_active })); $set = sub { $w->set_active($_[0]) }; $real_w = add_padding($w); } elsif ($e->{type} eq 'only_label') { my @common = ( # workaround infamous 6 years old gnome bug #101968: if_($e->{alignment} ne 'right', width => mygtk2::get_label_width()) ); $w = $e->{title} ? gtknew('Title2', label => escape_text_for_TextView_markup_format(${$e->{val}}), @common) : gtknew($e->{alignment} eq 'right' ? 'Label_Right' : 'Label_Left', line_wrap => 1, text_markup => ${$e->{val}}, @common); } elsif ($e->{type} eq 'label') { $w = gtknew('WrappedLabel', text_markup => ${$e->{val}}); $set = sub { $w->set($_[0]) }; } elsif ($e->{type} eq 'empty') { $w = gtknew('HBox', height => $e->{height}); } elsif ($e->{type} eq 'button') { $w = gtknew(($e->{install_button} ? 'Install_Button' : 'Button'), text => '', clicked => $e->{clicked_may_quit_cooked}); $set = sub { my $w = $w->child; # handle Install_Buttons: if (ref($w) =~ /Gtk2::HBox/) { ($w) = find { ref($_) =~ /Gtk2::Label/ } $w->get_children; } # guard against 'advanced' widgets that are now in their own dialog # (instead of in another block child of an expander): return if !$w; $w->set_label(may_apply($e->{format}, $_[0])) }; } elsif ($e->{type} eq 'range') { my $adj = Gtk2::Adjustment->new(${$e->{val}}, $e->{min}, $e->{max} + ($e->{SpinButton} ? 0 : 1), 1, ($e->{max} - $e->{min}) / 10, 1); $w = $e->{SpinButton} ? Gtk2::SpinButton->new($adj, 10, 0) : Gtk2::HScale->new($adj); $w->set_size_request($e->{SpinButton} ? 100 : 200, -1); $w->set_digits(0); $adj->signal_connect(value_changed => $onchange->(sub { $adj->get_value })); $w->signal_connect(key_press_event => $e->{may_go_to_next}); $set = sub { $adj->set_value($_[0]) }; } elsif ($e->{type} eq 'expander') { $e->{grow} = 'fill'; my $children = [ if_($e->{message}, { type => 'only_label', no_indent => 1, val => \$e->{message} }), @{$e->{children}} ]; create_widgets_block($o, $common, $children, $update, $ignore_ref); $w = gtknew('HBox', children_tight => [ gtknew('Install_Button', text => $e->{text}, clicked => sub { ask_fromW($o, { title => $common->{title} || N("Advanced") }, $children) } ) ]); } elsif ($e->{type} =~ /list/) { $e->{formatted_list} = [ map { may_apply($e->{format}, $_) } @{$e->{list}} ]; if (my $actions = $e->{add_modify_remove}) { my @buttons = (N_("Add"), N_("Modify"), N_("Remove")); # Add Up/Down buttons if their actions are defined push @buttons, map { if_($actions->{$_}, 'gtk-go-' . $_) } qw(Up Down); @buttons = map { my $button = /^gtk-/ ? gtknew('Button', image => gtknew('Image', stock => lc($_))) : Gtk2::Button->new(translate($_)); my $kind = $_; $kind =~ s/^gtk-go-//; { kind => lc $kind, action => $actions->{$kind}, button => $button, real_kind => $_ }; } @buttons; my $modify = find { $_->{kind} eq 'modify' } @buttons; my $do_action = sub { my ($button) = @_; add_modify_remove_action($button, \@buttons, $e, $w) and $update->(); }; ($w, $set, $focus_w) = create_treeview_list($e, $onchange_f, sub { $do_action->($modify) if $_[1]->type =~ /^2/ }); foreach my $button (@buttons) { $button->{button}->signal_connect(clicked => sub { $do_action->($button) }); } add_modify_remove_sensitive(\@buttons, $e); my ($images, $real_buttons) = partition { $_->{real_kind} =~ /^gtk-/ } @buttons; $real_w = gtkpack_(Gtk2::HBox->new(0,0), 1, create_scrolled_window($w), 0, gtkpack__(Gtk2::VBox->new(0,0), (map { $_->{button} } @$real_buttons), if_($images, gtknew('HButtonBox', layout => 'spread', children_loose => [ map { $_->{button} } @$images ] ) ), ), ); $e->{grow} = 'expand'; } else { my $use_boxradio = exists $e->{gtk}{use_boxradio} ? $e->{gtk}{use_boxradio} : @{$e->{list}} <= 8; if ($e->{help} || $use_boxradio && $e->{type} ne 'treelist') { #- used only when needed, as key bindings are dropped by List (ListStore does not seems to accepts Tooltips). ($w, $set, $focus_w) = create_boxradio($e, $onchange_f, $e->{quit_if_double_click_cooked}); $real_w = add_padding($w); } elsif ($e->{type} eq 'treelist') { ($w, $set) = create_treeview_tree($e, $onchange_f, $e->{quit_if_double_click_cooked}); } else { ($w, $set, $focus_w) = create_treeview_list($e, $onchange_f, $e->{quit_if_double_click_cooked}); } if (@{$e->{list}} > 10 || $e->{gtk}{use_scrolling}) { $real_w = create_scrolled_window($w); $e->{grow} = 'expand'; } } } else { if ($e->{type} eq "combo") { my $model; my @formatted_list = map { may_apply($e->{format}, $_) } @{$e->{list}}; $e->{formatted_list} = \@formatted_list; if (!$e->{separator}) { if ($e->{not_edit}) { $real_w = $w = Gtk2::ComboBox->new_text; # FIXME: the following causes Gtk-CRITICAL but not solvable at realize time: first($w->child->get_cell_renderers)->set_property('ellipsize', 'end') if !$e->{do_not_ellipsize}; $w->set_wrap_width($e->{gtk}{wrap_width}) if exists $e->{gtk}{wrap_width}; } else { $w = Gtk2::ComboBoxEntry->new_text; ($real_w, $w) = ($w, $w->child); } $real_w->set_popdown_strings(@formatted_list); } else { $model = __create_tree_model($e); $real_w = $w = Gtk2::ComboBox->new_with_model($model); $w->pack_start(my $texrender = Gtk2::CellRendererText->new, 0); $w->add_attribute($texrender, text => 0); if ($e->{image2f}) { $w->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0); $w->add_attribute($pixrender, pixbuf => 1); } } my $get = sub { my $i = $model ? do { my $s = $model->get_string_from_iter($w->get_active_iter); eval { find_index { $s eq $_ } @{$model->{path_str_list}} }; } : do { my $s = $w->get_text; eval { find_index { $s eq $_ } @formatted_list }; }; defined $i ? $e->{list}[$i] : $w->get_text; }; $w->signal_connect(changed => $onchange->($get)); $set = sub { my $s = may_apply($e->{format}, $_[0]); if ($model) { eval { my $i = find_index { $s eq $_ } @{$e->{formatted_list}}; my $path_str = $model->{path_str_list}[$i]; $w->set_active_iter($model->get_iter_from_string($path_str)); }; } else { $w->set_text($s) if $s ne $w->get_text && $_[0] ne $w->get_text; } }; } else { if ($e->{weakness_check}) { $w = gtknew('WeaknessCheckEntry'); } else { $w = Gtk2::Entry->new; } $w->signal_connect(changed => $onchange->(sub { $w->get_text })); $w->signal_connect(focus_in_event => sub { $w->select_region(0, -1) }); $w->signal_connect(focus_out_event => sub { $w->select_region(0, 0) }); $set = sub { $w->set_text($_[0]) if $_[0] ne $w->get_text }; if ($e->{type} eq 'file') { my $button = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-open'), clicked => sub { my $file = $o->ask_fileW({ title => $e->{label}, want_a_dir => to_bool($e->{want_a_dir}), }); $set->($file) if $file; }); $real_w = gtkpack_(Gtk2::HBox->new(0,0), 1, $w, 0, $button); } } $w->signal_connect(key_press_event => $e->{may_go_to_next}); if ($e->{hidden}) { $w->set_visibility(0); $w->signal_connect(key_press_event => sub { my (undef, $event) = @_; if (!$o->{capslock_warned} && member('lock-mask', @{$event->state}) && !$w->get_text) { $o->{capslock_warned} = 1; $o->ask_warn('', N("Beware, Caps Lock is enabled")); } 0; }); } } if (my $focus_out = $e->{focus_out}) { $w->signal_connect(focus_out_event => sub { $update->($focus_out) }); } $real_w ||= $w; $e->{w} = $w; $e->{real_w} = $real_w; $e->{focus_w} = $focus_w || $w if $e->{type} ne 'empty'; $e->{set} = $set || sub {}; } sub all_entries { my ($l) = @_; map { $_, if_($_->{children}, @{$_->{children}}) } @$l; } sub all_focusable_entries { my ($l) = @_; grep { $_->{focus_w} } @$l; } sub all_title_entries { my ($l) = @_; grep { $_->{title} } @$l; } sub create_widgets_block { my ($o, $common, $l, $update, $ignore_ref) = @_; my $label_sizegrp = Gtk2::SizeGroup->new('horizontal'); my $right_label_sizegrp = Gtk2::SizeGroup->new('horizontal'); my $realw_sizegrp = Gtk2::SizeGroup->new('horizontal'); @$l = map_index { if ($::i && ($_->{type} eq 'expander' || $_->{title})) { ({ type => 'empty', height => 4 }, $_); } else { $_; } } @$l; foreach my $e (@$l) { my $onchange_f = sub { my ($f, @para) = @_; return if $$ignore_ref; ${$e->{val}} = $f->(@para); $update->($e->{changed}); }; create_widget($o, $common, $e, $onchange_f, $update, $ignore_ref); my $label_w; if ($e->{label} || !$e->{no_indent}) { $label_w = gtknew($e->{alignment} eq 'right' ? 'Label_Right' : 'Label_Left', text_markup => $e->{label} || '', size_group => ($e->{alignment} eq 'right' ? $right_label_sizegrp : $label_sizegrp), ); $realw_sizegrp->add_widget($e->{real_w}); } if ($e->{do_not_expand}) { $e->{real_w} = gtknew('HBox', children => [ 0, $e->{real_w}, 1, gtknew('Label'), ]); } my $eater = if_($e->{alignment} eq 'right' && !$label_w, gtknew('Label')); $e->{real_w} = gtkpack_(Gtk2::HBox->new, if_($e->{icon}, 0, eval { gtkcreate_img($e->{icon}) }), if_($eater, 1, $eater), if_($label_w, $e->{alignment} eq 'right', $label_w), (!$eater, $e->{real_w}), ); } gtknew('VBox', children => [ map { $_->{grow} || 0, $_->{real_w} } @$l ]); } sub create_widgets { my ($o, $common, $mainw, $l) = @_; my $ignore = 0; #-to handle recursivity my $set_all = sub { $ignore = 1; my @all = all_entries($l); $_->{set}->(${$_->{val}}, $_) foreach @all; #- nb: the parameter "$_" is needed for create_boxradio $_->{disabled} and $_->{real_w}->set_sensitive(!$_->{disabled}()) foreach @all; $_->{hidden} and $_->{w}->set_visibility(!(ref($_->{hidden}) eq 'CODE' ? $_->{hidden}() : $_->{hidden})) foreach @all;