| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use FFI::CheckLib; |
| 4 |
use FFI::Platypus 2.00; |
| 5 |
|
| 6 |
my $ffi = FFI::Platypus->new( |
| 7 |
api => 2, |
| 8 |
lib => find_lib_or_die(lib => 'notify'), |
| 9 |
); |
| 10 |
|
| 11 |
$ffi->attach( notify_init => ['string'] ); |
| 12 |
$ffi->attach( notify_uninit => [] ); |
| 13 |
$ffi->attach( notify_notification_new => ['string', 'string', 'string'] => 'opaque' ); |
| 14 |
$ffi->attach( notify_notification_show => ['opaque', 'opaque'] ); |
| 15 |
|
| 16 |
my $message = join "\n", |
| 17 |
"Hello from Platypus!", |
| 18 |
"Welcome to the fun", |
| 19 |
"world of FFI"; |
| 20 |
|
| 21 |
notify_init('Platypus Hello'); |
| 22 |
my $n = notify_notification_new('Platypus Hello World', $message, 'dialog-information'); |
| 23 |
notify_notification_show($n, undef); |
| 24 |
notify_uninit(); |