… | |
… | |
3 | sub settings_page { |
3 | sub settings_page { |
4 | my ($ns) = @_; |
4 | my ($ns) = @_; |
5 | my $pl = $ns->pl; |
5 | my $pl = $ns->pl; |
6 | |
6 | |
7 | my $ws = $ns->{ws_settings} = $ns->new_widgetset; |
7 | my $ws = $ns->{ws_settings} = $ns->new_widgetset; |
|
|
8 | |
|
|
9 | cf::weaken $ws; |
8 | |
10 | |
9 | # I hope not doing range checking is ok here... |
11 | # I hope not doing range checking is ok here... |
10 | $ws->template (face => (cf::face::find "res/ui/pl_settings_page"), |
12 | $ws->template (face => (cf::face::find "res/ui/pl_settings_page"), |
11 | [ |
13 | [ |
12 | page => { }, |
14 | page => { }, |
13 | |
15 | |
14 | title => { text => $pl->own_title }, |
16 | title => { text => $pl->own_title }, |
15 | info => { text => $pl->{user_info} }, |
17 | info => { text => $pl->{user_info} }, |
16 | info_save => { |
18 | info_save => { |
17 | on_activate => sub { |
19 | on_activate => sub { |
|
|
20 | $pl; # work around leaking $pl otherwise, 5.8 at least |
|
|
21 | |
18 | $ws->{title}->get (text => sub { |
22 | $ws->{title}->get (text => sub { |
19 | $pl->statusmsg ("new title has been saved"); |
23 | $pl->statusmsg ("new title has been saved"); |
20 | $pl->own_title ($_[0]); |
24 | $pl->own_title ($_[0]); |
21 | }); |
25 | }); |
22 | $ws->{info}->get (text => sub { |
26 | $ws->{info}->get (text => sub { |
… | |
… | |
32 | hintmode => { value => $pl->hintmode , on_changed => sub { $pl->hintmode ($_[1]) } }, |
36 | hintmode => { value => $pl->hintmode , on_changed => sub { $pl->hintmode ($_[1]) } }, |
33 | usekeys => { value => $pl->usekeys , on_changed => sub { $pl->usekeys ($_[1]) } }, |
37 | usekeys => { value => $pl->usekeys , on_changed => sub { $pl->usekeys ($_[1]) } }, |
34 | ], |
38 | ], |
35 | sub { |
39 | sub { |
36 | $ws->find ("pl_notebook")->add ($ws->{page}); |
40 | $ws->find ("pl_notebook")->add ($ws->{page}); |
37 | } |
41 | }, |
38 | ); |
42 | ); |
39 | } |
43 | } |
40 | |
44 | |
41 | cf::player->attach ( |
45 | cf::player->attach ( |
42 | on_login => sub { |
46 | on_login => sub { |