module Gio::ActionMap - gio2-3.1.1 Documentation

# module Gio::ActionMap

### Public Instance Methods

add_action(action) click to toggle source

    # File lib/gio2/action-map.rb, line 20
    def add_action(action)
      action = convert_to_action(action) unless action.is_a?(Action)
      add_action_raw(action)
      actions[action.name] = action
    end

Also aliased as: add_action_raw
add_action_raw(action)
Alias for: add_action
add_actions(actions) click to toggle source

    # File lib/gio2/action-map.rb, line 32
    def add_actions(actions)
      actions.each do |action|
        add_action(action)
      end
    end

remove_action(name) click to toggle source

    # File lib/gio2/action-map.rb, line 27
    def remove_action(name)
      remove_action_raw(name)
      actions.delete(name)
    end

Also aliased as: remove_action_raw
remove_action_raw(name)
Alias for: remove_action

### Private Instance Methods

actions() click to toggle source

    # File lib/gio2/action-map.rb, line 39
    def actions
      @actions ||= {}
    end

convert_to_action(definition) click to toggle source

    # File lib/gio2/action-map.rb, line 43
    def convert_to_action(definition)
      name = definition[:name]
      parameter_type = definition[:parameter_type]
      state = definition[:state]
      callback = definition[:callback]

      action = SimpleAction.new(name, parameter_type, state)
      if callback
        action.signal_connect("activate") do |*args|
          callback.call(*args)
        end
      end
      action
    end