From b9cd933c80d09c500b795594a128e8a11c1bbd6f Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Thu, 2 Oct 2008 20:31:25 +1300 Subject: [PATCH] Add a plugin that regularly generates notifications. --- lib/Display/Plugins/NotifyTest.pm | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/Display/Plugins/NotifyTest.pm 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; -- 2.30.2