Skip to content

Commit

Permalink
Added ini file for ethereum. fixes #66
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed May 30, 2014
1 parent 65c5a20 commit 0bdb0a9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
37 changes: 22 additions & 15 deletions ethereal/assets/qml/wallet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,30 @@ ApplicationWindow {
color: "#00000000"
anchors.fill: parent

Label {
id: addressLabel
text: "Address"
anchors {
margins: 5
top: parent.top
left: parent.left
Column {
spacing: 3
anchors.fill: parent
anchors.topMargin: 5
anchors.leftMargin: 5

Label {
id: addressLabel
text: "Address"
}
}
TextField {
anchors {
margins: 5
left: addressLabel.right
top: parent.top
TextField {
text: pub.getKey().address
width: 500
}

Label {
text: "Client ID"
}
TextField {
text: eth.clientId()
onTextChanged: {
eth.changeClientId(text)
}
}
text: pub.getKey().address
width: 500
}


Expand Down
2 changes: 1 addition & 1 deletion ethereal/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
} else {
g.ParseAll()
}
ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, Identifier)
ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, g, Identifier)

// Instantiated a eth stack
ethereum, err := eth.New(eth.CapDefault, UseUPnP)
Expand Down
9 changes: 9 additions & 0 deletions ethereal/ui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (gui *Gui) Start(assetPath string) {
}})

ethutil.Config.SetClientString(fmt.Sprintf("/Ethereal v%s", version))

// Create a new QML engine
gui.engine = qml.NewEngine()
context := gui.engine.Context()
Expand Down Expand Up @@ -315,3 +316,11 @@ func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PR

return gui.pub.Transact(ethutil.Hex(keyPair.PrivateKey), recipient, value, gas, gasPrice, data)
}

func (gui *Gui) ChangeClientId(id string) {
ethutil.Config.SetIdentifier(id)
}

func (gui *Gui) ClientId() string {
return ethutil.Config.Identifier
}
12 changes: 11 additions & 1 deletion ethereum/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
"github.com/rakyll/globalconf"
"io/ioutil"
"log"
"os"
"os/signal"
"path"
"runtime"
"strings"
)
Expand Down Expand Up @@ -59,7 +61,15 @@ func main() {
lt = ethutil.LogFile | ethutil.LogStd
}

ethutil.ReadConfig(".ethereum", lt, Identifier)
g, err := globalconf.NewWithOptions(&globalconf.Options{
Filename: path.Join(ethutil.ApplicationFolder(".ethereal"), "conf.ini"),
})
if err != nil {
fmt.Println(err)
} else {
g.ParseAll()
}
ethutil.ReadConfig(".ethereum", lt, g, Identifier)

logger := ethutil.Config.Log

Expand Down

0 comments on commit 0bdb0a9

Please sign in to comment.