Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y libgranite-7-dev libgtk-4-dev libpantheon-wayland-1-dev libpolkit-agent-1-dev libpolkit-gobject-1-dev meson valac
apt install -y libgranite-7-dev libcanberra-dev libgtk-4-dev libpantheon-wayland-1-dev libpolkit-agent-1-dev libpolkit-gobject-1-dev meson valac
- name: Build
env:
DESTDIR: out
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ executable(
dependency('polkit-agent-1'),
dependency('polkit-gobject-1'),
dependency('pantheon-wayland-1'),
dependency('libcanberra'),
meson.get_compiler('vala').find_library('posix')
],
c_args: [
Expand Down
20 changes: 20 additions & 0 deletions src/Agent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@

namespace Ag {
public class Agent : PolkitAgent.Listener {

private static Settings sound_settings;

static construct {
sound_settings = new Settings ("org.gnome.desktop.sound");
}

public override async bool initiate_authentication (string action_id, string message, string icon_name,
Polkit.Details details, string cookie, GLib.List<Polkit.Identity> identities, GLib.Cancellable? cancellable) throws Polkit.Error {
if (identities == null) {
Expand All @@ -35,6 +42,19 @@ namespace Ag {
dialog.done.connect (() => initiate_authentication.callback ());

dialog.present ();

Canberra.Context? ca_context = null;

if (sound_settings.get_boolean ("event-sounds")) {
Canberra.Context.create (out ca_context);
if (ca_context != null) {
ca_context.change_props (Canberra.PROP_CANBERRA_XDG_THEME_NAME, "elementary",
Canberra.PROP_MEDIA_LANGUAGE, "");
ca_context.open ();
ca_context.play (0, Canberra.PROP_EVENT_ID, "dialog-question");
}
}

yield;

dialog.destroy ();
Expand Down