--- deliantra/Deliantra-Client/DC/Util.pm 2006/04/07 17:18:22 1.5 +++ deliantra/Deliantra-Client/DC/Util.pm 2006/04/07 18:27:54 1.8 @@ -1,14 +1,34 @@ package Client::Util; +use strict; +use base 'Exporter'; +use Data::Dumper; +our @EXPORT = qw(find_rcfile); + use Gtk2; +sub find_rcfile($) { + my $path; + + for (@INC) { + $path = "$_/Crossfire/Client/$_[0]"; + return $path if -r $path; + } + + die "FATAL: can't find required file $_[0]\n"; +} + sub read_cfg { my ($file) = @_; open CFG, $file or return; + my $CFG; + local $/; - $::CFG = eval ; + $CFG = eval ; + + $::CFG = $CFG; close CFG; } @@ -34,7 +54,10 @@ my $i = $cfg->{_i}++; $tbl->attach_defaults (my $lbl = Gtk2::Label->new ($klbl), 0, 1, $i, $i + 1); $tbl->attach_defaults (my $ent = Gtk2::Entry->new, 1, 2, $i, $i + 1); - if ($key eq 'password') { $ent->set_invisible_char ("*") } + if ($key eq 'password') { + $ent->set_invisible_char ("*"); + $ent->set (visibility => 0) + } $ent->set_text ($value); $ent->signal_connect (changed => sub { my ($ent) = @_; @@ -71,6 +94,7 @@ $::CFG->{$_} = $cfg->{$_} if $_ ne '_i'; } + write_cfg "$Crossfire::VARDIR/pclientrc"; }); $hb->pack_start (my $cb = Gtk2::Button->new ("login"), 1, 1, 5); $cb->signal_connect (clicked => sub {