Bug 1073717 - [Web Notifications] Add support for "silent" notifications with libnotify. r=stransky

Depends on D119591

Differential Revision: https://phabricator.services.mozilla.com/D119592
This commit is contained in:
Matthew Noorenberghe 2023-01-07 01:03:53 +00:00
parent 7e380579bb
commit abe53493d4
2 changed files with 7 additions and 0 deletions

View file

@ -178,6 +178,9 @@ nsresult nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf) {
}
if (notify_notification_set_hint) {
notify_notification_set_hint(mNotification, "suppress-sound",
g_variant_new_boolean(mAlertIsSilent));
// If MOZ_DESKTOP_FILE_NAME variable is set, use it as the application id,
// otherwise use gAppData->name
if (getenv("MOZ_DESKTOP_FILE_NAME")) {
@ -314,6 +317,9 @@ nsresult nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert,
if (!gHasActions && mAlertHasAction)
return NS_ERROR_FAILURE; // No good, fallback to XUL
rv = aAlert->GetSilent(&mAlertIsSilent);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString title;
rv = aAlert->GetTitle(title);
NS_ENSURE_SUCCESS(rv, rv);

View file

@ -76,6 +76,7 @@ class nsAlertsIconListener : public nsIAlertNotificationImageListener,
RefPtr<nsSystemAlertsService> mBackend;
bool mAlertHasAction;
bool mAlertIsSilent;
static void* libNotifyHandle;
static bool libNotifyNotAvail;