diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-08-22 23:34:11 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-08-22 23:34:11 -0400 |
commit | 11b85e55db3f6ed29a040b53041a4aa9cf1a10df (patch) | |
tree | 6702e426d6e97ff997a3f24b7b31e71da80ca1f7 | |
parent | ab16b8a89c399c513a7fba8e0bc68f0e700cfd2c (diff) | |
download | mirror-ponymix-11b85e55db3f6ed29a040b53041a4aa9cf1a10df.tar.gz mirror-ponymix-11b85e55db3f6ed29a040b53041a4aa9cf1a10df.tar.bz2 mirror-ponymix-11b85e55db3f6ed29a040b53041a4aa9cf1a10df.zip |
notify: Create a NullNotifier as the default notifier
This notifier is boring. It does nothing.
-rw-r--r-- | notify.h | 6 | ||||
-rw-r--r-- | pulse.cc | 17 |
2 files changed, 12 insertions, 11 deletions
@@ -23,6 +23,12 @@ class Notifier { bool initialized_; }; +class NullNotifier : public Notifier { + public: + virtual ~NullNotifier() {} + virtual void Notify(enum NotificationType, long, bool) {} +}; + class CommandLineNotifier : public Notifier { public: virtual ~CommandLineNotifier() {} @@ -98,7 +98,8 @@ static int xstrtol(const char *str, long *out) { PulseClient::PulseClient(string client_name) : client_name_(client_name), volume_range_(0, 150), - balance_range_(-100, 100) { + balance_range_(-100, 100), + notifier_(new NullNotifier) { enum pa_context_state state = PA_CONTEXT_CONNECTING; pa_proplist* proplist = pa_proplist_new(); @@ -345,10 +346,8 @@ bool PulseClient::SetMute(Device& device, bool mute) { if (success) { device.mute_ = mute; - if (notifier_.get()) { - notifier_->Notify(mute ? NOTIFY_MUTE : NOTIFY_UNMUTE, - device.volume_percent_, mute); - } + notifier_->Notify(mute ? NOTIFY_MUTE : NOTIFY_UNMUTE, + device.volume_percent_, mute); } return success; @@ -374,9 +373,7 @@ bool PulseClient::SetVolume(Device& device, long volume) { if (success) { device.update_volume(*cvol); - if (notifier_.get()) notifier_->Notify(NOTIFY_VOLUME, - device.volume_percent_, - device.mute_); + notifier_->Notify(NOTIFY_VOLUME, device.volume_percent_, device.mute_); } return success; @@ -412,9 +409,7 @@ bool PulseClient::SetBalance(Device& device, long balance) { if (success) { device.update_volume(*cvol); - if (notifier_.get()) notifier_->Notify(NOTIFY_BALANCE, - device.balance_, - false); + notifier_->Notify(NOTIFY_BALANCE, device.balance_, false); } return success; |