diff options
| author | Remko Tronçon <git@el-tramo.be> | 2011-12-24 10:08:47 (GMT) |
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2011-12-24 11:00:04 (GMT) |
| commit | 3e2a3a4cdb0b6bc0cf79423c48400c544830177a (patch) | |
| tree | dcc53224fd0b0ed0bd704a4b097f5c425dbd672e /SwifTools/Notifier/TogglableNotifier.h | |
| parent | f69d027b7e3b4260e514a77f7195ec511977b63e (diff) | |
| download | swift-contrib-3e2a3a4cdb0b6bc0cf79423c48400c544830177a.zip swift-contrib-3e2a3a4cdb0b6bc0cf79423c48400c544830177a.tar.bz2 | |
Enable "Show notifications" toggle when Growl isn't installed.
Diffstat (limited to 'SwifTools/Notifier/TogglableNotifier.h')
| -rw-r--r-- | SwifTools/Notifier/TogglableNotifier.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/SwifTools/Notifier/TogglableNotifier.h b/SwifTools/Notifier/TogglableNotifier.h index e8de5de..7abfd42 100644 --- a/SwifTools/Notifier/TogglableNotifier.h +++ b/SwifTools/Notifier/TogglableNotifier.h @@ -9,46 +9,50 @@ #include <SwifTools/Notifier/Notifier.h> namespace Swift { class TogglableNotifier : public Notifier { public: TogglableNotifier(Notifier* notifier) : notifier(notifier), persistentEnabled(true), temporarilyDisabled(false) { } /** * Set a long-term (usually user-set) enabled. * This may be temporarily overriden by the application, e.g. if the * user is marked DND. */ void setPersistentEnabled(bool b) { persistentEnabled = b; } /** * Set a temporary override to stop notifications without changing the * long-term state. e.g. if the user goes DND, but the persistent * enabled shouldn't be lost when they become available again. */ void setTemporarilyDisabled(bool b) { temporarilyDisabled = b; } /** * Get the result of applying the temporary override to the persistent * enabledness. */ bool getCurrentlyEnabled() const { return persistentEnabled && !temporarilyDisabled; } virtual void showMessage(Type type, const std::string& subject, const std::string& description, const boost::filesystem::path& picture, boost::function<void()> callback) { - if (getCurrentlyEnabled()) { + if (getCurrentlyEnabled() || notifier->isExternallyConfigured()) { notifier->showMessage(type, subject, description, picture, callback); } } + virtual bool isExternallyConfigured() const { + return notifier->isExternallyConfigured(); + } + private: Notifier* notifier; bool persistentEnabled; bool temporarilyDisabled; }; } |
Swift