Hello all,

I'd like to add notifications to the client and wallet, to decouple UI and core communication, and especially so that UIs no longer have to poll for changes.

I propose to use the boost::signal mechanism for that. It is basically a glorified callback system, but allows decoupled delivery of 'signals' from an object. Multiple other objects can listen in on an event without the emitting object having to care.

Wallet:

class CWallet { ...
    boost::signal<void(int64)> balanceChanged;
}

void CWallet::newTx (...) {
    ...
    balanceChanged(new_balance);
    ...
}


UI:

GUI::GUI(CWallet *wallet) {
   ...
   wallet->balanceChanged.connect(boost::bind(&GUI::balanceChanged, this, _1));
}
GUI::balanceChanged(int64 new_balance) {
   someWidget->setValue(new_balance);
}

Specific notifications that would be useful:

Wallet:
Network client:

JS