]> git.etc.gen.nz Git - picture-display.git/commitdiff
Switch to use correct method for checking if we're connected. poe-component-client-mpd
authorAndrew Ruthven <puck@catalyst.net.nz>
Mon, 22 Sep 2008 23:11:57 +0000 (11:11 +1200)
committerAndrew Ruthven <puck@dirk.wgtn.cat-it.co.nz>
Mon, 22 Sep 2008 23:11:57 +0000 (11:11 +1200)
lib/Display/Plugins/MPD.pm
picture.pl

index be47da18e15ace782b2ccc45e25ebbe6616e8aaf..6015a544b3c4ff8d7d669098b0afac8d12b5784d 100644 (file)
@@ -79,12 +79,13 @@ sub error {
 sub init {
   my $self = shift;
 
+  $self->{'kernel'}->state('mpd_connected', $self, 'connected');
   $self->{'kernel'}->state('mpd_result', $self, 'display');
   $self->{'kernel'}->state('mpd_error', $self, 'error');
   $self->{'kernel'}->state('mpd_hide_display', $self, 'hide_display');
   POE::Component::Client::MPD->new( {
     alias => 'mpd',
-    status_msgs_to => 'mpd_status_msgs',
+    status_msgs_to => 'display',
   } );
 
   $self->{'status'} = Clutter::Label->new('Sans 20', "Song\nAlbum");
@@ -95,14 +96,10 @@ sub init {
   $self->{'bg'}->set_opacity(100);
 }
 
-sub mpd_status_msgs {
-  my ($kernel, $arg) = @_[KERNEL, ARG0];
+sub connected {
+  my ($self, $kernel) = @_[OBJECT, KERNEL];
 
-  if ($arg eq 'mpd_connected') {
-    $self->{'kernel'}->post( 'mpd', 'current' );
-  } else {
-    warn "Failed to connected to MPD.  What now?\n";
-  }
+  $kernel->post( 'mpd', 'current' );
 }
 
 1;
index a51ba80295fd7bbf800e7275bca3b8fd2511fa9b..abd397af796a4274e09c3c0cfeb1dd1dc9e1058f 100755 (executable)
@@ -33,6 +33,8 @@ sub start {
   $stage->set_color(Clutter::Color->parse('Black'));
   $stage->signal_connect('key-press-event' => sub { Clutter->main_quit() });
 
+  $kernel->alias_set('display');
+
   if ($full_screen) {
     $stage->fullscreen;
   } else {