[perl-Gtk2] Wrap new GtkAction getter/setters from gtk+ 2.16
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk2] Wrap new GtkAction getter/setters from gtk+ 2.16
- Date: Tue, 20 Apr 2010 21:09:34 +0000 (UTC)
commit 75121a4d6bbb3d536ed7138b11934b8bb32e780b
Author: Quentin Sculo <squentin free fr>
Date: Tue Apr 13 19:04:36 2010 +0200
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
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]