Sha256: ae52ff7f9636935af77b788627ecc8019960a89e659c1ead62c2717a57a8b089

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

module Bitcoin::Gui
  class ConnView < TreeView
    def initialize gui
      super(gui, :conn_view, [
          [GObject::TYPE_STRING, "Host"],
          [GObject::TYPE_INT, "Port"],
          [GObject::TYPE_STRING, "State"],
          [GObject::TYPE_INT, "Version", :format_version_col],
          [GObject::TYPE_INT, "Block"],
          [GObject::TYPE_INT, "Uptime", :format_uptime_col],
          [GObject::TYPE_STRING, "User Agent"]])
      @view.set_model @model
    end

    def connected data
      row = @model.append(nil)
      data.each_with_index do |pair, i|
        @model.set_value(row, i, pair[1] || "")
      end
    end

    def disconnected data
      valid, i = @model.get_iter_first
      while valid
        host = @model.get_value(i, 0).get_string
        port = @model.get_value(i, 1).get_int
        if host == data[0] && port == data[1]
          @model.remove(i)
          break
        end
        valid = @model.iter_next(i.to_ptr)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoin-ruby-0.0.1 lib/bitcoin/gui/conn_view.rb