diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-08-03 08:54:04 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-08-03 08:54:04 +0000 |
commit | 699e0d36e09b71bdf6939695140e28e1232208fa (patch) | |
tree | 35ff97063d3d579957a44db310d3de645a34629b /bin | |
parent | eb7fa653d2644681748be6bd3397377dfc033ece (diff) | |
download | drakx-net-699e0d36e09b71bdf6939695140e28e1232208fa.tar drakx-net-699e0d36e09b71bdf6939695140e28e1232208fa.tar.gz drakx-net-699e0d36e09b71bdf6939695140e28e1232208fa.tar.bz2 drakx-net-699e0d36e09b71bdf6939695140e28e1232208fa.tar.xz drakx-net-699e0d36e09b71bdf6939695140e28e1232208fa.zip |
move code in a main() sub
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/draknetcenter | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/bin/draknetcenter b/bin/draknetcenter index 280be2d..20a9e9f 100755 --- a/bin/draknetcenter +++ b/bin/draknetcenter @@ -25,17 +25,6 @@ use network::connection; use network::connection::wireless; use network::connection::cellular_card; -my $title = N("Network Center"); -my $icon = '/usr/share/mcc/themes/default/drakroam-mdk.png'; - -$ugtk2::wm_icon = $icon; -my $w = ugtk2->new($title); -#- so that transient_for is defined, for wait messages and popups to be centered -$::main_window = $w->{real_window}; - -my @connections = map { $_->get_connections(automatic_only => 1) } network::connection::get_types; -@connections = reverse(uniq_ { $_->{device} } reverse(@connections)); - sub build_networks_list { my ($connection) = @_; @@ -101,7 +90,19 @@ sub gtkset_image { $w; } -gtkadd($w->{window}, +sub main() { + my $title = N("Network Center"); + my $icon = '/usr/share/mcc/themes/default/drakroam-mdk.png'; + + $ugtk2::wm_icon = $icon; + my $w = ugtk2->new($title); + #- so that transient_for is defined, for wait messages and popups to be centered + $::main_window = $w->{real_window}; + + my @connections = map { $_->get_connections(automatic_only => 1) } network::connection::get_types; + @connections = reverse(uniq_ { $_->{device} } reverse(@connections)); + + gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ $::isEmbedded ? () : (0, Gtk2::Banner->new($icon, $title)), 1, gtknew('ScrolledWindow', width => 500, height => 300, child => gtknew('VBox', spacing => 5, children_tight => [ @@ -127,6 +128,9 @@ gtkadd($w->{window}, } @connections, ])), ]), - ); + ); + + $w->main; +} -$w->main; +main(); |