{
$Gapp::Assistant::VERSION
=
'0.494'
;
}
has
'+gclass'
=> (
default
=>
'Gtk2::Assistant'
,
);
has
'forward_page_func'
=> (
is
=>
'rw'
,
isa
=> GappActionOrArrayRef|Undef,
);
sub
current_page {
my
(
$self
) =
@_
;
my
@pages
=
$self
->children;
my
$num
=
$self
->gobject->get_current_page;
for
my
$page
(
@pages
) {
return
$page
if
$page
->page_num ==
$num
;
}
}
sub
find_page {
my
(
$self
,
$page_name
) =
@_
;
if
( !
defined
$page_name
||
$page_name
eq
''
) {
$self
->meta->throw_errow(
qq[you did not supply a page name,\n]
.
qq[usage: Gapp::Assistant::find_page( $self, $page_name )]
);
return
;
}
for
my
$page
(
$self
->children ) {
return
$page
if
$page
->name eq
$page_name
;
}
}
sub
set_current_page {
my
(
$self
,
$page_name
) =
@_
;
if
( !
defined
$page_name
) {
$self
->meta->throw_errow(
qq[you did not supply a page name,\n]
.
qq[usage: Gapp::Assistant::find_page( $self, $page_name )]
);
return
;
}
for
my
$page
(
$self
->children ) {
if
(
$page
->page_name eq
$page_name
) {
$self
->gobject->set_current_page(
$page
->num );
}
}
}
sub
BUILD {
my
$self
=
shift
;
$self
->signal_connect(
'prepare'
=>
sub
{
my
(
$self
) =
@_
;
my
$page
=
$self
->current_page;
$page
->validate
if
$page
->validator;
},
$self
);
}
1;