This file is indexed.

/usr/share/perl5/Desktop/Notify/Notification.pm is in libdesktop-notify-perl 0.03-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
package Desktop::Notify::Notification;

use strict;
use warnings;

use base qw/Class::Accessor/;

Desktop::Notify::Notification->mk_accessors(qw/summary body timeout/);

=head1 NAME

Desktop::Notify::Notification - a notification object for the desktop
notifications framework

=head1 VERSION

Version 0.03

=cut

our $VERSION = '0.03';

=head1 SYNOPSIS

    # $notify is an existing Desktop::Notify object
    my $note = $notify->create(summary => 'Rebuilding FooBar',
                               body => 'Progress: 10%');
    $note->show;
    
    ...
    
    # Update the notification later
    $note->body('Progress: 20%');
    $note->show;
    
    ...
    # Take it off the screen
    $note->close;


=head1 DESCRIPTION

Desktop notification objects are represented as objects of this class.  They
are created by a L<Desktop::Notify> object.  Displaying, closing, and modifying
the notification is done by using methods in this class.

=head1 METHODS

=head2 new $notify, %params

This is called internally by L<Desktop::Notify> to create a new notification
object.

=cut

sub new {
    my ($class, $server, %params) = @_;

    my $self = \%params;
    $self->{server} = $server;
    $self->{id} = undef;
    bless $self, $class;
}

=head2 show

Display the notification on the screen. If this notification had previously
been shown and not closed yet, it will replace the existing notification.

Show can be called multiple times on the same notification, probably with
attribute changes between calls, and later show calls will cause the server to seamlessly replace the existing notification.

=cut

sub show {
    my $self = shift;

    $self->{id} = $self->{server}->{notify}
        ->Notify($self->{server}->{app_name},
                 $self->{id} || 0,
                 '',
                 $self->{summary},
                 $self->{body},
                 [],
                 {},
                 $self->{timeout} || 0,
                );
    $self->{server}->_register_notification($self);
    return $self;
}

=head2 close

Close the notification if it is already being displayed.

=cut

sub close {
    my $self = shift;

    if (defined $self->{id})
    {
        $self->{server}->{notify}->CloseNotification($self->{id});
        delete $self->{id};
    } else
    {
        warn "Trying to close notification that has not been shown.";
    }
    return $self;
}

=head1 ATTRIBUTES

The following parameters can be set when creating the object or later modified
using accessors (descriptions are from the specification at
L<http://www.galago-project.org/specs/notification/0.9/x408.html>)

=over

=item summary

The summary text briefly describing the notification.

=item body

The optional detailed body text. Can be empty.

=item timeout

The timeout time in milliseconds since the display of the notification at which
the notification should automatically close.

If -1, the notification's expiration time is dependent on the notification
server's settings, and may vary for the type of notification. If 0, never
expire.

=back

The following extra parameters are included in the specification but not
supported by L<Desktop::Notify> at this time

=over

=item app_icon

The optional program icon of the calling application.

=item actions

Actions are sent over as a list of pairs. Each even element in the list
(starting at index 0) represents the identifier for the action. Each odd
element in the list is the localized string that will be displayed to the user.

=item hints

Optional hints that can be passed to the server from the client program.

=back

=cut

1;  # End of Desktop::Notify::Notification