aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2003-05-23 12:49:59 +0000
committerDaouda Lo <daouda@mandriva.com>2003-05-23 12:49:59 +0000
commit7b995d82a6f714d4e3236427d01e767bebebfd56 (patch)
tree12278cb0f2c4fbd3dc677f8719e2e40e26af7fb8
parent38335be4f95d809593aa4c9d0cb5a7110c4ab105 (diff)
downloaduserdrake-7b995d82a6f714d4e3236427d01e767bebebfd56.tar
userdrake-7b995d82a6f714d4e3236427d01e767bebebfd56.tar.gz
userdrake-7b995d82a6f714d4e3236427d01e767bebebfd56.tar.bz2
userdrake-7b995d82a6f714d4e3236427d01e767bebebfd56.tar.xz
userdrake-7b995d82a6f714d4e3236427d01e767bebebfd56.zip
- Life is sad (implement another way of filtering)
-rwxr-xr-xuserdrake258
1 files changed, 40 insertions, 18 deletions
diff --git a/userdrake2 b/userdrake2
index 40bf5d5..cd66e3b 100755
--- a/userdrake2
+++ b/userdrake2
@@ -63,7 +63,7 @@ my ($menu, $factory) = create_factory_menu($us->{wnd}{rwindow},
{ path => N("/_Actions") . N("/_Delete"), callback => \&Delete },
{ path => N("/_Options"), type => '<Branch>' },
{ path => N("/_Options") . N("/_Filter system users"), type => '<CheckItem>',
- callback => sub { $sysfilter = $checkall->active; Refresh_Users_Full($sysfilter) } },
+ callback => sub { $sysfilter = $checkall->active; Refresh_Users_Full($sysfilter); Refresh_Groups_Full($sysfilter) } },
{ path => N("/_Help"), type => '<Branch>' },
{ path => N("/_Help").N("/_Help"), callback => \&HelpSystem },
{ path => N("/_Help").N("/_Report Bug"), callback => sub { system("drakhelp https://qa.mandrakesoft.com &") } },
@@ -112,30 +112,38 @@ map {
my ($tbuser, $tbgroup, $tbedit, $tbdel, $tbref, $tbhelp) = @toolbwg;
foreach (($tbedit, $tbdel)) { $_->set_sensitive(0) };
-my $ctx = USER::ADMIN->new;
-my $users = $ctx->users_enumerate_full();
-my $groups = $ctx->groups_enumerate_full();
-
-$utree_model->clear();
-foreach my $l (@$users) {
- $utree_model->append_set([ 0 => $l->UserName, 1 => $l->Uid, 2 => $l->Gid, 3 => $l->Gecos, 4 => $l->LoginShell, 5 => $l->HomeDir, 6 => $l]);
-}
-
-$gtree_model->clear();
-foreach my $g (@$groups) {
- $gtree_model->append_set([ 0 => $g->GroupName, 1 => $g->Gid, 2 => $g->Gid, 3 => $g]);
-}
-
+my $ctx = USER::ADMIN->new;
+Refresh_Users_Full($sysfilter); Refresh_Groups_Full($sysfilter);
$us->{wnd}{rwindow}->show_all;
Gtk2->main;
ugtk2->exit;
sub Refresh_Users_Full {
+ my $filterusers = shift;
+ my $users ;
+ $users = $ctx->UsersEnumerateFull();
+ $utree_model->clear();
+ my @UserReal;
+ LOOP: foreach my $l (@$users) { next LOOP if ($filterusers && $l->Uid <= 499 || $l->Uid == 65534) ; push(@UserReal, $l) };
+ foreach my $l (@UserReal) {
+ my $a = $l->Gid; my $group = $ctx->LookupGroupById($a);
+ $utree_model->append_set([ 0 => $l->UserName, 1 => $l->Uid, 2 => $group->GroupName, 3 => $l->Gecos, 4 => $l->LoginShell, 5 => $l->HomeDir, 6 => $l]);
+ }
+}
+
+sub Refresh_Groups_Full {
my $filterusers = shift;
- if ($filterusers) {
-
- }
+ my $groups;
+ $groups = $ctx->GroupsEnumerateFull();
+ $gtree_model->clear();
+ my @GroupReal;
+ LOOP:foreach my $g (@$groups) { next LOOP if ($filterusers && $g->Gid <= 499 || $g->Gid == 65534); push(@GroupReal, $g) };
+ foreach my $g (@GroupReal) {
+ my $a = $g->Gid; my $group = $ctx->LookupGroupById($a);
+ $gtree_model->append_set([ 0 => $g->GroupName, 1 => $g->Gid, 2 => $g->Gid, 3 => $g]);
+ }
}
+
sub AddUser {
my $w = ugtk2->new(N("Create New User"), grab => 1);
my $mode = 0;
@@ -164,6 +172,7 @@ sub AddUser {
)
);
map { $us->{o}->{$_}->set_active } (qw(privategroup addusercheck));
+ $us->{o}->{log}->signal_connect('focus_out_event' => sub { $us->{o}->{homedir}->set_text("/home/".$us->{o}->{log}->get_text()) });
$us->{o}->{uid} = Gtk2::SpinButton->new(Gtk2::Adjustment->new(500, 1, 65000, 1, 10, 10), 1, 0);
$h->pack_end($us->{o}->{uid}, 0, 0, 4);
$h->pack_end(Gtk2::Label->new(N("UID: ")), 0, 0, 4);
@@ -235,6 +244,8 @@ sub BuildUui {
[ N("Login Shell") . " :", $us->{o}->{shells} = Gtk2::Combo->new ]
)
);
+ $us->{o}->{shells}->set_popdown_strings(@{$ctx->get_user_shells()});
+ $us->{o}->{shells}->entry->set_text("/bin/bash");
$vbox
}
sub BuildGui {
@@ -375,3 +386,14 @@ sub about_mdk_userdrake {
);
$window_about->show_all;
}
+sub raiseerror {
+ my $w = ugtk2->new(N("Error"), grab => 1, center => 1, transient => $us->{wnd}->{rwindow});
+ gtkadd($w->{window},
+ gtkpack_(Gtk2::VBox->new,
+ 1, Gtk2::Label->new($_[0]),
+ 0, Gtk2::HSeparator->new,
+ 0, gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit })
+ ),
+ );
+ $w->main
+}