Skip to content
Draft
Changes from all 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
35 changes: 35 additions & 0 deletions src/fdonotification.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ call_notify (GDBusConnection *connection,
guint i;
GVariantBuilder hints_builder;
GVariant *icon;
GVariant *sound;
const char *body;
const char *title;
g_autofree char *icon_name = NULL;
Expand Down Expand Up @@ -334,6 +335,40 @@ call_notify (GDBusConnection *connection,
if (icon_name == NULL)
icon_name = g_strdup ("");



sound = g_variant_lookup_value (notification, "sound", NULL);

if (sound)
{
const char *key;
g_autoptr(GVariant) value = NULL;

g_variant_get (sound, "(&sv)", &key, &value);

if (strcmp (key, "themed") == 0)
{
g_autofree const gchar** sound_names = NULL;

sound_names = g_variant_get_strv (value, NULL);
/* Take first name from the possible themed sounds */
g_variant_builder_add (&hints_builder, "{sv}", "sound-name",
g_variant_new_string (sound_names[0]));
}
else if (strcmp (key, "bytes") == 0)
{
// FIXME: this should be part of the specs, maybe we can even add a
// sound property in the same format as the sound property in xdg-portal
g_variant_builder_add (&hints_builder, "{sv}", "x-gnome-sound-data", value);
}
else if (strcmp (key, "file") == 0)
{
g_variant_builder_add (&hints_builder, "{sv}", "sound-file", value);
}
}

g_variant_builder_add (&hints_builder, "{sv}", "sound", sound);

if (!g_variant_lookup (notification, "body", "&s", &body))
body = "";
if (!g_variant_lookup (notification, "title", "&s", &title))
Expand Down