1
###################################################
3
# Copyright (C) 2008, 2009 Mario Kemper <mario.kemper@googlemail.com> and Shutter Team
5
# This file is part of Shutter.
7
# Shutter is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
12
# Shutter is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with Shutter; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
###################################################
23
package Shutter::App::Notification;
26
#--------------------------------------
33
#Gettext and filename parsing
34
use POSIX qw/setlocale strftime/;
38
#--------------------------------------
39
use constant TRUE => 1;
40
use constant FALSE => 0;
42
#--------------------------------------
47
my $self = { _name => shift };
49
#Use notifications object
51
$self->{_notifications_service} = Net::DBus->session->get_service('org.freedesktop.Notifications');
52
$self->{_notifications_object} = $self->{_notifications_service}->get_object('/org/freedesktop/Notifications', 'org.freedesktop.Notifications');
55
print "Warning: $@", "\n";
69
my $nid = shift || $self->{_nid};
73
if(defined $self->{_notifications_object}){
74
$self->{_nid} = $self->{_notifications_object}->Notify('Shutter', $nid, "gtk-dialog-info", $summary, $body, [], {}, -1);
78
print "NotifyWarning: $@", "\n";
86
my $nid = shift || $self->{_nid};
91
if(defined $self->{_notifications_object}){
92
$self->{_notifications_object}->CloseNotification($nid);
96
print "CloseNotificationWarning: $@", "\n";