return $self;
}
+sub init_delay {
+ my ($self, $delay, $event) = @_;
+
+ $self->{'_next_check'} = time();
+ $self->{'_next_delay'} = $delay;
+ $self->{'_next_event'} = $event;
+}
+
+sub delay {
+ my $self = shift;
+
+ $self->{'_next_check'} += $self->{'_next_delay'};
+
+ $self->{'kernel'}->alarm( $self->{'_next_event'} => $self->{'_next_check'} );
+}
+
1;
$self->{'last_file'} = '';
bless ($self, $class);
+ $self->init_delay($delay, 'fspot_display');
$self->init();
return $self;
}
}
$self->{'last_file'} = $file;
- $self->{'kernel'}->delay(fspot_display, $delay);
+ $self->delay();
}
sub fade_in {
use base ('Display::Plugin');
use strict;
+my $delay = 5;
+
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
$self->{'active'} = 0;
bless ($self, $class);
+ $self->init_delay($delay, 'mpd_display');
$self->init();
return $self;
}
$kernel->yield('notifications_add', $self->{'status'});
}
- $kernel->delay('mpd_display', 5);
+ $self->delay();
}
sub init {
$self->{'status'}->set_color(Clutter::Color->parse('White'));
$self->{'status'}->set_ellipsize('end');
- $self->{'kernel'}->delay('mpd_display', 5);
+ $self->{'kernel'}->yield('mpd_display');
}
1;