From: Andrew Ruthven Date: Wed, 17 Sep 2008 01:08:28 +0000 (+1200) Subject: The start of adding Clutter support. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22313df9e1473411771b474133105df17726b89c;p=picture-display.git The start of adding Clutter support. --- diff --git a/lib/Display/Plugins/FSpot.pm b/lib/Display/Plugins/FSpot.pm index 393e84c..f20cf7d 100644 --- a/lib/Display/Plugins/FSpot.pm +++ b/lib/Display/Plugins/FSpot.pm @@ -1,13 +1,16 @@ package Display::Plugins::FSpot; use DBI; +use Clutter; my $f_spot_db = "/home/andrew/.gnome2/f-spot/photos.db"; sub new { - my ($class,$instance) = @_; + my ($class,$stage) = @_; - my $self = {}; + my $self = { + 'stage' => $stage + }; bless ($self, $class); $self->init(); @@ -27,6 +30,8 @@ sub display { $self->{'sth'}->finish() || die "Failed to finish statement: $DBI::errstr\n";; + $self->set_from_file($uri); + return $uri; } @@ -48,6 +53,10 @@ LIMIT 1 $self->{'sth'} = $self->{'dbh'}->prepare($sql) || die "Failed to prepare statement: $DBI::errstr\n"; + + $self->{'picture'} = Clutter::Texture->new(); + $self->display(); + $self->{'stage'}->add($self->{'picture'}; } 1; diff --git a/picture.pl b/picture.pl index 82eae6c..0656199 100755 --- a/picture.pl +++ b/picture.pl @@ -3,11 +3,29 @@ use strict; use FindBin; use Module::Pluggable search_path => ['Display::Plugins']; +use Cluter qw( :init ); +use Getopt::Long; use lib "$FindBin::Bin/lib"; +my $full_screen = 1; + +GetOptions( + '!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() }); + +if ($full_screen) { + $stage->fullscreen; +} else { + $stage->set_size(800, 600); +} + for my $module (@modules) { print $module->display() . "\n"; } @@ -22,7 +40,7 @@ sub loadModules { die "Failed to load plugin: $module ($@)\n"; } - push @modules, $module->new(); + push @modules, $module->new($stage); } return @modules;