Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sound-name and suppress-sound hints #124

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
11 changes: 9 additions & 2 deletions src/DBus.vala
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,16 @@ public class Notifications.Server : Object {
}

private void send_sound (HashTable<string,Variant> hints, string sound_name = "dialog-information") {
unowned Variant? variant = null;

if ((variant = hints.lookup ("suppress-sound")) != null && variant.is_of_type (VariantType.BOOLEAN) && variant.get_boolean ()) {
return;
}

if (sound_name == "dialog-information") {
Variant? variant = hints.lookup ("category");
if (variant != null) {
if ((variant = hints.lookup ("sound-name")) != null && variant.is_of_type (VariantType.STRING)) {
sound_name = variant.get_string ();
} else if ((variant = hints.lookup ("category")) != null && variant.is_of_type (VariantType.STRING)) {
sound_name = category_to_sound_name (variant.get_string ());
}
}
Expand Down