Kouhei Sutou 2017-09-14 10:15:50 +0900 (Thu, 14 Sep 2017)
New Revision: e00652d2e4bfdb6cd4168e36f10011682d9f2bd1
https://github.com/ruby-gnome2/ruby-gnome2/commit/e00652d2e4bfdb6cd4168e36f10011682d9f2bd1
Message:
gtk3: add Container#add_child and #remove_child as alias
GitHub: fix #1101
Some subclasses such as Gtk::ComboBoxText has the same name
methods (#remove for Gtk::ComboBoxText case). These aliases will help
you to call Container#add and #remove easily.
Reported by Robert A. Heiler. Thanks!!!
Modified files:
gtk3/lib/gtk3/container.rb
gtk3/sample/gtk-demo/combobox.rb
Modified: gtk3/lib/gtk3/container.rb (+3 -0)
===================================================================
--- gtk3/lib/gtk3/container.rb 2017-09-08 23:31:51 +0900 (3b9cbbb12)
+++ gtk3/lib/gtk3/container.rb 2017-09-14 10:15:50 +0900 (81321556c)
@@ -31,6 +31,9 @@ module Gtk
end
alias_method :<<, :add
+ alias_method :add_child, :add
+ alias_method :remove_child, :remove
+
alias_method :focus_chain_raw, :focus_chain
def focus_chain
set_explicitly, widgets = focus_chain_raw
Modified: gtk3/sample/gtk-demo/combobox.rb (+2 -2)
===================================================================
--- gtk3/sample/gtk-demo/combobox.rb 2017-09-08 23:31:51 +0900 (4ce3e2eac)
+++ gtk3/sample/gtk-demo/combobox.rb 2017-09-14 10:15:50 +0900 (bc30aaefe)
@@ -99,8 +99,8 @@ class ComboboxDemo
entry = MaskEntry.new
entry.mask = "^([0-9]*|One|Two|2\302\275|Three)$"
- combo.remove(combo.child.gtype)
- combo.add(entry)
+ combo.remove_child(combo.child)
+ combo.add_child(entry)
# A combobox with string IDs
frame = Gtk::Frame.new("String IDs")
|