summaryrefslogtreecommitdiffstats
path: root/lib/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-09 20:02:26 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-09 20:02:26 +0000
commitdba609e88f5377382d7f51b61a5c633019aa999a (patch)
treef86d25137cdc2444438e26b1cea82891d1a149c3 /lib/network
parent8be205894e2292083f3c80ccf98a18835dacb388 (diff)
downloaddrakx-net-dba609e88f5377382d7f51b61a5c633019aa999a.tar
drakx-net-dba609e88f5377382d7f51b61a5c633019aa999a.tar.gz
drakx-net-dba609e88f5377382d7f51b61a5c633019aa999a.tar.bz2
drakx-net-dba609e88f5377382d7f51b61a5c633019aa999a.tar.xz
drakx-net-dba609e88f5377382d7f51b61a5c633019aa999a.zip
build a cmanager even if no network list is shown
Diffstat (limited to 'lib/network')
-rwxr-xr-xlib/network/netcenter.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/network/netcenter.pm b/lib/network/netcenter.pm
index 454e574..e71be9b 100755
--- a/lib/network/netcenter.pm
+++ b/lib/network/netcenter.pm
@@ -20,16 +20,18 @@ sub filter_networks {
splice @networks, 0, 3;
}
-sub build_networks_list {
+sub build_cmanager {
my ($in, $net, $w, $pixbufs, $connection) = @_;
my $cmanager = network::connection_manager::create($in, $net, $w, $pixbufs);
- network::connection_manager::create_networks_list($cmanager);
$cmanager->{connection} = $connection;
- $cmanager->{filter_networks} = sub { filter_networks($connection) };
- network::connection_manager::update_networks($cmanager);
-
- $cmanager->{gui}{networks_list};
+ $cmanager->{gui}{show_networks} = $connection->can('get_networks') && !$connection->network_scan_is_slow;
+ if ($cmanager->{gui}{show_networks}) {
+ network::connection_manager::create_networks_list($cmanager);
+ $cmanager->{filter_networks} = sub { filter_networks($connection) };
+ network::connection_manager::update_networks($cmanager);
+ }
+ $cmanager;
}
sub gtkset_image {
@@ -62,6 +64,7 @@ sub main {
$::isEmbedded ? () : (0, Gtk2::Banner->new($icon, $title)),
1, gtknew('ScrolledWindow', width => 500, height => 300, child => gtknew('VBox', spacing => 20, children_tight => [
map {
+ my $cmanager = build_cmanager($in, $net, $w, $pixbufs, $_);
gtknew('HBox', children_tight => [
gtknew('Image', file => $_->get_type_icon),
gtknew('VBox', spacing => 10, children_tight => [
@@ -69,14 +72,14 @@ sub main {
gtknew('HBox', children_tight => [
gtknew('Label', padding => [ 5, 0 ]),
gtknew('VBox', children_tight => [
- ($_->can('get_networks') && !$_->network_scan_is_slow ? build_networks_list($in, $net, $w, $pixbufs, $_) : ()),
+ if_($cmanager->{gui}{show_networks}, $cmanager->{gui}{networks_list}),
gtknew('HBox', children_tight => [
gtknew('VBox', children_tight => [
gtknew('HButtonBox', children_tight => [
gtkset_image(gtknew('Button'), 'connected'),
gtkset_image(gtknew('Button'), 'monitor-24'),
gtkset_image(gtknew('Button'), 'configure-24'),
- ($_->can('get_networks') ? (0, gtkset_image(gtknew('Button'), 'refresh')) : ()),
+ ($cmanager->{gui}{show_networks} ? (0, gtkset_image(gtknew('Button'), 'refresh')) : ()),
]),
]),
]),