diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-05-23 09:28:12 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-05-23 09:28:12 +0000 |
commit | 0b183b2611b2e59e51e5c9517f2d682e4bf3ef60 (patch) | |
tree | 6977feec9424bc8ee2a86372a179ff658ec35ce9 | |
parent | f847f9ca97199b12fc715e226801118aae7b699b (diff) | |
download | drakx-net-0b183b2611b2e59e51e5c9517f2d682e4bf3ef60.tar drakx-net-0b183b2611b2e59e51e5c9517f2d682e4bf3ef60.tar.gz drakx-net-0b183b2611b2e59e51e5c9517f2d682e4bf3ef60.tar.bz2 drakx-net-0b183b2611b2e59e51e5c9517f2d682e4bf3ef60.tar.xz drakx-net-0b183b2611b2e59e51e5c9517f2d682e4bf3ef60.zip |
handle expand action for both eventbox and expander
-rwxr-xr-x | lib/network/netcenter.pm | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm index 28c54bd..ca04085 100755 --- a/lib/network/netcenter.pm +++ b/lib/network/netcenter.pm @@ -102,16 +102,25 @@ sub main { ]); my $expander = gtknew('Expander'); - my $toggle_expand = sub { $expander->get_expanded ? $content->hide : $content->show_all }; + my $on_expand = sub { + my ($expanded) = @_; + if ($expanded && $cmanager->{connection}->can('get_networks') && + !$cmanager->{connection}{probed_networks} && $expanded) { + gtkflush(); + $cmanager->update_networks; + } + }; + my $toggle_expand = sub { + my $was_expanded = $expander->get_expanded; + $was_expanded ? $content->hide : $content->show_all; + $on_expand->(!$was_expanded); + }; $expander->signal_connect(activate => $toggle_expand); my $eventbox = gtksignal_connect(Gtk2::EventBox->new, button_press_event => sub { $_[1]->button == 1 or return; $toggle_expand->(); - my $expanded = !$expander->get_expanded; - $expander->set_expanded($expanded); - gtkflush(); - $cmanager->update_networks if - $cmanager->{connection}->can('get_networks') && !$cmanager->{connection}{probed_networks} && $expanded; + my $was_expanded = $expander->get_expanded; + $expander->set_expanded(!$was_expanded); }); my $box = gtknew('VBox', spacing => 5, children_tight => [ gtknew('HBox', children => [ |