summaryrefslogtreecommitdiffstats
path: root/bin/drakroam
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-03 10:12:38 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-03 10:12:38 +0000
commitd3121e58ebd804919b2d81ca9ca82f438147fb1f (patch)
tree30e986a7b267c5e8b0915377118b6c6654739c18 /bin/drakroam
parentd9e1f01cb415ceca7bfdddf7e880e6db4b9b4509 (diff)
downloaddrakx-net-d3121e58ebd804919b2d81ca9ca82f438147fb1f.tar
drakx-net-d3121e58ebd804919b2d81ca9ca82f438147fb1f.tar.gz
drakx-net-d3121e58ebd804919b2d81ca9ca82f438147fb1f.tar.bz2
drakx-net-d3121e58ebd804919b2d81ca9ca82f438147fb1f.tar.xz
drakx-net-d3121e58ebd804919b2d81ca9ca82f438147fb1f.zip
group gui/args/dbus initialization stuff
Diffstat (limited to 'bin/drakroam')
-rwxr-xr-xbin/drakroam114
1 files changed, 57 insertions, 57 deletions
diff --git a/bin/drakroam b/bin/drakroam
index 94bbe48..afea8df 100755
--- a/bin/drakroam
+++ b/bin/drakroam
@@ -38,23 +38,6 @@ my $w = ugtk2->new($title);
$::main_window = $w->{real_window};
my $in = 'interactive'->vnew('su');
-my %args = map { if_(/^--(\w+)=(.*)$/ && member($1, qw(ap interface)), $1 => $2) } @ARGV;
-
-my @connection_types = qw(network::connection::wireless network::connection::cellular_card);
-
-$droam->{gui}{model} = Gtk2::ListStore->new('Gtk2::Gdk::Pixbuf', 'Glib::String');
-$droam->{gui}{connections_combo} = Gtk2::ComboBox->new($droam->{gui}{model});
-my $pix_r = Gtk2::CellRendererPixbuf->new;
-$droam->{gui}{connections_combo}->pack_start($pix_r, 0,);
-$droam->{gui}{connections_combo}->add_attribute($pix_r, pixbuf => 0);
-my $text_r = Gtk2::CellRendererText->new;
-$droam->{gui}{connections_combo}->pack_start($text_r, 1);
-$droam->{gui}{connections_combo}->add_attribute($text_r, text => 1);
-
-$droam->{gui}{pixbuf_size} = 32;
-$droam->{gui}{empty_pixbuf} = Gtk2::Gdk::Pixbuf->new('rgb', 1, 8, $droam->{gui}{pixbuf_size}, $droam->{gui}{pixbuf_size});
-$droam->{gui}{empty_pixbuf}->fill(0);
-
sub update_connections_list() {
$droam->{gui}{model}->set($droam->{gui}{model}->append, 0, $droam->{gui}{empty_pixbuf} , 1, N("No device found")) unless @{$droam->{all_connections}};
$droam->{gui}{model}->set($droam->{gui}{model}->append,
@@ -112,20 +95,6 @@ sub update_on_connection_change() {
my $net = {};
network::network::read_net_conf($net);
-$droam->{gui}{networks_list} = Gtk2::SimpleList->new(
- "AP" => "hidden",
- '' => "pixbuf",
- N("SSID") => "text",
- N("Signal strength") => "pixbuf",
- '' => "pixbuf",
- N("Encryption") => "text",
- N("Operating Mode") => "text",
-);
-$droam->{gui}{networks_list}->get_selection->set_mode('single');
-
-my $status_bar = Gtk2::Statusbar->new;
-my $status_bar_cid = $status_bar->get_context_id("Network event");
-
sub get_network_event_message {
my ($member, @args) = @_;
#- FIXME: the hostname.d script and s2u use a different D-Bus interface
@@ -139,32 +108,6 @@ sub get_network_event_message {
}
}
-my $dbus;
-eval { $dbus = dbus_object::system_bus() };
-if ($dbus) {
- eval { $net->{monitor} = network::monitor->new($dbus) };
- $dbus->{connection}->add_filter(sub {
- my ($_con, $msg) = @_;
- my $member = $msg->get_member;
- my $message = get_network_event_message($member, $msg->get_args_list) or return;
- my $m_id = $status_bar->push($status_bar_cid, $message);
- Glib::Timeout->add(20000, sub { $status_bar->remove($status_bar_cid, $m_id); 0 });
- update_networks() if $member eq 'status';
- });
- $dbus->{connection}->add_match("type='signal',interface='com.mandriva.network'");
- dbus_object::set_gtk2_watch_helper($dbus);
-}
-
-$droam->{gui}{pixbufs} = {
- state => { map { $_ => gtkcreate_pixbuf($_) } qw(connected disconnected refresh) },
- link_level => { map {
- $_ => gtkcreate_pixbuf('wifi-' . sprintf('%03d', $_) . '.png')->scale_simple(24, 24, 'hyper');
- } qw(20 40 60 80 100) },
- encryption => { map {
- $_ => gtkcreate_pixbuf("encryption-$_-24.png");
- } qw(open weak strong) },
-};
-
sub update_networks() {
@{$droam->{gui}{networks_list}{data}} = ();
@@ -301,6 +244,63 @@ sub toggle_connection() {
update_on_network_change();
}
+my %args = map { if_(/^--(\w+)=(.*)$/ && member($1, qw(ap interface)), $1 => $2) } @ARGV;
+
+my @connection_types = qw(network::connection::wireless network::connection::cellular_card);
+
+$droam->{gui}{model} = Gtk2::ListStore->new('Gtk2::Gdk::Pixbuf', 'Glib::String');
+$droam->{gui}{connections_combo} = Gtk2::ComboBox->new($droam->{gui}{model});
+my $pix_r = Gtk2::CellRendererPixbuf->new;
+$droam->{gui}{connections_combo}->pack_start($pix_r, 0,);
+$droam->{gui}{connections_combo}->add_attribute($pix_r, pixbuf => 0);
+my $text_r = Gtk2::CellRendererText->new;
+$droam->{gui}{connections_combo}->pack_start($text_r, 1);
+$droam->{gui}{connections_combo}->add_attribute($text_r, text => 1);
+
+$droam->{gui}{pixbuf_size} = 32;
+$droam->{gui}{empty_pixbuf} = Gtk2::Gdk::Pixbuf->new('rgb', 1, 8, $droam->{gui}{pixbuf_size}, $droam->{gui}{pixbuf_size});
+$droam->{gui}{empty_pixbuf}->fill(0);
+
+$droam->{gui}{networks_list} = Gtk2::SimpleList->new(
+ "AP" => "hidden",
+ '' => "pixbuf",
+ N("SSID") => "text",
+ N("Signal strength") => "pixbuf",
+ '' => "pixbuf",
+ N("Encryption") => "text",
+ N("Operating Mode") => "text",
+);
+$droam->{gui}{networks_list}->get_selection->set_mode('single');
+
+my $status_bar = Gtk2::Statusbar->new;
+my $status_bar_cid = $status_bar->get_context_id("Network event");
+
+my $dbus;
+eval { $dbus = dbus_object::system_bus() };
+if ($dbus) {
+ eval { $net->{monitor} = network::monitor->new($dbus) };
+ $dbus->{connection}->add_filter(sub {
+ my ($_con, $msg) = @_;
+ my $member = $msg->get_member;
+ my $message = get_network_event_message($member, $msg->get_args_list) or return;
+ my $m_id = $status_bar->push($status_bar_cid, $message);
+ Glib::Timeout->add(20000, sub { $status_bar->remove($status_bar_cid, $m_id); 0 });
+ update_networks() if $member eq 'status';
+ });
+ $dbus->{connection}->add_match("type='signal',interface='com.mandriva.network'");
+ dbus_object::set_gtk2_watch_helper($dbus);
+}
+
+$droam->{gui}{pixbufs} = {
+ state => { map { $_ => gtkcreate_pixbuf($_) } qw(connected disconnected refresh) },
+ link_level => { map {
+ $_ => gtkcreate_pixbuf('wifi-' . sprintf('%03d', $_) . '.png')->scale_simple(24, 24, 'hyper');
+ } qw(20 40 60 80 100) },
+ encryption => { map {
+ $_ => gtkcreate_pixbuf("encryption-$_-24.png");
+ } qw(open weak strong) },
+};
+
gtkadd($w->{window},
gtknew('VBox', spacing => 5, children => [
$::isEmbedded ? () : (0, Gtk2::Banner->new($icon, $title)),