]> git.etc.gen.nz Git - picture-display.git/commitdiff
Make it work!
authorAndrew Ruthven <puck@catalyst.net.nz>
Wed, 17 Sep 2008 02:01:55 +0000 (14:01 +1200)
committerAndrew Ruthven <puck@dirk.wgtn.cat-it.co.nz>
Wed, 17 Sep 2008 02:01:55 +0000 (14:01 +1200)
lib/Display/Plugins/FSpot.pm
picture.pl

index f20cf7d9938d832ba92eed3fc0f3db6d484544f5..44468468deff13aefe42737f015fdf690be06b0d 100644 (file)
@@ -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;
index 0656199e5f606f93b98f6e2711829d9bda8089b9..fc8a6328ae437c20ea46d08d4aaa3fafce98fb5b 100755 (executable)
@@ -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 {