aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2003-11-28 16:55:06 +0000
committerDaouda Lo <daouda@mandriva.com>2003-11-28 16:55:06 +0000
commit969457802b82fe90e74ee61c9924455e704145c1 (patch)
tree66d0ee607087c2010790b15a6bb80a5ea874c0a4
parent3c9abe522d644e29b8052c04576726a50a4fa8c9 (diff)
downloaduserdrake-969457802b82fe90e74ee61c9924455e704145c1.tar
userdrake-969457802b82fe90e74ee61c9924455e704145c1.tar.gz
userdrake-969457802b82fe90e74ee61c9924455e704145c1.tar.bz2
userdrake-969457802b82fe90e74ee61c9924455e704145c1.tar.xz
userdrake-969457802b82fe90e74ee61c9924455e704145c1.zip
- homedir hang
-rwxr-xr-xuserdrake99
1 files changed, 54 insertions, 45 deletions
diff --git a/userdrake b/userdrake
index 44bf1e4..c9b27ca 100755
--- a/userdrake
+++ b/userdrake
@@ -35,6 +35,7 @@ use USER;
#Only for Debugging
#use Devel::Peek;
use Gtk2::Gdk::Keysyms;
+use utf8;
use log;
my $conffile = '/etc/sysconfig/userdrake';
@@ -171,9 +172,9 @@ $us->{wnd}{rwindow}->show_all;
#undef $wait;
$window_splash->destroy;
undef $window_splash;
-gtkset_mousecursor_normal();
+
Gtk2->main;
-ugtk2->exit;
+ugtk2->exit(0);
sub GrayDelEdit {
foreach ($tbedit, $tbdel, $buttorcheck{edit}, $buttorcheck{delete}) { defined $_ and $_->set_sensitive(0) };
@@ -210,13 +211,14 @@ sub RefreshUsersFull {
}
sub RefreshGroupsFull {
my ($filtergroups, $strfilt) = @_;
- defined $ctx and my $groups = $ctx->GroupsEnumerateFull;
+ my $groups;
+ defined $ctx and $groups = $ctx->GroupsEnumerateFull;
$gtree_model->clear;
my @GroupReal;
LOOP: foreach my $g (@$groups) { next LOOP if $filtergroups && $g->Gid($GetValue) <= 499 || $g->Gid($GetValue) == 65534; push(@GroupReal, $g) if $g->GroupName($GetValue) =~ /^\Q$strfilt/ };
foreach my $g (@GroupReal) {
- my $a = $g->Gid($GetValue); my $group = $ctx->LookupGroupById($a);
- my $u_b_g = $ctx->EnumerateUsersByGroup($g->GroupName($GetValue));
+ my $group = $ctx->LookupGroupById($a); my $a = $g->GroupName($GetValue);
+ $a and my $u_b_g = $ctx->EnumerateUsersByGroup($a);
my $listUbyG = join(',', @$u_b_g);
my $group_id = $g->Gid($GetValue);
$gtree_model->append_set([ 0 => $g->GroupName($GetValue), if_($group_id, 1 => $group_id), if_($listUbyG, 2 => $listUbyG) ]);
@@ -250,10 +252,10 @@ sub GetFaceIcon {
$hb
}
sub AddUser {
- my $w = ugtk2->new(N("Create New User"), grab => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}), if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
+ my $w = NewWindow(N("Create New User"), 1);
my $dontcreatehomedir = 0; my $is_system = 0;
my %u;
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack_(Gtk2::VBox->new(0, 2),
0, BuildUui(),
0, Gtk2::HSeparator->new,
@@ -329,10 +331,9 @@ sub AddUser {
$ctx->UserSetPass($userEnt, $u{passwd});
defined $us->{o}{iconval} and any::addKdmIcon($u{username}, $us->{o}{iconval});
Refresh($sysfilter, $stringsearch);
-
}
}
- !$error and Gtk2->main_quit; $error = 0; gtkset_mousecursor_normal() })
+ !$error and $w->destroy; $error = 0; })
} ([ 'gtk-cancel', 1 ], [ 'gtk-ok', 0 ])),
)
);
@@ -348,8 +349,8 @@ sub AddUser {
$h->pack_end($us->{o}{uid}, 0, 0, 4);
$h->pack_end(Gtk2::Label->new(N("UID: ")), 0, 0, 4);
GrayBox($us->{o}{userid}, $h, 0);
- $w->{rwindow}->show_all;
- $w->main;
+ $w->show_all;
+# $w->main;
}
sub Add2UsersGroup {
my $name = shift;
@@ -358,10 +359,10 @@ sub Add2UsersGroup {
return $usersgroup->Gid($GetValue);
}
sub ChooseGroup() {
- my $w = ugtk2->new(N("Choose Group"), grab => 1, center => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
+ my $w = NewWindow(N("Choose group"), 1);
my $choice;
my @radio = gtkradio(N("Add to the existing group"), (N("Add to the existing group"), N("Add to the 'users' group")));
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack__(Gtk2::VBox->new(0,5),
Gtk2::Label->new(N("A group with this name already exists. What would you like to do?")),
gtkpack(Gtk2::VBox->new(0,0), @radio),
@@ -371,15 +372,15 @@ sub ChooseGroup() {
each_index { $_->get_active and $choice = $::i } @radio;
Gtk2->main_quit;
}),
- gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { $w->{retval} = 0; $error = 1; Gtk2->main_quit }))));
- $w->main;
+ gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { $error = 1; $w->destroy }))));
+ $w->show_all;
$choice;
}
sub GimmeChoice {
my ($title, $text) = @_;
- my $w = ugtk2->new($title, grab => 1, center => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
+ my $w = NewWindow(N("Choice"), 1);
my $choice;
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack__(Gtk2::VBox->new(0,5),
Gtk2::Label->new($text),
Gtk2::HSeparator->new,
@@ -388,14 +389,14 @@ sub GimmeChoice {
$choice = 1;
Gtk2->main_quit;
}),
- gtksignal_connect(Gtk2::Button->new(N("No")), clicked => sub { $choice = $w->{retval} = 0; $error = 1; Gtk2->main_quit }))));
- $w->main;
+ gtksignal_connect(Gtk2::Button->new(N("No")), clicked => sub { $choice = 0; $error = 1; $w->destroy }))));
+ $w->show_all;
$choice;
-}
+}
sub AddGroup {
- my $w = ugtk2->new(N("Create New Group"), grab => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
+ my $w = NewWindow(N("Create New Group"), 1);
my $mode = 0; my %g; my $is_system = 0;
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack_(Gtk2::VBox->new(0, 2),
0, BuildGui(),
0, Gtk2::HSeparator->new,
@@ -424,7 +425,7 @@ sub AddGroup {
Refresh($sysfilter, $stringsearch);
}
}
- !$error and Gtk2->main_quit; $error = 0 })
+ !$error and $w->destroy; $error = 0 })
} ([ 'gtk-cancel', 1 ], [ 'gtk-ok', 0 ])),
)
);
@@ -432,8 +433,8 @@ sub AddGroup {
$h->pack_end($us->{o}{gid}, 0, 0, 4);
$h->pack_end(Gtk2::Label->new(N("GID: ")), 0, 0, 4);
$us->{o}{groupid}->signal_connect('clicked' => sub { $mode = !$mode; $h->set_sensitive($mode) });
- $w->{rwindow}->show_all;
- $w->main;
+ $w->show_all;
+ #$w->main;
}
sub UpdateOrDelUsersInGroup {
@@ -475,8 +476,8 @@ sub Delete {
#my $removehome = GimmeChoice(N(" Remove Home Directory"), N("Do you want to delete the user's home directory and mail spool?"));
#$removehome and $ctx->Clean($userEnt);
# New version
- my $w = ugtk2->new(N("Warning : Deleting User"), grab => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
- gtkadd($w->{window},
+ my $w = NewWindow(N("Delete files or not"), 1);
+ gtkadd($w,
gtkpack_(Gtk2::VBox->new(0, 2),
0, Gtk2::Label->new(N("Deleting user %s\n Also perform the following actions\n", $username)),
0, $checkhome = Gtk2::CheckButton->new(N("Delete Home Directory :%s", $userEnt->HomeDir($GetValue))),
@@ -499,16 +500,16 @@ sub Delete {
$checkspool->get_active and $ctx->CleanSpool($userEnt);
Refresh($sysfilter, $stringsearch)
}
- !$error and Gtk2->main_quit; $error = 0 })
+ !$error and $w->destroy; $error = 0 })
} ([ 'gtk-cancel', 1 ], [ 'gtk-delete', 0 ])),
)
);
- $w->{rwindow}->show_all;
- $w->main;
+ $w->show_all;
+ #$w->main;
} elsif ($page == 1) {
my $groupname = GetNameEntFromIter($grouptree, $gtree_model, 0);
- my $wg = ugtk2->new(N("Warning : Deleting Group"), grab => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
- gtkadd($wg->{window},
+ my $wg = NewWindow(N("Delete files or not?"), 1);
+ gtkadd($wg,
gtkpack_(Gtk2::VBox->new(0, 2),
0, Gtk2::Label->new(N("Do you really want to delete the group %s\n", $groupname)),
0, Gtk2::HSeparator->new,
@@ -530,12 +531,12 @@ sub Delete {
log::explanations(N("Removing group: %s", $groupname));
$ctx->GroupDel($groupEnt); Refresh($sysfilter, $stringsearch) }
}
- !$error and Gtk2->main_quit; $error = 0 })
+ !$error and $wg->destroy; $error = 0 })
} ([ 'gtk-cancel', 1 ], [ 'gtk-delete', 0 ])),
)
);
- $wg->{rwindow}->show_all;
- $wg->main;
+ $wg->show_all;
+ #$wg->main;
}
$us->{wnd}{rwindow}->set_sensitive(1);
gtkset_mousecursor_normal();
@@ -599,8 +600,17 @@ sub BuildGui {
);
$vbox
}
+sub NewWindow {
+ my ($label, $mode) = @_;
+ my $w = Gtk2::Window->new('toplevel');
+ $w->set_title($label);
+ $w->signal_connect(delete_event => sub { $w->destroy });
+ $w->set_position('center');
+ $w->set_modal(1);
+ $w
+}
sub Edit {
- my $w = ugtk2->new('userdrake', grab => 1, if_(!$::isEmbedded,transient => $us->{wnd}{rwindow}));
+ my $w = NewWindow(N("Edit Groups / Users"), 1);
my $model = Gtk2::ListStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int");
my $tree = Gtk2::TreeView->new_with_model($model); my %g; my %u;
my ($groupname, $username, $groupEnt, $userEnt, $members, $times, $min, $max, $warn, $inact, $primgid, $temp, $Gent);
@@ -718,7 +728,7 @@ sub Edit {
}
}
my ($ch, $name, $uEnt, $gEnt, $ugid, $Exp);
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack_(Gtk2::VBox->new(0,5),
1, !$p ? $nbU : $nbG,
0, Gtk2::HSeparator->new,
@@ -838,11 +848,11 @@ sub Edit {
}
}
}
- !$error and Gtk2->main_quit; $error = 0; gtkset_mousecursor_normal() })
+ !$error and $w->destroy; $error = 0; })
} ([ 'gtk-cancel', 1 ], [ 'gtk-ok', 0 ])),
));
$tree->show;
- $w->{rwindow}->show_all;
+ $w->show_all;
$tree->signal_connect(button_press_event => sub {
my ($path, $column) = $tree->get_path_at_pos($_[1]->x, $_[1]->y);
if ($path && $column) {
@@ -887,7 +897,7 @@ sub Edit {
}
0;
});
- $w->main
+# $w->main
}
sub ValidInt {
foreach my $i (@_) { $i =~ /\d+/ or return 0 };
@@ -960,21 +970,20 @@ sub valid {
return 1;
}
sub RaiseError {
- my $w = ugtk2->new(N("Error"), grab => 1, center => 1, transient => $us->{wnd}{rwindow});
+ my $w = NewWindow(N("Error"), 1);
$error = 1;
- gtkadd($w->{window},
+ gtkadd($w,
gtkpack_(Gtk2::VBox->new,
1, Gtk2::Label->new($_[0]),
0, Gtk2::HSeparator->new,
- 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { Gtk2->main_quit })
+ 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { $w->destroy })
),
);
- $w->main
+ $w->show_all
}
sub QuitGlobal {
setVarsInSh($conffile, {
FILTER => bool2text($sysfilter),
});
- gtkset_mousecursor_normal();
Gtk2->main_quit;
}