Class: Bitcoin::Gui::TxView
- Defined in:
- lib/bitcoin/gui/tx_view.rb
Instance Attribute Summary
Attributes inherited from TreeView
Instance Method Summary collapse
-
#initialize(gui, replace = nil) ⇒ TxView
constructor
A new instance of TxView.
- #update(txouts) ⇒ Object
Methods inherited from TreeView
#embed, #format_address_col, #format_bool_col, #format_uptime_col, #format_value_col, #format_version_col, #tree_view_col
Methods included from Helpers
#add_wallet_filters, #dialog, #display_tx, #format_address, #format_uptime, #format_value, #format_version, #message, #method_missing, #wallet_preview
Constructor Details
#initialize(gui, replace = nil) ⇒ TxView
Returns a new instance of TxView.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bitcoin/gui/tx_view.rb', line 4 def initialize gui, replace = nil super(gui, :tx_view, [ [GObject::TYPE_STRING, "Type"], [GObject::TYPE_STRING, "Hash"], [GObject::TYPE_STRING, "Value", :format_value_col], [GObject::TYPE_INT, "Confirmations"], [GObject::TYPE_STRING, "Direction"], ]) GObject.signal_connect(@view, "row-activated") do |view, path, column| res, iter = @model.get_iter(path) next unless res tx_hash = @model.get_value(iter, 1).get_string @gui.display_tx(tx_hash) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bitcoin::Gui::Helpers
Instance Method Details
#update(txouts) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bitcoin/gui/tx_view.rb', line 20 def update txouts EM.defer do @model.clear txouts.each do |txout| row = @model.append(nil) @model.set_value(row, 0, txout.type.to_s) @model.set_value(row, 1, txout.get_tx.hash) @model.set_value(row, 2, txout.value.to_s) @model.set_value(row, 3, txout.get_tx.confirmations) @model.set_value(row, 4, "incoming") if txin = txout.get_next_in row = @model.append(nil) @model.set_value(row, 0, txout.type.to_s) @model.set_value(row, 1, txin.get_tx.hash) @model.set_value(row, 2, (0 - txout.value).to_s) @model.set_value(row, 3, txin.get_tx.confirmations) @model.set_value(row, 4, "outgoing") end end @view.set_model @model end end |