[perl-Gtk2] Gtk2::ComboBox->set_model(): allow undef



commit 58aeee94c3969466c60a2cdefae114634e451e0b
Author: Kevin Ryde <user42 zip com au>
Date:   Wed Sep 15 09:25:33 2010 +1000

    Gtk2::ComboBox->set_model(): allow undef
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629723

 t/GtkComboBox.t   |    8 ++++++--
 xs/GtkComboBox.xs |    6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/t/GtkComboBox.t b/t/GtkComboBox.t
index ef19d1e..9a9eeac 100644
--- a/t/GtkComboBox.t
+++ b/t/GtkComboBox.t
@@ -3,7 +3,7 @@
 # $Id$
 
 use Gtk2::TestHelper
-	tests => 26,
+	tests => 27,
 	at_least_version => [2, 4, 0, "GtkComboBox is new in 2.4"],
 	;
 
@@ -70,7 +70,7 @@ $combo_box->set_active (1);
 is ($combo_box->get_active, 1, 'set and get active');
 
 SKIP: {
-	skip "new api in gtk+ 2.6", 11
+	skip "new api in gtk+ 2.6", 12
 		unless Gtk2->CHECK_VERSION (2, 6, 0);
 
 	my $active_path = Gtk2::TreePath->new_from_string
@@ -121,6 +121,10 @@ SKIP: {
 	is ($combo_box->get_wrap_width, 1);
 	is ($combo_box->get_row_span_column, 1);
 	is ($combo_box->get_column_span_column, 1);
+
+	# setting undef for no model is allowed
+	$combo_box->set_model (undef);
+	is ($combo_box->get_model, undef, 'set_model() of undef giving undef');
 }
 
 SKIP: {
diff --git a/xs/GtkComboBox.xs b/xs/GtkComboBox.xs
index 9f0d4d7..a6871b6 100644
--- a/xs/GtkComboBox.xs
+++ b/xs/GtkComboBox.xs
@@ -125,7 +125,11 @@ void gtk_combo_box_set_active_iter (GtkComboBox *combo_box, GtkTreeIter_ornull *
 
 ##/* getters and setters */
 
-void gtk_combo_box_set_model (GtkComboBox *combo_box, GtkTreeModel *model)
+=for apidoc
+Note that setting C<undef> for no model is new in Gtk 2.6.  (Both here
+or via C<set_property>.)
+=cut
+void gtk_combo_box_set_model (GtkComboBox *combo_box, GtkTreeModel_ornull *model)
 
 GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box);
 



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