[perl-Gtk2] Wrap gtk_dialog_get_widget_for_response()



commit 71d8ead9df60c7d5213aacdd7f5e2ed17a264047
Author: Kevin Ryde <user42 zip com au>
Date:   Wed Nov 10 14:26:38 2010 +1100

    Wrap gtk_dialog_get_widget_for_response()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634704

 t/GtkDialog.t   |   17 +++++++++++++++--
 xs/GtkDialog.xs |   14 ++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/t/GtkDialog.t b/t/GtkDialog.t
index 11a4c11..aab02b0 100644
--- a/t/GtkDialog.t
+++ b/t/GtkDialog.t
@@ -9,7 +9,7 @@
 # 	- rm
 #########################
 
-use Gtk2::TestHelper tests => 26;
+use Gtk2::TestHelper tests => 28;
 
 ok( my $win = Gtk2::Window->new('toplevel') );
 
@@ -98,7 +98,20 @@ isa_ok ($d3->get_content_area, 'Gtk2::VBox');
 ok ($d3->action_area == $d3->get_action_area);
 ok ($d3->vbox == $d3->get_content_area);
 
+SKIP: {
+	skip 'get_widget_for_response is new in 2.20', 2
+		unless Gtk2->CHECK_VERSION (2, 20, 0);
+
+	# number response id
+	is ($d3->get_widget_for_response(44), $btn3);
+
+	# enum name response id
+	my $button = Gtk2::Button->new('foo');
+	$d3->add_action_widget($button, 'help');
+	is ($d3->get_widget_for_response('help'), $button);
+}
+
 __END__
 
-Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for the
+Copyright (C) 2003-2005, 2010 by the gtk2-perl team (see the file AUTHORS for the
 full list).  See LICENSE for more information.
diff --git a/xs/GtkDialog.xs b/xs/GtkDialog.xs
index baf184c..fd492d4 100644
--- a/xs/GtkDialog.xs
+++ b/xs/GtkDialog.xs
@@ -566,6 +566,20 @@ gtk_dialog_get_response_for_widget (dialog, widget)
 
 #endif
 
+#if GTK_CHECK_VERSION (2, 20, 0)
+
+##  GtkWidget *widget gtk_dialog_get_widget_for_response (GtkDialog *dialog, gint);
+=for arg response_id (GtkResponseType)
+=cut
+GtkWidget *
+gtk_dialog_get_widget_for_response (dialog, response_id)
+	GtkDialog *dialog
+	SV *response_id
+    C_ARGS:
+	dialog, gtk2perl_dialog_response_id_from_sv (response_id)
+
+#endif
+
 MODULE = Gtk2::Dialog	PACKAGE = Gtk2	PREFIX = gtk_
 
 #if GTK_CHECK_VERSION (2, 6, 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]