From d9a96d36ea5755b84706484f7fa07fd20bae7df5 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 23 Sep 2008 11:11:57 +1200 Subject: [PATCH] Switch to use correct method for checking if we're connected. --- lib/Display/Plugins/MPD.pm | 13 +++++-------- picture.pl | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Display/Plugins/MPD.pm b/lib/Display/Plugins/MPD.pm index be47da1..6015a54 100644 --- a/lib/Display/Plugins/MPD.pm +++ b/lib/Display/Plugins/MPD.pm @@ -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; diff --git a/picture.pl b/picture.pl index a51ba80..abd397a 100755 --- a/picture.pl +++ b/picture.pl @@ -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 { -- 2.30.2