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 <witchspace81@gmail.com>) 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 <bitcoin-development@lists.sourceforge.net>;
	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: <CAJNQ0st6Fo+VgVWj-AA5x8EvetZt4H=PR=n5q6NhZ6RyR0HYOA@mail.gmail.com>
From: John Smith <witchspace81@gmail.com>
To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
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: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=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<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:

   - 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,<br><br>I&#39;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. <br><br>I propose to use the boost::signal me=
chanism for that. It is basically a glorified callback system, but allows d=
ecoupled delivery of &#39;signals&#39; from an object. Multiple other objec=
ts can listen in on an event without the emitting object having to care. <b=
r>
<br>Wallet:<br><br><div style=3D"margin-left: 40px;">class CWallet { ...<br=
>=A0=A0=A0 boost::signal&lt;void(int64)&gt; balanceChanged;<br>}<br></div><=
br><div style=3D"margin-left: 40px;">void CWallet::newTx (...) {<br></div><=
div style=3D"margin-left: 40px;">
=A0=A0=A0 ...<br>=A0=A0=A0 balanceChanged(new_balance);<br>=A0=A0=A0 ...<br=
>}<br></div><br><br>UI:<br><br><div style=3D"margin-left: 40px;">GUI::GUI(C=
Wallet *wallet) {<br>=A0=A0 ...<br>=A0=A0 wallet-&gt;balanceChanged.connect=
(boost::bind(&amp;GUI::balanceChanged, this, _1));<br>
}<br>GUI::balanceChanged(int64 new_balance) {<br>=A0=A0 someWidget-&gt;setV=
alue(new_balance);<br>}<br></div><br>Specific notifications that would be u=
seful:<br><br>Wallet:<br><ul><li>balanceChanged(int64): spendable balance c=
hanged<br>
</li><li>transactionAdded(int256): new transaction added to wallet<br></li>=
<li>transactionUpdated(int256): transaction info changed<br></li><li>transa=
ctionRemoved(int256): transaction removed from wallet (can this happen? for=
 completeness)</li>
<li>addressAdded(int160): address was added to address book<br></li><li>add=
ressUpdated(int160): address label/other metadata was modified<br></li><li>=
addressRemoved(int160): address was removed from address book<br></li><li>
notification(std::string message, int severity): warning/error occured in w=
allet processing, notify user<br></li><li>int askFee(std::string message, .=
..): ask user for fee<br></li></ul>Network client:<br><ul><li>numConnection=
sChanged(int): new connections / connections broken<br>
</li><li>numBlocksChanged(int): new blocks came in or other changes to bloc=
k chain<br></li><li>notification(std::string message, int severity): warnin=
g/error occured in network processing, notify user<br></li></ul><br>JS<br>

--000e0cd2a07c56f93a04a800acb1--