Module: GtkApp::SignalSupport::ClassMethods

Defined in:
lib/gtk_app/signal_support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#signal_connectionsObject (readonly)

Returns the value of attribute signal_connections.



10
11
12
# File 'lib/gtk_app/signal_support.rb', line 10

def signal_connections
  @signal_connections
end

Instance Method Details

#on(widget_name, signal_name, receiver_method = nil) {|...| ... } ⇒ Object

Parameters:

  • widget_name (Symbol)
  • signal_name (String)
  • receiver_method (Symbol) (defaults to: nil)

Yields:

  • (...)


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gtk_app/signal_support.rb', line 16

def on(widget_name, signal_name, receiver_method=nil, &block)

  sc = SignalConnection.new do
    @widget_name = widget_name
    @signal_name = signal_name
    @receiver_method = receiver_method
    @receiver_block = block if block_given?
  end

  @signal_connections ||= []
  @signal_connections << sc
end