summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/draknet25
-rwxr-xr-xperl-install/standalone/net_monitor35
2 files changed, 35 insertions, 25 deletions
diff --git a/perl-install/standalone/draknet b/perl-install/standalone/draknet
index c6cc5df0f..aa133f42d 100755
--- a/perl-install/standalone/draknet
+++ b/perl-install/standalone/draknet
@@ -184,17 +184,20 @@ my $label5 = new Gtk::Label($netcnx->{type} eq 'lan' ? _("Gateway:") : _("Interf
$table1->attach($label5, 0, 1, 1, 2, 'fill', 'fill',0,0);
my $label6 = new Gtk::Label($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
$table1->attach($label6, 1, 2, 1, 2, 'fill', 'fill',0,0);
-my $connected_now;
+my $isconnected = -1;
sub connected_local {
+ print "in connected local\n";
my $w = $in->wait_message('', _("Testing your connection..."), 1);
- $connected_now=connected();
+ Gtk->main_iteration while Gtk->events_pending;
+ $isconnected=connected();
}
my $label7 = new Gtk::Label(_("Status:"));
$table1->attach($label7, 0, 1, 2, 3, 'fill', 'fill',0,0);
-my $label8 = new Gtk::Label($connected_now ? _("Connected") : _("Not connected"));
+my $label8 = new Gtk::Label(_("Testing your connection..."));
$table1->attach($label8, 1, 2, 2, 3, 'fill', 'fill',0,0);
-my $button2 = new Gtk::Button($connected_now ? _("Disconnect...") : _("Connect..."));
+my $button2 = new Gtk::Button(_("Wait please"));
+$button2->set_sensitive(0);
$button2->signal_connect (clicked => sub {
my $dialog = new Gtk::Dialog();
$dialog->signal_connect ( delete_event => sub { Gtk->main_quit(); });
@@ -211,7 +214,7 @@ $button2->signal_connect (clicked => sub {
$bbox_dialog->add($button_ok );
$dialog->show_all;
$dialog->set_modal(1);
- if (!$connected_now) {
+ if (!$isconnected) {
$l->set(_("Starting your connection..."));
Gtk->main_iteration while Gtk->events_pending;
connect_backend();
@@ -347,7 +350,7 @@ $window1->show_all();
$_->hide foreach ($button1, $button3);
Gtk->main_iteration while Gtk->events_pending;
$::isEmbedded and kill USR2, $::CCPID;
-my $tag = Gtk->timeout_add(15000, \&update2);
+my $tag = Gtk->timeout_add(4000, \&update2);
Gtk->main;
Gtk->exit(0);
@@ -401,14 +404,18 @@ sub update {
build_clist();
$clist1->thaw();
$button_del->set_sensitive(network::netconnect::get_profiles() > 1);
+ $isconnected !=-1 or return 1;
+ $label8->set($isconnected ? _("Connected") : _("Not connected"));
+ $button2->child->set($isconnected ? _("Disconnect...") : _("Connect..."));
+ $button2->set_sensitive(1);
1;
}
sub update2 {
+ print "HHHHHH\n";
+ connected_bg(\$isconnected);
update();
- $connected_now = connected();
- $label8->set($connected_now ? _("Connected") : _("Not connected"));
- $button2->child->set($connected_now ? _("Disconnect...") : _("Connect..."));
+ 1;
}
sub quit_global {
$::isEmbedded ? kill(USR1, $::CCPID) : Gtk->exit(0);
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 693875436..031cbfab2 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -72,7 +72,7 @@ $window1->set_border_width(5);
my $colorr = my_gtk::gtkcolor(50400, 655, 20000);
my $colort = my_gtk::gtkcolor(55400, 55400, 655);
my $colora = my_gtk::gtkcolor(655, 50400, 655);
-my $isconnected=0;
+my $isconnected=-1;
my @interfaces;
my $monitor = {};
my $netcnx = {};
@@ -121,7 +121,7 @@ gtkadd($window1,
)
),
0, gtkpack_(new Gtk::HBox(0,5),
- 1, gtksignal_connect(my $button_connect = new Gtk::Button(), clicked => \&connection),
+ 1, gtksignal_connect(my $button_connect = gtkset_sensitive(new Gtk::Button(), 0), clicked => \&connection),
0, new Gtk::VSeparator,
0, gtkpack(new Gtk::VBox(0,5),
gtksignal_connect(new Gtk::Button(_("Logs")), clicked => sub {
@@ -153,19 +153,23 @@ my $gca = new Gtk::Gdk::GC($window1->window);
$gca->set_foreground($colora);
my ($pix_c_map, $pix_c_mask) = gtkcreate_png("net_c.png");
my ($pix_d_map, $pix_d_mask) = gtkcreate_png("net_d.png");
+my ($pix_u_map, $pix_u_mask) = gtkcreate_png("net_u.png");
$button_connect->add(gtkpack__(new Gtk::VBox(0,3),
- my $pix_c = new Gtk::Pixmap($pix_d_map, $pix_d_mask),
- my $label_c = new Gtk::Label(_("Connect to Internet"))
+ my $pix_c = new Gtk::Pixmap($pix_u_map, $pix_u_mask),
+ my $label_c = new Gtk::Label(_("Wait please"))
));
-$statusbar->push(1, _("Not connected"));
+$statusbar->push(1, _("Wait please, testing your connection..."));
$window1->show_all();
#$window1->set_policy (1, 1, 1);
my $time_tag = Gtk->timeout_add(1000, \&rescan);
-my $time_tag2 = Gtk->timeout_add(15000, \&update);
+my $time_tag2 = Gtk->timeout_add(5000, \&update);
+
update();
rescan();
-connection() if ($connect && !$isconnected);
-connection() if ($disconnect && $isconnected);
+while ($isconnected == -1) {
+ Gtk->main_iteration while Gtk->events_pending;
+}
+connection() if ($connect && !$isconnected || $disconnect && $isconnected);
Gtk->main;
Gtk->exit(0);
@@ -194,16 +198,16 @@ sub connection {
my $tag2 = Gtk->timeout_add(10000, sub {
Gtk->timeout_remove($tag);
$statusbar->pop(1);
- $statusbar->push(1, $isconnected2 ? ( connected() ?
+ $statusbar->push(1, $isconnected2 ? ( $isconnected ?
_("Disconnection from Internet failed.") :
_("Disconnection from Internet complete.")) :
- ( connected() ?
+ ( $isconnected ?
_("Connection complete.") :
_("Connection failed.\nVerify your configuration in the Mandrake Control Center."))
);
my $tag3 = Gtk->timeout_add(10000, sub {
$statusbar->pop(1);
- $statusbar->push(1, connected() ? _("Connected") : _("Not connected"));
+ $statusbar->push(1, $isconnected ? _("Connected") : _("Not connected"));
0;
});
$button_connect->set_sensitive(1);
@@ -313,6 +317,7 @@ sub change_color {
}
sub update {
+ connected_bg(\$isconnected);
my @intfs = get_val();
if($combo1->entry->get_text ne ($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default")) {
$combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
@@ -372,19 +377,17 @@ sub update {
}
@interfaces = @intfs;
my $netc={};
- my $connected_now = connected();
- if($connected_now == !$isconnected) {
- $isconnected = $isconnected ? 0 : 1;
+ if ($isconnected != -1) {
+ $button_connect->set_sensitive(1);
$label_c->set($isconnected ? _("Disconnect") : _("Connect"));
$statusbar->pop(1);
- $statusbar->push(1, $connected_now ? _("Connected") : _("Not connected"));
+ $statusbar->push(1, $isconnected ? _("Connected") : _("Not connected"));
$isconnected ? $pix_c->set($pix_c_map, $pix_c_mask) : $pix_c->set($pix_d_map, $pix_d_mask);
}
if (!(-e $connect_file && -e $disconnect_file)) {
$button_connect->set_sensitive(0);
$label_c->set("No internet connection configured");
}
- #$time_tag2 = Gtk->timeout_add(5000, \&update);
1;
}