summaryrefslogtreecommitdiffstats
path: root/menus_launcher.pl
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-01-16 12:49:03 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-01-16 12:49:03 +0000
commit91291704c2621682c226bdeaa0b5a1cc7a971b8d (patch)
tree5907cdc3e462f8608f1f858840ed5c7d613a598d /menus_launcher.pl
parenta6fc75dcccf83bbcd52df26cefee3d4971015c3b (diff)
downloadcontrol-center-91291704c2621682c226bdeaa0b5a1cc7a971b8d.tar
control-center-91291704c2621682c226bdeaa0b5a1cc7a971b8d.tar.gz
control-center-91291704c2621682c226bdeaa0b5a1cc7a971b8d.tar.bz2
control-center-91291704c2621682c226bdeaa0b5a1cc7a971b8d.tar.xz
control-center-91291704c2621682c226bdeaa0b5a1cc7a971b8d.zip
fix bug spotted by "pambonizator galacticus" :
- put all normal users in user list - don't put twice root in the list - don't reinvent the wheel, there's no need to "parse" users this way, list_passwd() is there for that
Diffstat (limited to 'menus_launcher.pl')
-rwxr-xr-xmenus_launcher.pl12
1 files changed, 5 insertions, 7 deletions
diff --git a/menus_launcher.pl b/menus_launcher.pl
index cc50e1f3..17dfcb11 100755
--- a/menus_launcher.pl
+++ b/menus_launcher.pl
@@ -37,14 +37,12 @@ $table->attach(Gtk2::Label->new(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0
my $b1 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") });
$table->attach($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0);
$table->attach(Gtk2::Label->new(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0);
-my (@user_info, @usernames);
-setpwent();
-do { @user_info = getpwent();
- my ($uname, $uid) = @user_info[0, 2];
- push(@usernames, $uname) if $uid > 500 && $uname eq $ENV{INITIAL_USER};
- } while @user_info;
+
my $combo = Gtk2::Combo->new;
-$combo->set_popdown_strings(@usernames, "root");
+$combo->set_popdown_strings(map {
+ my ($username, undef, $uid) = @$_;
+ if_($uid == 0 || 500 < $uid && $username ne "nobody", $username);
+} &list_passwd());
$table->attach($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0);
my $b2 = gtksignal_connect(Gtk2::Button->new(N("Configure...")),
clicked => sub { my $a = $combo->entry->get_text(); system($a eq "root" ? "$bindir/menudrake --usermenu &" : " su $a -c \"$bindir/menudrake &\"") });