1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | use Cwd (); |
3 | use Cwd (); |
4 | use Encode (); |
4 | use Encode (); |
|
|
5 | use File::Glob (); |
5 | |
6 | |
6 | use Gtk2 -init; |
7 | use Gtk2 -init; |
7 | use Gtk2::Gdk::Keysyms; |
8 | use Gtk2::Gdk::Keysyms; |
8 | |
9 | |
9 | use Gtk2::CV; |
10 | use Gtk2::CV; |
… | |
… | |
115 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) { |
116 | } elsif ($ctrl && $key == $Gtk2::Gdk::Keysyms{h}) { |
116 | unless ($help) { |
117 | unless ($help) { |
117 | require Gtk2::PodViewer; |
118 | require Gtk2::PodViewer; |
118 | |
119 | |
119 | $help = new Gtk2::Window; |
120 | $help = new Gtk2::Window; |
120 | $w->set_role ("help"); |
121 | $help->set_role ("help"); |
121 | $help->set_title ("CV: Help"); |
122 | $help->set_title ("CV: Help"); |
122 | $help->set_default_size (500, 300); |
123 | $help->set_default_size (500, 300); |
123 | $help->signal_connect (delete_event => sub { $help->hide; 1 }); |
124 | $help->signal_connect (delete_event => sub { $help->hide; 1 }); |
124 | |
125 | |
125 | $help->add (my $sw = new Gtk2::ScrolledWindow); |
126 | $help->add (my $sw = new Gtk2::ScrolledWindow); |
… | |
… | |
160 | |
161 | |
161 | $schnauzer->set_geometry_hints; |
162 | $schnauzer->set_geometry_hints; |
162 | } |
163 | } |
163 | |
164 | |
164 | if (@ARGV) { |
165 | if (@ARGV) { |
165 | @ARGV == 1 && -d $ARGV[0] |
166 | my $show_first = sub { |
166 | ? $schnauzer->set_dir (Glib::filename_to_unicode shift) |
|
|
167 | : $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV], 1); |
|
|
168 | $schnauzer->show_all; |
167 | $schnauzer->show_all; |
169 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
168 | $schnauzer->handle_key ($Gtk2::Gdk::Keysyms{space}, []); |
|
|
169 | $viewer->show_all; |
|
|
170 | }; |
|
|
171 | |
|
|
172 | if (@ARGV == 1 && $ARGV[0] eq "-0r") { |
|
|
173 | local $/; |
|
|
174 | $schnauzer->set_paths ([map Glib::filename_to_unicode $_, split /\x00/, <STDIN>], 1, $show_first); |
|
|
175 | } elsif (@ARGV == 1 && -d $ARGV[0]) { |
|
|
176 | $schnauzer->set_dir (Glib::filename_to_unicode shift, $show_first); |
|
|
177 | } else { |
|
|
178 | if ($ARGV[0] eq "-g") { |
|
|
179 | shift @ARGV; |
|
|
180 | @ARGV = map +(File::Glob::bsd_glob $_, File::Glob::GLOB_BRACE | File::Glob::GLOB_QUOTE), @ARGV; |
|
|
181 | } |
|
|
182 | $schnauzer->set_paths ([map Glib::filename_to_unicode $_, @ARGV], 1, $show_first); |
|
|
183 | } |
170 | } else { |
184 | } else { |
171 | $schnauzer->set_dir (File::Spec->curdir); |
185 | $schnauzer->set_dir (File::Spec->curdir, sub { |
172 | $mainwin->show_all; |
186 | $mainwin->show_all; |
173 | } |
|
|
174 | |
|
|
175 | $viewer->show_all; |
187 | $viewer->show_all; |
|
|
188 | }); |
|
|
189 | } |
176 | |
190 | |
177 | main Gtk2; |
191 | main Gtk2; |
|
|
192 | |
|
|
193 | Gtk2::CV::flush_aio; |
178 | |
194 | |
179 | __DATA__ |
195 | __DATA__ |
180 | |
196 | |
181 | =encoding utf-8 |
197 | =encoding utf-8 |
182 | |
198 | |
… | |
… | |
422 | =item CV_EDITOR |
438 | =item CV_EDITOR |
423 | |
439 | |
424 | The program that gets executed when the user presses C<CTRL-e> in the |
440 | The program that gets executed when the user presses C<CTRL-e> in the |
425 | Schnauzer or image window. The default is C<gimp>. |
441 | Schnauzer or image window. The default is C<gimp>. |
426 | |
442 | |
|
|
443 | =item CV_AUDIO_PLAYER |
|
|
444 | |
|
|
445 | Program used to play all sorts of audio (wav, aif, mp3, ogg...), default "play". |
|
|
446 | Will be called like C<< $CV_AUDIO_PLAYER -- <path> >>. |
|
|
447 | |
427 | =item CV_PRINT_DESTINATION |
448 | =item CV_PRINT_DESTINATION |
428 | |
449 | |
429 | The default (perl-style) destination to use in the print dialog. |
450 | The default (perl-style) destination to use in the print dialog. |
430 | |
451 | |
431 | =item CV_TRASHCAN |
452 | =item CV_TRASHCAN |