diff options
Diffstat (limited to 'perl-install/mygtk2.pm')
-rw-r--r-- | perl-install/mygtk2.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 6569c3180..f9985db77 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -275,7 +275,11 @@ sub _gtk__Pixbuf { if (!$w) { my $name = delete $opts->{file} or internal_error("missing file"); my $file = _find_imgfile($name) or internal_error("can not find image $name"); - $w = Gtk2::Gdk::Pixbuf->new_from_file($file); + if (my $size = delete $opts->{size}) { + $w = Gtk2::Gdk::Pixbuf->new_from_file_at_scale($file, $size, $size, 1); + } else { + $w = Gtk2::Gdk::Pixbuf->new_from_file($file); + } } $w; } @@ -294,18 +298,23 @@ sub _gtk__Image { my $pixmap = mygtk2::pixmap_from_pixbuf($w, gtknew('Pixbuf', file => $file)); $w->set_from_pixmap($pixmap, undef); } : sub { - my ($w, $file) = @_; - $w->set_from_file($file); + my ($w, $file, $o_size) = @_; + if ($o_size) { + my $pixbuf = gtknew('Pixbuf', file => $file, size => $o_size); + $w->set_from_pixbuf($pixbuf); + } else { + $w->set_from_file($file); + } }; } if (my $name = delete $opts->{file}) { my $file = _find_imgfile(may_apply($w->{format}, $name)) or internal_error("can not find image $name"); - $w->{set_from_file}->($w, $file); + $w->{set_from_file}->($w, $file, delete $opts->{size}); } elsif (my $file_ref = delete $opts->{file_ref}) { my $set = sub { my $file = _find_imgfile(may_apply($w->{format}, $$file_ref)) or internal_error("can not find image $$file_ref"); - $w->{set_from_file}->($w, $file); + $w->{set_from_file}->($w, $file, delete $opts->{size}); }; gtkval_register($w, $file_ref, $set); $set->() if $$file_ref; |