mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Make it able to set close button text
This commit is contained in:
@@ -70,6 +70,7 @@ Notification::Notification(v8::Isolate* isolate,
|
||||
opts.Get("hasReply", &has_reply_);
|
||||
opts.Get("actions", &actions_);
|
||||
opts.Get("sound", &sound_);
|
||||
opts.Get("closeButtonText", &close_button_text_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +121,10 @@ base::string16 Notification::GetSound() const {
|
||||
return sound_;
|
||||
}
|
||||
|
||||
base::string16 Notification::GetCloseButtonText() const {
|
||||
return close_button_text_;
|
||||
}
|
||||
|
||||
// Setters
|
||||
void Notification::SetTitle(const base::string16& new_title) {
|
||||
title_ = new_title;
|
||||
@@ -154,6 +159,10 @@ void Notification::SetSound(const base::string16& new_sound) {
|
||||
sound_ = new_sound;
|
||||
}
|
||||
|
||||
void Notification::SetCloseButtonText(const base::string16& text) {
|
||||
close_button_text_ = text;
|
||||
}
|
||||
|
||||
void Notification::NotificationAction(int index) {
|
||||
Emit("action", index);
|
||||
}
|
||||
@@ -201,6 +210,7 @@ void Notification::Show() {
|
||||
options.reply_placeholder = reply_placeholder_;
|
||||
options.actions = actions_;
|
||||
options.sound = sound_;
|
||||
options.close_button_text = close_button_text_;
|
||||
notification_->Show(options);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +240,9 @@ void Notification::BuildPrototype(v8::Isolate* isolate,
|
||||
.SetProperty("actions", &Notification::GetActions,
|
||||
&Notification::SetActions)
|
||||
.SetProperty("sound", &Notification::GetSound,
|
||||
&Notification::SetSound);
|
||||
&Notification::SetSound)
|
||||
.SetProperty("closeButtonText", &Notification::GetCloseButtonText,
|
||||
&Notification::SetCloseButtonText);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -56,6 +56,7 @@ class Notification : public mate::TrackableObject<Notification>,
|
||||
bool GetHasReply() const;
|
||||
std::vector<brightray::NotificationAction> GetActions() const;
|
||||
base::string16 GetSound() const;
|
||||
base::string16 GetCloseButtonText() const;
|
||||
|
||||
// Prop Setters
|
||||
void SetTitle(const base::string16& new_title);
|
||||
@@ -66,6 +67,7 @@ class Notification : public mate::TrackableObject<Notification>,
|
||||
void SetHasReply(bool new_has_reply);
|
||||
void SetActions(const std::vector<brightray::NotificationAction>& actions);
|
||||
void SetSound(const base::string16& sound);
|
||||
void SetCloseButtonText(const base::string16& text);
|
||||
|
||||
private:
|
||||
base::string16 title_;
|
||||
@@ -79,6 +81,7 @@ class Notification : public mate::TrackableObject<Notification>,
|
||||
bool has_reply_ = false;
|
||||
std::vector<brightray::NotificationAction> actions_;
|
||||
base::string16 sound_;
|
||||
base::string16 close_button_text_;
|
||||
|
||||
brightray::NotificationPresenter* presenter_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user