Hi,

These patches wrap a number of easy-to-wrap functions that were added in
gtk 2.16, I think the only thing still missing is GtkActivatableIface.

In the patch 04, gtk_action_[gs]get_gicon are commented-out because
GIcon is not in the typemaps as it depends on GIO.

The patch 06 also makes Gtk2::Window->set_default_icon_name accept
undef.

Quentin
>From cb3ce2a76072b5421bce069366430936eb58774e Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 18:57:19 +0200
Subject: [PATCH 01/16] wrap gtk_scale_add_mark and gtk_scale_clear_marks (new in gtk+-2.16)

---
 t/GtkScale.t   |   15 +++++++++++++--
 xs/GtkScale.xs |   14 ++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/t/GtkScale.t b/t/GtkScale.t
index f2099c8..f04d1a2 100644
--- a/t/GtkScale.t
+++ b/t/GtkScale.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 6;
+use Gtk2::TestHelper tests => 7;
 
 # $Id$
 
@@ -26,7 +26,18 @@ SKIP: {
   is(@{[$scale -> get_layout_offsets()]}, 2);
 }
 
+SKIP: {
+  skip("gtk_scale_add_mark and gtk_scale_clear_marks are new in 2.16", 1)
+    unless Gtk2->CHECK_VERSION (2, 16, 0);
+
+    # no way to test it other than checking they don't crash
+  $scale -> add_mark(50,'top','this is the middle');
+  $scale -> add_mark(80,'bottom',undef);
+  $scale -> clear_marks;
+  ok(1,"add_mark and clear_marks");
+}
+
 __END__
 
-Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
+Copyright (C) 2003,2010 by the gtk2-perl team (see the file AUTHORS for the
 full list).  See LICENSE for more information.
diff --git a/xs/GtkScale.xs b/xs/GtkScale.xs
index 69f34bc..52e7692 100644
--- a/xs/GtkScale.xs
+++ b/xs/GtkScale.xs
@@ -69,3 +69,17 @@ gtk_scale_get_layout (scale)
 void gtk_scale_get_layout_offsets (GtkScale *scale, OUTLIST gint x, OUTLIST gint y)
 
 #endif
+
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+## void gtk_scale_add_mark (GtkScale *scale, gdouble value, GtkPositionType  position, const gchar *markup)
+void
+gtk_scale_add_mark (scale, value, position, markup)
+	GtkScale *scale
+	gdouble   value
+	GtkPositionType   position
+	const gchar_ornull *markup
+
+void gtk_scale_clear_marks (GtkScale *scale)
+
+#endif
-- 
1.6.4.4

>From b8216bf27c6064d1895a597560d5f72f7a3934c8 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 19:58:13 +0200
Subject: [PATCH 02/16] wrap gtk_menu_item_[gs]et_use_underline (new in gtk+-2.16)

---
 t/GtkMenuItem.t   |   11 ++++++++++-
 xs/GtkMenuItem.xs |   11 +++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/t/GtkMenuItem.t b/t/GtkMenuItem.t
index 5235ddd..98994ac 100644
--- a/t/GtkMenuItem.t
+++ b/t/GtkMenuItem.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 18;
+use Gtk2::TestHelper tests => 19;
 
 # $Id$
 
@@ -110,6 +110,15 @@ SKIP: {
   if ($item) { $item->destroy; }
 }
 
