Class: Watobo::Plugin::Sslchecker::Gui::CipherTableController

Inherits:
FXHorizontalFrame
  • Object
show all
Defined in:
plugins/sslchecker/gui/cipher_table.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ CipherTableController

Returns a new instance of CipherTableController.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'plugins/sslchecker/gui/cipher_table.rb', line 45

def initialize(owner, opts)
  super(owner,opts)
  @event_dispatcher_listeners = Hash.new
  @good_cb = FXCheckButton.new(self, "good", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
  @good_cb.connect(SEL_COMMAND) { update_table }
  @good_cb.checkState = true
  @bad_cb = FXCheckButton.new(self, "bad", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
  @bad_cb.connect(SEL_COMMAND) { update_table }
  @bad_cb.checkState = true
  @na_cb = FXCheckButton.new(self, "n/a", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
  @na_cb.connect(SEL_COMMAND) { update_table }
  @na_cb.checkState = true
  FXButton.new(self, "copy").connect(SEL_COMMAND) { notify(:copy_table) }
         #   FXButton.new(self, "clear").connect(SEL_COMMAND) { notify(:clear_ciphers) }

end

Instance Method Details

#clearEvents(event) ⇒ Object



33
34
35
# File 'plugins/sslchecker/gui/cipher_table.rb', line 33

def clearEvents(event)
  @event_dispatcher_listener[event].clear
end

#notify(event, *args) ⇒ Object



37
38
39
40
41
42
43
# File 'plugins/sslchecker/gui/cipher_table.rb', line 37

def notify(event, *args)
  if @event_dispatcher_listeners[event]
    @event_dispatcher_listeners[event].each do |m|
      m.call(*args) if m.respond_to? :call
    end
  end
end

#subscribe(event, &callback) ⇒ Object



29
30
31
# File 'plugins/sslchecker/gui/cipher_table.rb', line 29

def subscribe(event, &callback)
  (@event_dispatcher_listeners[event] ||= []) << callback
end

#update_tableObject



62
63
64
65
66
67
68
# File 'plugins/sslchecker/gui/cipher_table.rb', line 62

def update_table
  show_prefs = CipherTable::CTF_NONE
  show_prefs = show_prefs | CipherTable::CTF_BAD if @bad_cb.checked?
  show_prefs = show_prefs | CipherTable::CTF_GOOD if @good_cb.checked?
  show_prefs = show_prefs | CipherTable::CTF_NA if @na_cb.checked?
  notify(:apply_filter, show_prefs)
end