lib/gtk4/tree-model.rb in gtk4-3.5.1 vs lib/gtk4/tree-model.rb in gtk4-4.0.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
+# Copyright (C) 2014-2022 Ruby-GNOME Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
@@ -104,9 +104,29 @@
def get_column_type(index)
(@column_types ||= {})[index] ||= get_column_type_raw(index)
end
alias_method :create_filter, :filter_new
+
+ alias_method :each_raw, :each
+ def each
+ return to_enum(__method__) unless block_given?
+ exception = nil
+ each_raw do |model, path, iter|
+ stop = true
+ # TODO: This doesn't return 'stop' to GTK when caller uses 'break'.
+ begin
+ iter.model = model
+ yield(model, path, iter)
+ stop = false
+ rescue Exception => e
+ exception = e
+ end
+ stop
+ end
+ raise exception if exception
+ self
+ end
private
def setup_iter(iter)
iter.model = self
end