Skip to content
Browse files

init Gtk2::Notify every time before showing notifies

xfce4-notifyd exits after 10 minutes of inactivity on my xubuntu.
As a result metacpan_notify.pl dies when trying to show notifies.
With this change xfce4-notifyd will be started again every time
if it is not running.
  • Loading branch information...
1 parent b6ccc30 commit 0dfdbf1325c7807ee5f42e8ae01be8749b5d7710 @trinitum committed Apr 7, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/App/MetaCPAN/Gtk2/Notify.pm
View
4 lib/App/MetaCPAN/Gtk2/Notify.pm
@@ -7,7 +7,7 @@ our $VERSION = '0.03';
use JSON;
use LWP::UserAgent;
-use Gtk2::Notify -init => 'MetaCPAN_recent';
+use Gtk2::Notify;
use File::Temp ();
use File::Spec;
use File::Slurp qw(write_file);
@@ -87,13 +87,15 @@ sub show_recent {
# skip notifying on a first run
if (%prev_id) {
+ Gtk2::Notify->init('MetaCPAN_recent');
for ( reverse @$recent ) {
next if $prev_id{ $_->{id} };
my ( $auth_name, $avatar ) = @{ get_author( $_->{author} ) };
my $url = "https://metacpan.org/release/$_->{author}/$_->{name}";
Gtk2::Notify->new( "$auth_name ($_->{author})", "uploaded <a href='$url'>$_->{name}</a>", $avatar || () )
->show;
}
+ Gtk2::Notify->uninit;
}
%prev_id = map { $_ => 1 } map { $_->{id} } @$recent;
}

0 comments on commit 0dfdbf1

Please sign in to comment.
Something went wrong with that request. Please try again.