| 1 |
root |
1.1 |
package Gtk2::CV; |
| 2 |
|
|
|
| 3 |
|
|
use XSLoader; |
| 4 |
|
|
|
| 5 |
root |
1.15 |
$VERSION = '0.5'; |
| 6 |
root |
1.3 |
|
| 7 |
|
|
XSLoader::load "Gtk2::CV", $VERSION; |
| 8 |
root |
1.1 |
|
| 9 |
root |
1.2 |
use Gtk2; |
| 10 |
root |
1.13 |
use Glib; |
| 11 |
|
|
|
| 12 |
root |
1.14 |
use IO::AIO; |
| 13 |
|
|
|
| 14 |
root |
1.17 |
my $aio_source; |
| 15 |
|
|
|
| 16 |
|
|
sub enable_aio { |
| 17 |
|
|
$aio_source ||= |
| 18 |
|
|
add_watch Glib::IO IO::AIO::poll_fileno, |
| 19 |
|
|
in => sub { IO::AIO::poll_cb; 1 }; |
| 20 |
|
|
} |
| 21 |
|
|
|
| 22 |
|
|
sub disable_aio { |
| 23 |
|
|
remove Glib::Source $aio_source; |
| 24 |
|
|
undef $aio_source; |
| 25 |
|
|
} |
| 26 |
|
|
|
| 27 |
|
|
enable_aio; |
| 28 |
root |
1.14 |
IO::AIO::max_outstanding 128; |
| 29 |
root |
1.2 |
|
| 30 |
root |
1.9 |
sub find_rcfile($) { |
| 31 |
root |
1.2 |
my $path; |
| 32 |
|
|
|
| 33 |
|
|
for (@INC) { |
| 34 |
root |
1.4 |
$path = "$_/Gtk2/CV/$_[0]"; |
| 35 |
|
|
return $path if -r $path; |
| 36 |
root |
1.2 |
} |
| 37 |
|
|
|
| 38 |
root |
1.4 |
die "FATAL: can't find required file $_[0]\n"; |
| 39 |
|
|
} |
| 40 |
|
|
|
| 41 |
root |
1.9 |
sub require_image($) { |
| 42 |
root |
1.4 |
new_from_file Gtk2::Gdk::Pixbuf find_rcfile "images/$_[0]"; |
| 43 |
root |
1.2 |
} |
| 44 |
|
|
|
| 45 |
root |
1.1 |
1; |
| 46 |
|
|
|