+SKIP: {
+  skip 'new 2.18 stuff', 1
+	unless Gtk2->CHECK_VERSION(2, 18, 0);
+
+	my $item = Gtk2::MenuItem->new("_foo");
+	$item->set_use_underline(TRUE);
+	is( $item->get_use_underline, TRUE, '[gs]et_use_underline');
+}
+
 __END__
 
 Copyright (C) 2003, 2010 by the gtk2-perl team (see the file AUTHORS for the
diff --git a/xs/GtkMenuItem.xs b/xs/GtkMenuItem.xs
index 262a593..499ffea 100644
--- a/xs/GtkMenuItem.xs
+++ b/xs/GtkMenuItem.xs
@@ -171,3 +171,14 @@ gtk_menu_item_set_accel_path (menu_item, accel_path)
 const gchar* gtk_menu_item_get_accel_path (GtkMenuItem *menu_item);
 
 #endif /* 2.14 */
+
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+gboolean
+gtk_menu_item_get_use_underline (GtkMenuItem *menu_item)
+
+void
+gtk_menu_item_set_use_underline (GtkMenuItem *menu_item, gboolean use_underline)
+
+#endif /* 2.16 */
+
-- 
1.6.4.4

>From 396de701caa938b50048deb9cbd8a3bde58a9f1e Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 19:58:40 +0200
Subject: [PATCH 03/16] wrap gtk_image_menu_item_[gs]et_always_show_image (new in gtk+-2.16)

---
 t/GtkImageMenuItem.t   |    8 ++++++--
 xs/GtkImageMenuItem.xs |    5 +++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/t/GtkImageMenuItem.t b/t/GtkImageMenuItem.t
index 7a2321f..6dd798a 100644
--- a/t/GtkImageMenuItem.t
+++ b/t/GtkImageMenuItem.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 11;
+use Gtk2::TestHelper tests => 12;
 
 # $Id$
 
@@ -28,7 +28,7 @@ $item -> set_image($image);
 is($item -> get_image(), $image);
 
 SKIP: {
-	skip 'use_stock methods', 4
+	skip 'use_stock methods', 5
 		unless Gtk2->CHECK_VERSION(2, 16, 0);
 
 	# Get an item from a stock and test the getter/setter
@@ -48,6 +48,10 @@ SKIP: {
 	# the method call is tested for a crash
 	my $with_accelartor = Gtk2::ImageMenuItem -> new_from_stock("gtk-no");
 	$from_stock -> set_accel_group(Gtk2::AccelGroup -> new());
+
+	my $imagemitem = Gtk2::ImageMenuItem->new_from_stock("gtk-yes");
+	$imagemitem->set_always_show_image(TRUE);
+	is( $imagemitem->get_always_show_image, TRUE, '[gs]et_always_show_image');
 }
 
 __END__
diff --git a/xs/GtkImageMenuItem.xs b/xs/GtkImageMenuItem.xs
index e3aaa2b..c6a3592 100644
--- a/xs/GtkImageMenuItem.xs
+++ b/xs/GtkImageMenuItem.xs
@@ -82,5 +82,10 @@ gtk_image_menu_item_set_accel_group (image_menu_item, accel_group)
 	GtkImageMenuItem * image_menu_item
 	GtkAccelGroup    * accel_group
 
+
+gboolean gtk_image_menu_item_get_always_show_image (GtkImageMenuItem *image_menu_item);
+
+void	 gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item, gboolean always_show);
+
 #endif /* 2.16 */
 
-- 
1.6.4.4

>From bfb067372151fbb681b20aa3b247e9456b52158a Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 19:04:36 +0200
Subject: [PATCH 04/16] wrap new GtkAction getter/setters from gtk+-2.16

---
 t/GtkAction.t   |   43 ++++++++++++++++++++++++++++++++++++++++++-
 xs/GtkAction.xs |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletions(-)

diff --git a/t/GtkAction.t b/t/GtkAction.t
index 1374eec..a106324 100644
--- a/t/GtkAction.t
+++ b/t/GtkAction.t
@@ -5,7 +5,7 @@
 
 use Gtk2::TestHelper
 	at_least_version => [2, 4, 0, "Action-based menus are new in 2.4"],
-	tests => 17, noinit => 0;
+	tests => 30, noinit => 0;
 
 my $action = Gtk2::Action->new (name => 'Open',
                                 label => '_Open',
@@ -111,6 +111,47 @@ SKIP: {
 	is ($action->create_menu, undef);
 }
 
+SKIP: {
+	skip "new 2.16 stuff", 13
+		unless Gtk2->CHECK_VERSION (2, 16, 0);
+
+	$action->set_label('new label');
+	is ($action->get_label, 'new label', '[gs]et_label');
+
+	$action->set_short_label('new short label');
+	is ($action->get_short_label, 'new short label', '[gs]et_short_label');
+
+	# it seems resetting label and short_label to undef is not possible,
+	# so use a new gtkaction with no label/short_label to test the getters
+	my $a_undef = Gtk2::Action->new (name => 'Open');
+	is ($a_undef->get_label, undef, 'get_label with undef');
+	is ($a_undef->get_short_label, undef, 'get_short_label with undef');
+
+	$action->set_tooltip('new tooltip');
+	is ($action->get_tooltip, 'new tooltip', '[gs]et_tooltip');
+	$action->set_tooltip(undef);
+	is ($action->get_tooltip, undef, '[gs]et_tooltip with undef');
+
+	$action->set_stock_id('gtk-ok');
+	is ($action->get_stock_id, 'gtk-ok', '[gs]et_stock_id');
+	$action->set_stock_id(undef);
+	is ($action->get_stock_id, undef, '[gs]et_stock_id with undef');
+
+	$action->set_icon_name('my-icon-name');
+	is ($action->get_icon_name, 'my-icon-name', '[gs]et_icon_name');
+	$action->set_icon_name(undef);
+	is ($action->get_icon_name, undef, '[gs]et_icon_name with undef');
+
+	$action->set_visible_horizontal(FALSE);
+	is ($action->get_visible_horizontal, FALSE, '[gs]et_visible_horizontal');
+
+	$action->set_visible_vertical(FALSE);
+	is ($action->get_visible_vertical, FALSE, '[gs]et_visible_vertical');
+
+	$action->set_is_important(TRUE);
+	is ($action->get_is_important, TRUE, '[gs]et_is_important');
+}
+
 __END__
 
 Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for the
diff --git a/xs/GtkAction.xs b/xs/GtkAction.xs
index 0eda38c..371963a 100644
--- a/xs/GtkAction.xs
+++ b/xs/GtkAction.xs
@@ -94,6 +94,48 @@ const gchar* gtk_action_get_accel_path (GtkAction *action);
 
 #endif
 
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+void gtk_action_set_label (GtkAction *action, const gchar *label);
+
+const gchar_ornull * gtk_action_get_label (GtkAction *action);
+
+void gtk_action_set_short_label (GtkAction *action, const gchar *short_label);
+
+const gchar_ornull * gtk_action_get_short_label (GtkAction *action);
+
+void gtk_action_set_tooltip (GtkAction *action, const gchar_ornull *tooltip);
+
+const gchar_ornull * gtk_action_get_tooltip (GtkAction *action);
+
+void gtk_action_set_stock_id (GtkAction *action,const gchar_ornull *stock_id);
+
+const gchar_ornull * gtk_action_get_stock_id (GtkAction *action);
+
+void gtk_action_set_icon_name (GtkAction *action, const gchar_ornull *icon_name);
+
+const gchar_ornull * gtk_action_get_icon_name (GtkAction *action);
+
+void gtk_action_set_visible_horizontal (GtkAction *action, gboolean visible_horizontal);
+
+gboolean gtk_action_get_visible_horizontal (GtkAction *action);
+
+void gtk_action_set_visible_vertical (GtkAction *action, gboolean visible_vertical);
+
+gboolean gtk_action_get_visible_vertical (GtkAction *action);
+
+void gtk_action_set_is_important (GtkAction *action, gboolean is_important);
+
+gboolean gtk_action_get_is_important (GtkAction *action);
+
+# FIXME GIcon not in typemap
+# void gtk_action_set_gicon (GtkAction *action, GIcon *icon);
+#
+# GIcon * gtk_action_get_gicon (GtkAction *action);
+
+#endif
+
+
 #if GTK_CHECK_VERSION (2, 10, 0)
 
 MODULE = Gtk2::Action	PACKAGE = Gtk2::Widget	PREFIX = gtk_widget_
@@ -101,3 +143,4 @@ MODULE = Gtk2::Action	PACKAGE = Gtk2::Widget	PREFIX = gtk_widget_
 GtkAction_ornull * gtk_widget_get_action (GtkWidget *widget);
 
 #endif
+
-- 
1.6.4.4

>From c98d201a7b95f91130e7565de41968a9ffc18ac8 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 19:06:00 +0200
Subject: [PATCH 05/16] wrap get_caps_lock_state (new in gtk+-2.16)

---
 t/GdkKeys.t   |    9 ++++++++-
 xs/GdkKeys.xs |    6 ++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/t/GdkKeys.t b/t/GdkKeys.t
index 6aac694..d41bcc6 100644
--- a/t/GdkKeys.t
+++ b/t/GdkKeys.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 43;
+use Gtk2::TestHelper tests => 44;
 
 # $Id$
 
@@ -86,6 +86,13 @@ SKIP: {
   ok(defined($map -> have_bidi_layouts()));
 }
 
+SKIP: {
+  skip "new 2.16 stuff", 1
+    unless Gtk2 -> CHECK_VERSION(2, 16, 0);
+
+  ok(defined($map -> get_caps_lock_state), 'get_caps_lock_state');
+}
+
 my $a = $Gtk2::Gdk::Keysyms{ a };
 my $A = $Gtk2::Gdk::Keysyms{ A };
 
diff --git a/xs/GdkKeys.xs b/xs/GdkKeys.xs
index d319f41..7312ae2 100644
--- a/xs/GdkKeys.xs
+++ b/xs/GdkKeys.xs
@@ -195,6 +195,12 @@ gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
 
 #endif
 
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
+
+#endif
+
 MODULE = Gtk2::Gdk::Keys PACKAGE = Gtk2::Gdk PREFIX = gdk_
 
 gchar *
-- 
1.6.4.4

>From bcff86b939b74f9512c638e42e0f1be91beda3d7 Mon Sep 17 00:00:00 2001
From: Quentin Sculo <squen...@free.fr>
Date: Tue, 13 Apr 2010 19:09:12 +0200
Subject: [PATCH 06/16] wrap Gtk2::Window->get_default_icon_name (new in 2.16)

and make Gtk2::Window->set_default_icon_name accept undef
---
 t/01.GtkWindow.t |   13 ++++++++++++-
 xs/GtkWindow.xs  |   15 ++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/t/01.GtkWindow.t b/t/01.GtkWindow.t
index da59956..b88254f 100644
--- a/t/01.GtkWindow.t
+++ b/t/01.GtkWindow.t
@@ -10,7 +10,7 @@
 
 #########################
 
-use Gtk2::TestHelper tests => 114;
+use Gtk2::TestHelper tests => 116;
 
 ok( my $win = Gtk2::Window->new );
 ok( $win = Gtk2::Window->new('popup') );
@@ -389,6 +389,17 @@ SKIP: {
 	isa_ok ($list[0], 'Gtk2::Window');
 }
 
+SKIP: {
+	skip 'new 2.16 stuff', 2
+		unless Gtk2->CHECK_VERSION(2, 16, 0);
+
+	Gtk2::Window->set_default_icon_name (undef);
+	is (Gtk2::Window->get_default_icon_name,undef, '[gs]et_default_icon_name with undef');
+	Gtk2::Window->set_default_icon_name ('gtk-ok');
+	is (Gtk2::Window->get_default_icon_name,'gtk-ok', 'get_default_icon_name');
+}
+
+
 __END__
 
 Copyright (C) 2003-2006 by the gtk2-perl team (see the file AUTHORS for the
diff --git a/xs/GtkWindow.xs b/xs/GtkWindow.xs
index 04217f6..5e10a7d 100644
--- a/xs/GtkWindow.xs
+++ b/xs/GtkWindow.xs
@@ -690,7 +690,7 @@ const gchar_ornull * gtk_window_get_icon_name (GtkWindow  *window);
 ##  void gtk_window_set_default_icon_name (const gchar *name);
 void
 gtk_window_set_default_icon_name (class, name)
-	const gchar *name
+	const gchar_ornull *name
     C_ARGS:
 	name
 
@@ -732,6 +732,19 @@ GtkWidget_ornull * gtk_window_get_default_widget (GtkWindow *window);
 
 #endif /* 2.14 */
 
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+## gchar * gtk_window_get_icon_name (void)
+const gchar_ornull *
+gtk_window_get_default_icon_name (class);
+    C_ARGS: /* void */
+
+=for apidoc
+Gets the value set by L<$window-E<gt>set_default_icon_name>.
+=cut
+
+#endif /* 2.16 */
+
 MODULE = Gtk2::Window	PACKAGE = Gtk2::WindowGroup	PREFIX = gtk_window_group_
 
 ## GtkWindowGroup * gtk_window_group_new (void)
-- 
1.6.4.4

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to