]> git.etc.gen.nz Git - picture-display.git/commitdiff
Add a plugin that regularly generates notifications.
authorAndrew Ruthven <andrew@etc.gen.nz>
Thu, 2 Oct 2008 07:31:25 +0000 (20:31 +1300)
committerAndrew Ruthven <andrew@etc.gen.nz>
Thu, 2 Oct 2008 21:19:36 +0000 (10:19 +1300)
lib/Display/Plugins/NotifyTest.pm [new file with mode: 0644]

diff --git a/lib/Display/Plugins/NotifyTest.pm b/lib/Display/Plugins/NotifyTest.pm
new file mode 100644 (file)
index 0000000..95660ad
--- /dev/null
@@ -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;