| 1 | package Gapp::Actions::Basic; | ||
| 2 | { | ||
| 3 | $Gapp::Actions::Basic::VERSION = '0.60'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use Gapp::Actions -declare => [qw( | ||
| 7 | HideWindow | ||
| 8 | DestroyWindow | ||
| 9 | Quit | ||
| 10 | )]; | ||
| 11 | |||
| 12 | |||
| 13 | use Gtk2; | ||
| 14 | |||
| 15 | action HideWindow => ( | ||
| 16 | label => 'Hide', | ||
| 17 | tooltip => 'Hide', | ||
| 18 | code => sub { | ||
| 19 | my ( $action, $widget, $args, $gtkw, $gtkargs ) = @_; | ||
| 20 | $gtkw->hide; | ||
| 21 | return 1; | ||
| 22 | } | ||
| 23 | ); | ||
| 24 | |||
| 25 | action DestroyWindow => ( | ||
| 26 | label => 'Close', | ||
| 27 | tooltip => 'Close', | ||
| 28 | icon => 'gtk-cancel', | ||
| 29 | code => sub { | ||
| 30 | my ( $action, $widget, $args, $gtkw, $gtkargs ) = @_; | ||
| 31 | $gtkw->destroy; | ||
| 32 | } | ||
| 33 | ); | ||
| 34 | |||
| 35 | action Quit => ( | ||
| 36 | label => 'Quit', | ||
| 37 | tooltip => 'Quit', | ||
| 38 | icon => 'gtk-quit', | ||
| 39 | code => sub { | ||
| 40 | Gtk2->main_quit; | ||
| 41 | } | ||
| 42 | ); | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | 1; |