blib/lib/Applications/FileQuickFind.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 71 CC 3 SCAR 11.5
CC
3
Cov
0%
import
6.0
run
6.0
INIT_INSTANCE
2.0
CRAP 3.1
1 package Applications::FileQuickFind;
2 use strict;
3 use warnings;
4  
5 use Gtk2;
6 use Glib qw(TRUE FALSE);
7 use Cwd;
8  
9 use Gtk2::Ex::FileLocator;
10  
11 use Glib::Object::Subclass
12 Gtk2::Window::,
13 ;
14  
15 sub import {
16 my $class = shift;
17 my $run = 0;
18 foreach (@_) {
19 if (/^-?run$/) {
20 $class->run(@ARGV);
21 last;
22 }
23 }
24 }
25  
26 sub run {
27 Gtk2->init;
28 my ( $class, $filename ) = @_;
29 my $this = $class->new;
30 $this->show;
31 $this->present;
32 $this->set_uri(sprintf "file://%s", Cwd::abs_path($filename)) if $filename;
33 Gtk2->main;
34 return;
35 }
36  
37 sub INIT_INSTANCE {
38 my ( $this, $filename ) = @_;
39  
40 $this->set_title('File QuickFind');
41 $this->set_position('GTK_WIN_POS_MOUSE');
42 $this->set_default_size( 300, -1 );
43 #$this->set_size_request( 300, -1 );
44  
45 $this->{fileLocator} = new Gtk2::Ex::FileLocator;
46 $this->{fileLocator}->show;
47  
48 $this->add( $this->{fileLocator} );
49  
50 $this->signal_connect( delete_event => sub { Gtk2->main_quit } );
51 }
52  
53 sub set_uri {
54 my ( $this, $uri ) = @_;
55 $this->{fileLocator}->set_uri($uri);
56 return;
57 }
58  
59 sub show {
60 my ( $this, $filename ) = @_;
61 $this->show_all;
62 }
63  
64 1;
65 __END__