From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QhEKT-0000EB-Vu for bitcoin-development@lists.sourceforge.net; Thu, 14 Jul 2011 05:19:17 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.161.175 as permitted sender) client-ip=209.85.161.175; envelope-from=witchspace81@gmail.com; helo=mail-gx0-f175.google.com; Received: from mail-gx0-f175.google.com ([209.85.161.175]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1QhEKT-0005ar-6G for bitcoin-development@lists.sourceforge.net; Thu, 14 Jul 2011 05:19:17 +0000 Received: by gxk3 with SMTP id 3so3495337gxk.34 for ; Wed, 13 Jul 2011 22:19:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.236.16 with SMTP id j16mr2042747ybh.15.1310620751689; Wed, 13 Jul 2011 22:19:11 -0700 (PDT) Received: by 10.151.150.15 with HTTP; Wed, 13 Jul 2011 22:19:11 -0700 (PDT) Date: Thu, 14 Jul 2011 05:19:11 +0000 Message-ID: From: John Smith To: Bitcoin Dev Content-Type: multipart/alternative; boundary=000e0cd2a07c56f93a04a800acb1 X-Spam-Score: -0.5 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (witchspace81[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.1 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (witchspace81[at]gmail.com) 1.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1QhEKT-0005ar-6G Subject: [Bitcoin-development] Notifications from client/wallet X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2011 05:19:18 -0000 --000e0cd2a07c56f93a04a800acb1 Content-Type: text/plain; charset=ISO-8859-1 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 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: - balanceChanged(int64): spendable balance changed - transactionAdded(int256): new transaction added to wallet - transactionUpdated(int256): transaction info changed - transactionRemoved(int256): transaction removed from wallet (can this happen? for completeness) - addressAdded(int160): address was added to address book - addressUpdated(int160): address label/other metadata was modified - addressRemoved(int160): address was removed from address book - notification(std::string message, int severity): warning/error occured in wallet processing, notify user - int askFee(std::string message, ...): ask user for fee Network client: - numConnectionsChanged(int): new connections / connections broken - numBlocksChanged(int): new blocks came in or other changes to block chain - notification(std::string message, int severity): warning/error occured in network processing, notify user JS --000e0cd2a07c56f93a04a800acb1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello all,

I'd like to add notifications to the client and walle= t, to decouple UI and core communication, and especially so that UIs no lon= ger have to poll for changes.

I propose to use the boost::signal me= chanism for that. It is basically a glorified callback system, but allows d= ecoupled delivery of 'signals' from an object. Multiple other objec= ts can listen in on an event without the emitting object having to care.
Wallet:

class CWallet { ...=A0=A0=A0 boost::signal<void(int64)> balanceChanged;
}
<= br>
void CWallet::newTx (...) {
<= div style=3D"margin-left: 40px;"> =A0=A0=A0 ...
=A0=A0=A0 balanceChanged(new_balance);
=A0=A0=A0 ...}


UI:

GUI::GUI(C= Wallet *wallet) {
=A0=A0 ...
=A0=A0 wallet->balanceChanged.connect= (boost::bind(&GUI::balanceChanged, this, _1));
}
GUI::balanceChanged(int64 new_balance) {
=A0=A0 someWidget->setV= alue(new_balance);
}

Specific notifications that would be u= seful:

Wallet:
  • balanceChanged(int64): spendable balance c= hanged
  • transactionAdded(int256): new transaction added to wallet
  • =
  • transactionUpdated(int256): transaction info changed
  • transa= ctionRemoved(int256): transaction removed from wallet (can this happen? for= completeness)
  • addressAdded(int160): address was added to address book
  • add= ressUpdated(int160): address label/other metadata was modified
  • = addressRemoved(int160): address was removed from address book
  • notification(std::string message, int severity): warning/error occured in w= allet processing, notify user
  • int askFee(std::string message, .= ..): ask user for fee
Network client:
  • numConnection= sChanged(int): new connections / connections broken
  • numBlocksChanged(int): new blocks came in or other changes to bloc= k chain
  • notification(std::string message, int severity): warnin= g/error occured in network processing, notify user

JS
--000e0cd2a07c56f93a04a800acb1--