From e09de9f6ecfe68518910030641813578d91fd378 Mon Sep 17 00:00:00 2001 From: moguno Date: Sun, 8 Sep 2013 12:35:22 +0900 Subject: [PATCH] =?UTF-8?q?:role=3D>window=E3=80=81:icon=3D>Proc=E3=81=AE=E3?= =?UTF-8?q?=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E3=82=B9=E3=83=86=E3=83?= =?UTF-8?q?=BC=E3=82=BF=E3=82=B9=E3=83=90=E3=83=BC=E3=81=AB=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3?= =?UTF-8?q?=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/plugin/gtk/toolbar_generator.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/plugin/gtk/toolbar_generator.rb b/core/plugin/gtk/toolbar_generator.rb index b98c88f..5e1bab7 100644 --- a/core/plugin/gtk/toolbar_generator.rb +++ b/core/plugin/gtk/toolbar_generator.rb @@ -18,7 +18,16 @@ module Plugin::Gtk face = command[:show_face] || command[:name] || command[:slug].to_s name = if defined? face.call then lambda{ |x| face.call(event) } else face end toolitem = ::Gtk::Button.new - toolitem.add(::Gtk::WebIcon.new(command[:icon], 16, 16)) + + icon = nil + + if command[:icon].is_a?(Proc) + icon = command[:icon].call(*[nil, container][0, (command[:icon].arity == -1 ? 1 : command[:icon].arity)]) + else + icon = command[:icon] + end + + toolitem.add(::Gtk::WebIcon.new(icon, 16, 16)) toolitem.tooltip(name) toolitem.relief = ::Gtk::RELIEF_NONE toolitem.ssc(:clicked){ -- 1.7.10.2 (Apple Git-33)