summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2004-08-30 08:59:25 +0000
committerDaouda Lo <daouda@mandriva.com>2004-08-30 08:59:25 +0000
commitaa2d6ca3727f86a33dca1ce7f90c13c57e9183ff (patch)
tree4a579630a82778d686423ea6c642fce2c6aa2a45 /perl-install/standalone
parent62bbae786878b83810cd625442e467ea4aac571e (diff)
downloaddrakx-aa2d6ca3727f86a33dca1ce7f90c13c57e9183ff.tar
drakx-aa2d6ca3727f86a33dca1ce7f90c13c57e9183ff.tar.gz
drakx-aa2d6ca3727f86a33dca1ce7f90c13c57e9183ff.tar.bz2
drakx-aa2d6ca3727f86a33dca1ce7f90c13c57e9183ff.tar.xz
drakx-aa2d6ca3727f86a33dca1ce7f90c13c57e9183ff.zip
- avoid duplication
Diffstat (limited to 'perl-install/standalone')
-rw-r--r--perl-install/standalone/net_applet10
1 files changed, 6 insertions, 4 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet
index f723fee64..07b18f7ef 100644
--- a/perl-install/standalone/net_applet
+++ b/perl-install/standalone/net_applet
@@ -17,8 +17,7 @@ my ($menu, $timeout);
my $onstartupfile = "$ENV{HOME}/.net_applet";
add_icon_path("/usr/share/libDrakX/pixmaps/");
# Allow multiple instances, but only one per user:
-my @pids = `ps -u $ENV{USER}` =~ /net_applet/;
-@pids > 1 and die "net_applet already running\n";
+is_running('net_applet') > 1 and die "net_applet already running\n";
my $prog_name = "/usr/bin/net_applet";
my $current_md5 = md5file($prog_name);
@@ -54,8 +53,7 @@ gtkadd(my $icon = Gtk2::TrayIcon->new("Net_Applet"),
);
$eventbox->signal_connect(button_press_event => sub {
if ($_[1]->button == 1) {
- my @nm_pid = `ps -u $ENV{USER}` =~ /net_monitor/;
- @nm_pid > 1 or netMonitor()
+ is running('net_monitor') > 1 or netMonitor()
}
$_[1]->button == 3 && $menu and $menu->popup(undef, undef, undef, undef, $_[1]->button, $_[1]->time);
});
@@ -72,6 +70,10 @@ Gtk2->main;
ugtk2::exit(0);
+sub is_running {
+ my @pid = `ps -u $ENV{USER}` =~ /\Q$_[0]/;
+ @pid
+}
sub shouldStart() {
my %p = getVarsFromSh($onstartupfile);
my $ret = $p{AUTOSTART} eq 'FALSE' ? 0 : 1;