diff options
author | Daouda Lo <daouda@mandriva.com> | 2003-07-28 11:15:28 +0000 |
---|---|---|
committer | Daouda Lo <daouda@mandriva.com> | 2003-07-28 11:15:28 +0000 |
commit | eab0d56db48d6a127fea57f6a8b41b1ff80bba96 (patch) | |
tree | c38694691b41459bb50ba90e6c27dfe3b29dc0ec | |
parent | 4c53f304c730789809d20ff398b4fa8fbaf8529d (diff) | |
download | userdrake-eab0d56db48d6a127fea57f6a8b41b1ff80bba96.tar userdrake-eab0d56db48d6a127fea57f6a8b41b1ff80bba96.tar.gz userdrake-eab0d56db48d6a127fea57f6a8b41b1ff80bba96.tar.bz2 userdrake-eab0d56db48d6a127fea57f6a8b41b1ff80bba96.tar.xz userdrake-eab0d56db48d6a127fea57f6a8b41b1ff80bba96.zip |
- add choice of icons when adding a user
-rwxr-xr-x | userdrake | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -33,7 +33,7 @@ use interactive; use POSIX qw(mktime ceil); use USER; #Only for Debugging -#use Devel::Peek; +use Devel::Peek; use Gtk2::Gdk::Keysyms; my $conffile = '/etc/sysconfig/userdrake'; @@ -199,6 +199,29 @@ sub Refresh { RefreshGroupsFull($filt, $strfilt); GrayDelEdit() } +sub GetFaceIcon { + my $i = 0; my @m; + my @icones = @m = any::facesnames(''); + print "@icones\n"; + gtkpack_(my $hb = Gtk2::HBox->new(0, 2), + 0, Gtk2::Label->new(N("Choose Icon"). ' '), + 0, my $b = Gtk2::Button->new + ); + my $set = sub { + gtkdestroy($us->{o}->{icon}); + my $f = any::face2png($_[0]); + $us->{o}->{icon} = -e $f ? gtkcreate_img($f) : Gtk2::Label->new("No Icon"); + $b->add($us->{o}->{icon}); + $us->{o}->{icon}->show; + }; + $set->($us->{o}->{iconval} = splice(@m, rand(@m), 1)); + $b->signal_connect(clicked => sub { + $set->($us->{o}->{iconval} = $icones[$i++]); + defined $icones[$i+1] or $i = 0; + Dump($us->{o}->{iconval}); + }); + $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 $dontcreatehomedir = 0; my $is_system = 0; @@ -216,6 +239,8 @@ sub AddUser { 0, $us->{o}->{userid} = Gtk2::CheckButton->new(N("Specify user ID manually")), 0, gtkset_sensitive(my $h = Gtk2::HBox->new(0, 4), 0), 0, Gtk2::HSeparator->new, + 0, GetFaceIcon(), + 0, Gtk2::HSeparator->new, 0, gtkpack(Gtk2::HBox->new(1, 20), map { my $r = $_->[1]; @@ -272,6 +297,7 @@ sub AddUser { $userEnt->ShadowWarn(-1); $userEnt->ShadowInact(-1); $ctx->UserAdd($userEnt, $is_system, $dontcreatehomedir); $ctx->UserSetPass($userEnt, $u{passwd}); + defined $us->{o}->{iconval} and any::addKdmIcon('', $u{username}, $us->{o}->{iconval}); Refresh($sysfilter, $stringsearch); } } |