Make Notification
factory function a member of NotificationPresenter
so that we can create different types of notifications based on runtime conditions.
This commit is contained in:
parent
0981807261
commit
e6a30388da
12 changed files with 22 additions and 26 deletions
|
@ -55,12 +55,6 @@ void log_and_clear_error(GError* error, const char* context) {
|
|||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
Notification* Notification::Create(NotificationDelegate* delegate,
|
||||
NotificationPresenter* presenter) {
|
||||
return new LibnotifyNotification(delegate, presenter);
|
||||
}
|
||||
|
||||
// static
|
||||
bool LibnotifyNotification::Initialize() {
|
||||
if (!libnotify_loader_.Load("libnotify.so.4") && // most common one
|
||||
|
|
|
@ -22,4 +22,8 @@ NotificationPresenterLinux::NotificationPresenterLinux() {
|
|||
NotificationPresenterLinux::~NotificationPresenterLinux() {
|
||||
}
|
||||
|
||||
Notification* NotificationPresenterLinux::CreateNotificationObject(NotificationDelegate* delegate) {
|
||||
return new LibnotifyNotification(delegate, this);
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -16,6 +16,8 @@ class NotificationPresenterLinux : public NotificationPresenter {
|
|||
~NotificationPresenterLinux();
|
||||
|
||||
private:
|
||||
Notification* CreateNotificationObject(NotificationDelegate* delegate) override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NotificationPresenterLinux);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue