[perl-Gtk3] Add overrides for Gtk3::MenuItem, CheckMenuItem and ImageMenuItem
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Add overrides for Gtk3::MenuItem, CheckMenuItem and ImageMenuItem
- Date: Sun, 13 May 2012 12:05:05 +0000 (UTC)
commit 5bff733f9761c29f7133ca74f4d0da7589bab35d
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Sun May 13 14:03:03 2012 +0200
Add overrides for Gtk3::MenuItem, CheckMenuItem and ImageMenuItem
NEWS | 2 ++
lib/Gtk3.pm | 27 +++++++++++++++++++++++++++
t/overrides.t | 21 ++++++++++++++++++++-
3 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 84d6b2c..ced2ee3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
{{$NEXT}}
+* Add overrides for Gtk3::MenuItem, CheckMenuItem and ImageMenuItem.
+
Overview of changes in Gtk3 0.005 [2012-04-22]
==============================================
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index c721945..222b0e6 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -244,6 +244,15 @@ sub Gtk3::Button::new {
}
}
+sub Gtk3::CheckMenuItem::new {
+ my ($class, $mnemonic) = @_;
+ if (defined $mnemonic) {
+ return $class->new_with_mnemonic ($mnemonic);
+ }
+ return Glib::Object::Introspection->invoke (
+ $_GTK_BASENAME, 'CheckMenuItem', 'new', @_);
+}
+
sub Gtk3::HBox::new {
my ($class, $homogeneous, $spacing) = @_;
$homogeneous = 5 unless defined $homogeneous;
@@ -252,6 +261,15 @@ sub Gtk3::HBox::new {
$_GTK_BASENAME, 'HBox', 'new', $class, $homogeneous, $spacing);
}
+sub Gtk3::ImageMenuItem::new {
+ my ($class, $mnemonic) = @_;
+ if (defined $mnemonic) {
+ return $class->new_with_mnemonic ($mnemonic);
+ }
+ return Glib::Object::Introspection->invoke (
+ $_GTK_BASENAME, 'ImageMenuItem', 'new', @_);
+}
+
sub Gtk3::ListStore::new {
return _common_tree_model_new ('ListStore', @_);
}
@@ -292,6 +310,15 @@ sub Gtk3::Menu::popup_for_device {
$menu, $device, $parent_menu_shell, $parent_menu_item, $real_func, $data, $button, $activate_time);
}
+sub Gtk3::MenuItem::new {
+ my ($class, $mnemonic) = @_;
+ if (defined $mnemonic) {
+ return $class->new_with_mnemonic ($mnemonic);
+ }
+ return Glib::Object::Introspection->invoke (
+ $_GTK_BASENAME, 'MenuItem', 'new', @_);
+}
+
sub Gtk3::MessageDialog::new {
my ($class, $parent, $flags, $type, $buttons, $format, @args) = @_;
my $dialog = Glib::Object::new ($class, message_type => $type,
diff --git a/t/overrides.t b/t/overrides.t
index 70bb798..448be74 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -5,7 +5,7 @@ BEGIN { require './t/inc/setup.pl' };
use strict;
use warnings;
-plan tests => 61;
+plan tests => 79;
# Gtk3::CHECK_VERSION and check_version
{
@@ -75,6 +75,25 @@ SKIP: {
}
}
+# Gtk2::MenuItem::new, Gtk2::CheckMenuItem::new, Gtk2::ImageMenuItem::new
+{
+ foreach my $class (qw/Gtk3::MenuItem Gtk3::CheckMenuItem Gtk3::ImageMenuItem/) {
+ my $item;
+
+ $item = $class->new;
+ isa_ok ($item, $class);
+ ok (!$item->get_label); # might be '' or undef
+
+ $item = $class->new ('_Test');
+ isa_ok ($item, $class);
+ is ($item->get_label, '_Test');
+
+ $item = $class->new_with_mnemonic ('_Test');
+ isa_ok ($item, $class);
+ is ($item->get_label, '_Test');
+ }
+}
+
# Gtk3::Stock
{
ok (grep { $_ eq 'gtk-ok' } Gtk3::Stock::list_ids ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]