]> git.etc.gen.nz Git - picture-display.git/commitdiff
Add more functionality and make it more robust.
authorAndrew Ruthven <andrew@etc.gen.nz>
Wed, 17 Sep 2008 10:52:41 +0000 (22:52 +1200)
committerAndrew Ruthven <andrew@etc.gen.nz>
Wed, 17 Sep 2008 10:52:41 +0000 (22:52 +1200)
lib/Display/Plugins/FSpot.pm
picture.pl

index 44468468deff13aefe42737f015fdf690be06b0d..941c5da332aac30a02f26d1af554b114032e5ac8 100644 (file)
@@ -19,6 +19,20 @@ sub new {
 
 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);
@@ -31,7 +45,6 @@ sub display {
     || die "Failed to finish statement: $DBI::errstr\n";;
 
   $uri =~ s|^file://||;
-  $self->{'picture'}->set_from_file($uri);
 
   return $uri;
 }
@@ -57,8 +70,8 @@ LIMIT 1
 
   $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'});
 }
index fc8a6328ae437c20ea46d08d4aaa3fafce98fb5b..0a135c15802dd56772a6d9491f05744168f8fec7 100755 (executable)
@@ -36,6 +36,7 @@ sub update_screen {
   for my $module (@modules) {
     $module->display();
   }
+  Glib::Timeout->add_seconds(30, \&update_screen);
 }
 
 sub loadModules {