ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/client-settings-page.ext
Revision: 1.2
Committed: Sat Dec 29 21:07:23 2007 UTC (16 years, 4 months ago) by root
Branch: MAIN
CVS Tags: rel-2_82, rel-2_81, rel-2_80, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, rel-2_52, rel-2_53, rel-2_90, rel-2_92, rel-2_78, rel-2_61, rel-2_43, rel-2_42, rel-2_41
Changes since 1.1: +5 -1 lines
Log Message:
work around perl 5.8 bug

File Contents

# Content
1 #! perl # mandatory depends=widget
2
3 sub settings_page {
4 my ($ns) = @_;
5 my $pl = $ns->pl;
6
7 my $ws = $ns->{ws_settings} = $ns->new_widgetset;
8
9 cf::weaken $ws;
10
11 # I hope not doing range checking is ok here...
12 $ws->template (face => (cf::face::find "res/ui/pl_settings_page"),
13 [
14 page => { },
15
16 title => { text => $pl->own_title },
17 info => { text => $pl->{user_info} },
18 info_save => {
19 on_activate => sub {
20 $pl; # work around leaking $pl otherwise, 5.8 at least
21
22 $ws->{title}->get (text => sub {
23 $pl->statusmsg ("new title has been saved");
24 $pl->own_title ($_[0]);
25 });
26 $ws->{info}->get (text => sub {
27 $pl->statusmsg ("new character info text has been saved");
28 $pl->{user_info} = $_[0];
29 });
30 },
31 },
32
33 applymode => { value => $pl->unapply , on_changed => sub { $pl->unapply ($_[1]) } },
34 bowmode => { value => $pl->bowtype , on_changed => sub { $pl->bowtype ($_[1]) } },
35 petmode => { value => $pl->petmode , on_changed => sub { $pl->petmode ($_[1]) } },
36 hintmode => { value => $pl->hintmode , on_changed => sub { $pl->hintmode ($_[1]) } },
37 usekeys => { value => $pl->usekeys , on_changed => sub { $pl->usekeys ($_[1]) } },
38 ],
39 sub {
40 $ws->find ("pl_notebook")->add ($ws->{page});
41 },
42 );
43 }
44
45 cf::player->attach (
46 on_login => sub {
47 my ($pl) = @_;
48
49 my $ns = $pl->ns;
50 return unless $ns->{can_widget};
51
52 settings_page $ns;
53 },
54 );
55