[perl-Gtk3] Gtk3::TreeModel::get: if no columns are specified, use all columns



commit b9bc1d1b56804e4af24d5cd105d2ca1265e29e68
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Jan 25 18:20:16 2013 +0100

    Gtk3::TreeModel::get: if no columns are specified, use all columns
    
    This brings it in line with Gtk2.

 NEWS          |    1 +
 lib/Gtk3.pm   |    3 +++
 t/overrides.t |    6 +++++-
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 406faa4..f4d2402 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@
 * Add an override for Gtk3::main_level.
 * Add overrides for Gtk3::Gdk::RGBA.
 * Add Gtk3::EVENT_PROPAGATE and Gtk3::EVENT_STOP.
+* In Gtk3::TreeModel::get, if no columns are specified, use all columns.
 * Test that no double-frees occur for custom Gtk3::Widget subclasses.
 
 Overview of changes in Gtk3 0.008 [2012-08-26]
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 442c9e4..74c2b34 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -984,6 +984,9 @@ sub Gtk3::TextBuffer::set_text {
 
 sub Gtk3::TreeModel::get {
   my ($model, $iter, @columns) = @_;
+  if (! columns) {
+    @columns = (0..($model->get_n_columns-1));
+  }
   my @values = map { $model->get_value ($iter, $_) } @columns;
   return @values[0..$#values];
 }
diff --git a/t/overrides.t b/t/overrides.t
index 5e5877a..11e5f6d 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 => 108;
+plan tests => 112;
 
 # Gtk3::CHECK_VERSION and check_version
 {
@@ -124,11 +124,13 @@ SKIP: {
   my $model = Gtk3::ListStore->new ([qw/Glib::String Glib::Int/]);
   my $iter = $model->append;
   $model->set ($iter, [0, 1], ['Foo', 23]);
+  is_deeply ([$model->get ($iter)], ['Foo', 23]);
   is_deeply ([$model->get ($iter, 0,1)], ['Foo', 23]);
   is (scalar $model->get ($iter, 0,1), 23);
 
   $iter = $model->append;
   $model->set ($iter, 0 => 'Bar', 1 => 42);
+  is_deeply ([$model->get ($iter)], ['Bar', 42]);
   is_deeply ([$model->get ($iter, 0,1)], ['Bar', 42]);
   is (scalar $model->get ($iter, 0,1), 42);
 
@@ -197,11 +199,13 @@ SKIP: {
   my $model = Gtk3::TreeStore->new ([qw/Glib::String Glib::Int/]);
   my $iter = $model->append (undef);
   $model->set ($iter, [0, 1], ['Foo', 23]);
+  is_deeply ([$model->get ($iter)], ['Foo', 23]);
   is_deeply ([$model->get ($iter, 0,1)], ['Foo', 23]);
   is (scalar $model->get ($iter, 0,1), 23);
 
   $iter = $model->append (undef);
   $model->set ($iter, 0 => 'Bar', 1 => 42);
+  is_deeply ([$model->get ($iter)], ['Bar', 42]);
   is_deeply ([$model->get ($iter, 0,1)], ['Bar', 42]);
   is (scalar $model->get ($iter, 0,1), 42);
 



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