sub display {
my $self = shift;
+ my $file;
+
+ # Keep on looking until we find a file that exists.
+ do {
+ $file = $self->find_photo();
+ } until (-f $file);
+
+ $self->{'picture'}->set_from_file($file);
+
+ return $file;
+}
+
+sub find_photo {
+ my $self = shift;
my $uri;
$self->{'sth'}->bind_columns(\$uri);
|| die "Failed to finish statement: $DBI::errstr\n";;
$uri =~ s|^file://||;
- $self->{'picture'}->set_from_file($uri);
return $uri;
}
$self->{'picture'} = Clutter::Texture->new();
$self->{'picture'}->set_size($self->{'stage'}->get_size());
- $self->{'picture'}->{'keep-aspect-ratio'} = 1;
- $self->{'picture'}->{'sync-size'} = 1;
+ $self->{'picture'}->set('keep-aspect-ratio' => 1);
+ $self->{'picture'}->set('sync-size' => 1);
$self->display();
$self->{'stage'}->add($self->{'picture'});
}