Changeset 448

Show
Ignore:
Timestamp:
12/24/07 00:11:07 (5 years ago)
Author:
jeffrey
Message:

fix unhandled exception

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plgtkimageview/examples/interactive.pl

    r447 r448  
    11#!/usr/bin/perl -w 
     2 
     3# Copyright (c) 2007 by Muppet <scott@asofyet.org> 
     4# based on the original gtkimageview/tests/interactive.c 
     5# 
     6# This library is free software; you can redistribute it and/or 
     7# modify it under the terms of the GNU Library General Public 
     8# License as published by the Free Software Foundation; either 
     9# version 3 of the License, or (at your option) any later version. 
     10# 
     11# This library is distributed in the hope that it will be useful, 
     12# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     14# Library General Public License for more details. 
     15# 
     16# You should have received a copy of the GNU General Public License 
     17# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     18 
    219# -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*- 
    320# vim: set expandtab softtabstop=4 shiftwidth=4 : 
     
    7289        # Only active the transform_group if the loaded object is a single 
    7390        # image -- transformations cannot be applied to animations. 
    74         $transform_group->set_sensitive ($anim->is_static_image ()); 
     91        $transform_group->set_sensitive ($anim->is_static_image); 
    7592    }; 
    7693    if ($@) { 
     
    8299    my $r = shift; 
    83100    sprintf "(%d, %d)-[%d, %d]", $r->x, $r->y, $r->width, $r->height; 
     101} 
     102 
     103sub get_enum_nick { 
     104    my ($package, $value) = @_; 
     105    my @v = Glib::Type->list_values ($package); 
     106    return $v[$value]{nick}; 
    84107} 
    85108 
     
    88111    my @v = Glib::Type->list_values ($package); 
    89112    for (my $i = 0 ; $i < @v ; $i++) { 
    90         use Data::Dumper; 
    91         print Dumper($v[$i]); 
    92113        return $i if $v[$i]{name} eq $string or $v[$i]{nick} eq $string; 
    93114    } 
     
    200221    my ($action, $current) = @_; 
    201222    my $color = 0; 
    202     my $transp = $current->get_current_value ()
     223    my $transp = $current->get_current_value
    203224    if ($transp == GTK_IMAGE_TRANSP_COLOR) { 
    204225        $color = 0x000000; 
    205226    } 
    206     $view->set_transp ($transp, $color); 
     227    $view->set_transp (get_enum_nick('Gtk2::ImageTransp', $transp), $color); 
    207228} 
    208229 
     
    496517 
    497518    # Transform group 
    498     my $transform_group = Gtk2::ActionGroup->new ("transform"); 
     519    $transform_group = Gtk2::ActionGroup->new ("transform"); 
    499520    if ($transform_group) { 
    500521        $transform_group->add_actions (\@transform_actions);