summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-10-27 10:48:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-10-27 10:48:54 +0000
commit3fc1833600024a331442a9e4492f157c1163742c (patch)
tree9fb37b4435d6e7f7a19ef731ae3134309846604b
parentbb004c30da7e45f8e27ea09cd597580e56a551e4 (diff)
downloaddrakx-3fc1833600024a331442a9e4492f157c1163742c.tar
drakx-3fc1833600024a331442a9e4492f157c1163742c.tar.gz
drakx-3fc1833600024a331442a9e4492f157c1163742c.tar.bz2
drakx-3fc1833600024a331442a9e4492f157c1163742c.tar.xz
drakx-3fc1833600024a331442a9e4492f157c1163742c.zip
use ToggleButton instead of Button so that selected partition is visually toggled
-rw-r--r--perl-install/diskdrake/hd_gtk.pm23
1 files changed, 18 insertions, 5 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index a9ebdc769..9de1dde04 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -269,13 +269,23 @@ sub create_buttons4partitions {
$ratio /= $totalwidth / $width * 1.1;
}
+ my $current_button;
+ my $set_current_button = sub {
+ my ($w) = @_;
+ $current_button->set_active(0) if $current_button;
+ ($current_button = $w)->set_active(1);
+ };
+
foreach my $entry (@parts) {
- my $w = Gtk2::Button->new_with_label($entry->{mntpoint} || '') or die '';
- $w->signal_connect(focus_in_event => sub { current_entry_changed($kind, $entry); $w->grab_focus }); #- grab_focus is needed because gtk2 is buggy. Forcing an expose event would be enough
- $w->signal_connect(button_press_event => sub { current_entry_changed($kind, $entry); $w->grab_focus }); #- grab_focus is needed because gtk2 is buggy. The creation of widgets causes the lost of the focus
+ my $w = Gtk2::ToggleButton->new_with_label($entry->{mntpoint} || '') or die '';
+ $w->signal_connect(clicked => sub {
+ $current_button != $w or return;
+ current_entry_changed($kind, $entry);
+ $set_current_button->($w);
+ });
$w->signal_connect(key_press_event => sub {
my (undef, $event) = @_;
- member('control-mask', @{$event->state}) or return;
+ member('control-mask', @{$event->state}) && $w == $current_button or return;
my $c = chr $event->keyval;
foreach my $s (diskdrake::interactive::part_possible_actions($in, kind2hd($kind), $entry, $all_hds)) {
@@ -294,7 +304,10 @@ sub create_buttons4partitions {
$w->set_name("PART_" . fs::type::part2type_name($entry));
$w->set_size_request($entry->{size} * $ratio + $minwidth, 0);
gtkpack__($kind->{display_box}, $w);
- $w->grab_focus if $current_entry && fsedit::are_same_partitions($current_entry, $entry);
+ if ($current_entry && fsedit::are_same_partitions($current_entry, $entry)) {
+ $set_current_button->($w);
+ $w->grab_focus;
+ }
}
}