From 91291704c2621682c226bdeaa0b5a1cc7a971b8d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 16 Jan 2003 12:49:03 +0000 Subject: 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 --- menus_launcher.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'menus_launcher.pl') 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 &\"") }); -- cgit v1.2.1