Created
September 26, 2021 06:15
-
-
Save Akkiesoft/ae82e4c3ec2648fdad0238ad2002c502 to your computer and use it in GitHub Desktop.
たぶんこうじゃないんだろうなーとおもった
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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