File Coverage

blib/lib/Gtk2/Ex/TreeModelFilter/Draggable.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             # Copyright 2008, 2009, 2010 Kevin Ryde
2              
3             # This file is part of Gtk2-Ex-TreeModelFilter-DragDest.
4             #
5             # Gtk2-Ex-TreeModelFilter-DragDest is free software; you can redistribute it
6             # and/or modify it under the terms of the GNU General Public License as
7             # published by the Free Software Foundation; either version 3, or (at your
8             # option) any later version.
9             #
10             # Gtk2-Ex-TreeModelFilter-DragDest is distributed in the hope that it will
11             # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13             # Public License for more details.
14             #
15             # You should have received a copy of the GNU General Public License along
16             # with Gtk2-Ex-TreeModelFilter-DragDest. If not, see
17             # .
18              
19              
20             package Gtk2::Ex::TreeModelFilter::Draggable;
21 1     1   903 use 5.008;
  1         4  
  1         47  
22 1     1   6 use strict;
  1         1  
  1         31  
23 1     1   6 use warnings;
  1         5  
  1         31  
24 1     1   1540 use Gtk2;
  0            
  0            
25             use Carp;
26              
27             our $VERSION = 3;
28             our @ISA;
29              
30             BEGIN {
31             # The only extra thing "use Glib::Object::Subclass" does is unshift itself
32             # onto @ISA to give precedence a Glib::Object::new() over the specific
33             # superclass new(), but that's not needed since have new() below.
34             #
35             my @args;
36             if (! Gtk2::TreeModelFilter->can('Gtk2::TreeDragDest')) {
37             require Gtk2::Ex::TreeModelFilter::DragDest;
38             push @ISA, 'Gtk2::Ex::TreeModelFilter::DragDest';
39             @args = (interfaces => [ 'Gtk2::TreeDragDest' ]);
40             }
41             Glib::Type->register_object ('Gtk2::TreeModelFilter', __PACKAGE__, @args);
42              
43             }
44              
45             sub new {
46             my ($class, $child_model, $virtual_root) = @_;
47             (@_ >= 2 && @_ <= 3)
48             or croak "Usage: $class->new(\$child_model [, \$virtual_root])";
49              
50             return $class->Glib::Object::new (child_model => $child_model,
51             virtual_root => $virtual_root);
52             }
53              
54             1;
55             __END__