public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: John Smith <witchspace81@gmail.com>
To: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: [Bitcoin-development] Notifications from client/wallet
Date: Thu, 14 Jul 2011 05:19:11 +0000	[thread overview]
Message-ID: <CAJNQ0st6Fo+VgVWj-AA5x8EvetZt4H=PR=n5q6NhZ6RyR0HYOA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2168 bytes --]

             reply	other threads:[~2011-07-14  5:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14  5:19 John Smith [this message]
2011-07-14  9:10 ` [Bitcoin-development] Notifications from client/wallet Pieter Wuille
2011-07-14 14:13 ` Matt Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJNQ0st6Fo+VgVWj-AA5x8EvetZt4H=PR=n5q6NhZ6RyR0HYOA@mail.gmail.com' \
    --to=witchspace81@gmail.com \
    --cc=bitcoin-development@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox