feat: allow Linux/Windows users to set notification timeout (#20153)
* feat: allow Linux users to set notification timeout * implement on windows
This commit is contained in:
parent
5e11be6898
commit
f80a17c5be
7 changed files with 92 additions and 3 deletions
|
@ -114,11 +114,14 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
|
|||
GdkPixbuf* pixbuf = libgtkui::GdkPixbufFromSkBitmap(options.icon);
|
||||
libnotify_loader_.notify_notification_set_image_from_pixbuf(notification_,
|
||||
pixbuf);
|
||||
libnotify_loader_.notify_notification_set_timeout(notification_,
|
||||
NOTIFY_EXPIRES_DEFAULT);
|
||||
g_object_unref(pixbuf);
|
||||
}
|
||||
|
||||
// Set the timeout duration for the notification
|
||||
bool neverTimeout = options.timeout_type == base::ASCIIToUTF16("never");
|
||||
int timeout = (neverTimeout) ? NOTIFY_EXPIRES_NEVER : NOTIFY_EXPIRES_DEFAULT;
|
||||
libnotify_loader_.notify_notification_set_timeout(notification_, timeout);
|
||||
|
||||
if (!options.tag.empty()) {
|
||||
GQuark id = g_quark_from_string(options.tag.c_str());
|
||||
g_object_set(G_OBJECT(notification_), "id", id, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue