[perl-Gtk3] Fix test failures with gdk-pixbuf >= 2.31.2
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Fix test failures with gdk-pixbuf >= 2.31.2
- Date: Sat, 15 Nov 2014 18:40:30 +0000 (UTC)
commit 7873cfa9d6879bfd722521f5e738d8e8e55cc533
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Sat Nov 15 19:37:28 2014 +0100
Fix test failures with gdk-pixbuf >= 2.31.2
lib/Gtk3.pm | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index e182903..9eb81d8 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1422,8 +1422,12 @@ sub Gtk3::Gdk::Pixbuf::new_from_xpm_data {
$class, $real_data);
}
-# The next three subs might have to change when
-# <https://bugzilla.gnome.org/show_bug.cgi?id=670372> is accepted.
+# Version check for the new annotations described in
+# <https://bugzilla.gnome.org/show_bug.cgi?id=670372>.
+my $HAVE_GDK_PIXBUF_2_31_2 = sub {
+ return (Gtk3::Gdk::PIXBUF_MAJOR () == 2 && Gtk3::Gdk::PIXBUF_MINOR () > 31) ||
+ (Gtk3::Gdk::PIXBUF_MAJOR () == 2 && Gtk3::Gdk::PIXBUF_MINOR () == 31 && Gtk3::Gdk::PIXBUF_MICRO ()
= 2);
+};
sub Gtk3::Gdk::Pixbuf::save {
my ($pixbuf, $filename, $type, @rest) = @_;
@@ -1432,8 +1436,9 @@ sub Gtk3::Gdk::Pixbuf::save {
croak ("Usage: \$pixbuf->save (\$filename, \$type, \\\ keys, \\\ values)\n",
" -or-: \$pixbuf->save (\$filename, \$type, \$key1 => \$value1, ...)");
}
+ my $method = $HAVE_GDK_PIXBUF_2_31_2->() ? 'save' : 'savev';
Glib::Object::Introspection->invoke (
- $_GDK_PIXBUF_BASENAME, 'Pixbuf', 'savev',
+ $_GDK_PIXBUF_BASENAME, 'Pixbuf', $method,
$pixbuf, $filename, $type, $keys, $values);
}
@@ -1444,9 +1449,10 @@ sub Gtk3::Gdk::Pixbuf::save_to_buffer {
croak ("Usage: \$pixbuf->save_to_buffer (\$type, \\\ keys, \\\ values)\n",
" -or-: \$pixbuf->save_to_buffer (\$type, \$key1 => \$value1, ...)");
}
+ my $method = $HAVE_GDK_PIXBUF_2_31_2->() ? 'save_to_buffer' : 'save_to_bufferv';
my (undef, $buffer) =
Glib::Object::Introspection->invoke (
- $_GDK_PIXBUF_BASENAME, 'Pixbuf', 'save_to_bufferv',
+ $_GDK_PIXBUF_BASENAME, 'Pixbuf', $method,
$pixbuf, $type, $keys, $values);
return $buffer;
}
@@ -1458,8 +1464,9 @@ sub Gtk3::Gdk::Pixbuf::save_to_callback {
croak ("Usage: \$pixbuf->save_to_callback (\$save_func, \$user_data, \$type, \\\ keys, \\\ values)\n",
" -or-: \$pixbuf->save_to_callback (\$save_func, \$user_data, \$type, \$key1 => \$value1, ...)");
}
+ my $method = $HAVE_GDK_PIXBUF_2_31_2->() ? 'save_to_callback' : 'save_to_callbackv';
Glib::Object::Introspection->invoke (
- $_GDK_PIXBUF_BASENAME, 'Pixbuf', 'save_to_callbackv',
+ $_GDK_PIXBUF_BASENAME, 'Pixbuf', $method,
$pixbuf, $save_func, $user_data, $type, $keys, $values);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]