From: Andrew Ruthven Date: Thu, 2 Oct 2008 07:31:25 +0000 (+1300) Subject: Add a plugin that regularly generates notifications. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9cd933c80d09c500b795594a128e8a11c1bbd6f;p=picture-display.git Add a plugin that regularly generates notifications. --- diff --git a/lib/Display/Plugins/NotifyTest.pm b/lib/Display/Plugins/NotifyTest.pm new file mode 100644 index 0000000..95660ad --- /dev/null +++ b/lib/Display/Plugins/NotifyTest.pm @@ -0,0 +1,39 @@ +package Display::Plugins::NotifyTest; + +# Regularly generic notifications for testing code. + +use Clutter; +use POE::Session; +use base ('Display::Plugins'); +use strict; + +my $delay = 5; + +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + + my $self = $class->SUPER::new(@_); + + $self->{'count'} = 0; + + bless ($self, $class); + $self->{'kernel'}->state('notifytest_display', $self, 'display'); + $self->init_delay($delay, 'notifytest_display'); + $self->{'kernel'}->yield('notifytest_display'); + return $self; +} + +sub display { + my ($self, $kernel) = @_[OBJECT, KERNEL]; + + my $text = Clutter::Label->new('Sans 20', "Notify " . ++$self->{'count'}); + $text->set_color(Clutter::Color->parse('White')); + $text->set_ellipsize('end'); + + $kernel->yield('notifications_add', $text); + + $self->delay(); +} + +1;