[perl-Gtk3] Add overrides for Gtk3::Gdk::Atom
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Add overrides for Gtk3::Gdk::Atom
- Date: Sun, 10 Feb 2013 15:12:47 +0000 (UTC)
commit ed6b2f895f322439053f013ac188c84855f4ee98
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Sun Feb 10 16:08:28 2013 +0100
Add overrides for Gtk3::Gdk::Atom
Specifically, add overloaded == and != operators.
NEWS | 4 +++-
lib/Gtk3.pm | 11 +++++++++++
t/overrides.t | 13 ++++++++++---
3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4f9aaf1..f1cdd44 100644
--- a/NEWS
+++ b/NEWS
@@ -12,10 +12,12 @@
* Add more overrides for Gtk3::TreeView and friends.
* Add overrides for various button constructors.
* Add an override for Gtk3::main_level.
-* Add overrides for Gtk3::Gdk::RGBA.
* Add Gtk3::EVENT_PROPAGATE and Gtk3::EVENT_STOP.
* In Gtk3::TreeModel::get, if no columns are specified, use all columns.
* Test that no double-frees occur for custom Gtk3::Widget subclasses.
+* Add overrides for Gtk3::Gdk::Atom.
+* Add overrides for Gtk3::Gdk::RGBA.
+* Make Gtk3::Gdk::Pixbuf::save, save_to_buffer and save_to_callback usable.
* Fix test failures on older versions of gtk+.
Overview of changes in Gtk3 0.008 [2012-08-26]
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index cd1aeba..3f2bae0 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -218,6 +218,13 @@ sub import {
Glib::Object::Introspection->_register_boxed_synonym (
"cairo", "RectangleInt", "gdk_rectangle_get_type");
+ # FIXME: This uses an undocumented interface for overloading to avoid the
+ # need for a package declaration.
+ Gtk3::Gdk::Atom->overload::OVERLOAD (
+ '==' => sub { ${$_[0]} == ${$_[1]} },
+ '!=' => sub { ${$_[0]} != ${$_[1]} },
+ fallback => 1);
+
my $init = 0;
my @unknown_args = ($class);
foreach (@_) {
@@ -1483,6 +1490,10 @@ return value.
=item * Gtk3::TreeStore, Gtk3::ListStore: reorder() is currently unusable.
+=item * Gtk3::Gdk::Atom: The constructor new() is not provided anymore, and the
+class function intern() must now be called as C<< Gtk3::Gdk::Atom::intern
+(name, only_if_exists) >>.
+
=item * Implementations of Gtk3::TreeModel: Gtk3::TreeIter now has a
constructor called new() expecting C<< key => value >> pairs;
new_from_arrayref() does not exist anymore. To access the contents of
diff --git a/t/overrides.t b/t/overrides.t
index b5ccc55..c3d9e13 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -7,7 +7,7 @@ use warnings;
use utf8;
use Encode;
-plan tests => 145;
+plan tests => 147;
# Gtk3::CHECK_VERSION and check_version
{
@@ -498,6 +498,15 @@ __EOD__
isa_ok ($menubars[1], "Gtk3::MenuBar");
}
+# Gtk3::Gdk::Atom
+{
+ my $atom1 = Gtk3::Gdk::Atom::intern("CLIPBOARD", Glib::FALSE);
+ my $atom2 = Gtk3::Gdk::Atom::intern("CLIPBOARD", Glib::FALSE);
+ my $atom3 = Gtk3::Gdk::Atom::intern("PRIMARY", Glib::FALSE);
+ ok ($atom1 == $atom2);
+ ok ($atom1 != $atom3);
+}
+
# Gtk3::Gdk::RGBA
{
my $rgba = Gtk3::Gdk::RGBA->new ({red => 0.0, green => 0.5, blue => 0.5, alpha => 0.5});
@@ -567,8 +576,6 @@ SKIP: {
# Gtk3::Gdk::Pixbuf::save, save_to_buffer, save_to_callback
SKIP: {
- #skip 'Gtk3::Gdk::Pixbuf; save & save_to_buffer annotations missing', 11;
-
my ($width, $height) = (10, 5);
my $pixbuf = Gtk3::Gdk::Pixbuf->new ('rgb', Glib::TRUE, 8, $width, $height);
$pixbuf->fill (hex '0xFF000000');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]