From 2197ce0b51d8452a4df93efb548737c8139f80ce Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Wed, 17 Sep 2008 14:01:55 +1200 Subject: [PATCH] Make it work! --- lib/Display/Plugins/FSpot.pm | 8 ++++++-- picture.pl | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/Display/Plugins/FSpot.pm b/lib/Display/Plugins/FSpot.pm index f20cf7d..4446846 100644 --- a/lib/Display/Plugins/FSpot.pm +++ b/lib/Display/Plugins/FSpot.pm @@ -30,7 +30,8 @@ sub display { $self->{'sth'}->finish() || die "Failed to finish statement: $DBI::errstr\n";; - $self->set_from_file($uri); + $uri =~ s|^file://||; + $self->{'picture'}->set_from_file($uri); return $uri; } @@ -55,8 +56,11 @@ LIMIT 1 || die "Failed to prepare statement: $DBI::errstr\n"; $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->display(); - $self->{'stage'}->add($self->{'picture'}; + $self->{'stage'}->add($self->{'picture'}); } 1; diff --git a/picture.pl b/picture.pl index 0656199..fc8a632 100755 --- a/picture.pl +++ b/picture.pl @@ -3,7 +3,7 @@ use strict; use FindBin; use Module::Pluggable search_path => ['Display::Plugins']; -use Cluter qw( :init ); +use Clutter qw( :init ); use Getopt::Long; use lib "$FindBin::Bin/lib"; @@ -11,11 +11,9 @@ use lib "$FindBin::Bin/lib"; my $full_screen = 1; GetOptions( - '!full|f' => \$full_screen, + 'full|f!' => \$full_screen, ); -my @modules = loadModules(); - my $stage = Clutter::Stage->get_default(); $stage->set_color(Clutter::Color->parse('Black')); $stage->signal_connect('key-press-event' => sub { Clutter->main_quit() }); @@ -26,8 +24,18 @@ if ($full_screen) { $stage->set_size(800, 600); } -for my $module (@modules) { - print $module->display() . "\n"; +my @modules = loadModules(); + +$stage->show_all(); + +Glib::Timeout->add_seconds(30, \&update_screen); + +Clutter->main(); + +sub update_screen { + for my $module (@modules) { + $module->display(); + } } sub loadModules { -- 2.30.2