Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created September 26, 2021 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akkiesoft/ae82e4c3ec2648fdad0238ad2002c502 to your computer and use it in GitHub Desktop.
Save Akkiesoft/ae82e4c3ec2648fdad0238ad2002c502 to your computer and use it in GitHub Desktop.
たぶんこうじゃないんだろうなーとおもった
diff --git a/core/mui/gtk_message_picker.rb b/core/mui/gtk_message_picker.rb
index f3d7f06c..3a747a76 100644
--- a/core/mui/gtk_message_picker.rb
+++ b/core/mui/gtk_message_picker.rb
@@ -40,25 +40,25 @@ class Gtk::MessagePicker < Gtk::Frame
def option_widgets
@option_widgets ||= Gtk::Grid.new.
- add(Mtk::boolean(lambda{ |new|
- unless new.nil?
- @function = function(new)
- call end
- @function == :or },
- 'いずれかにマッチする')).
- add(Mtk::boolean(lambda{ |new|
- unless new.nil?
- @not = new
- call end
- @not },
- '否定')) end
+ add(boolean(lambda{ |new|
+ unless new.nil?
+ @function = function(new)
+ call end
+ @function == :or },
+ 'いずれかにマッチする')).
+ add(boolean(lambda{ |new|
+ unless new.nil?
+ @not = new
+ call end
+ @not },
+ '否定')) end
def add_button
@add_button ||= gen_add_button end
def add_condition(expr = DEFAULT_CONDITION)
pack = Gtk::Grid.new
close = Gtk::Button.new.add(Gtk::WebIcon.new(Skin[:close], 16, 16)).set_relief(Gtk::RELIEF_NONE)
close.valign = :start
close.signal_connect(:clicked){
@container.remove(pack)
@@ -92,6 +92,15 @@ class Gtk::MessagePicker < Gtk::Frame
private
+ def boolean(key, label)
+ proc = key
+ input = Gtk::CheckButton.new(label)
+ input.active = proc.call(*[nil, input][0, proc.arity])
+ input.ssc(:toggled){ |widget|
+ proc.call(*[widget.active?, widget][0, proc.arity]) }
+ return input
+ end
+
def call
if @changed_hook
@changed_hook.call end end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment