module Gtk::Stock

Public Class Methods

add(stock_id, label, *rest) click to toggle source
# File lib/gtk3/stock.rb, line 21
def add(stock_id, label, *rest)
  case rest.size
  when 0
    options = {}
  when 1
    if rest[0].is_a?(Hash)
      options = rest[0]
    else
      options = {:modifier => rest[0]}
    end
  else
    options = {
      :modifier           => rest[0],
      :key_value          => rest[1],
      :translation_domain => rest[2],
    }
  end

  item = StockItem.new

  stock_id = stock_id.to_s if stock_id.is_a?(Symbol)
  item.stock_id = stock_id

  item.label = label

  modifier = options[:modifier]
  item.modifier = modifier if modifier

  key_value = options[:key_value]
  item.keyval = key_value if key_value

  translation_domain = options[:translation_domain]
  item.translation_domain = translation_domain if translation_domain

  add_raw([item])
end
Also aliased as: add_raw
add_raw(stock_id, label, *rest)
Alias for: add
lookup(stock_id) click to toggle source
# File lib/gtk3/stock.rb, line 59
def lookup(stock_id)
  stock_id = stock_id.to_s if stock_id.is_a?(Symbol)
  found, item = lookup_raw(stock_id)
  if found
    item
  else
    nil
  end
end
Also aliased as: lookup_raw
lookup_raw(stock_id)
Alias for: lookup