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");
$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;
$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 {