mate-desktop / mate-notification-daemon

Daemon to display passive pop-up notifications
https://mate-desktop.org
GNU General Public License v2.0
30 stars 26 forks source link

Fix decoding the hints dictionary #157

Closed kbrenneman closed 4 years ago

kbrenneman commented 5 years ago

mate-notification-daemon uses g_variant_lookup with a format string of "v" to look up everything in the hints dictionary. That only works if the actual value is a GVariant, but it won't decode strings, integers, etc.

This fixes the g_variant_lookup calls to use the correct type strings. In most cases, it'll also now unpack the values directly instead of fetching them in another GVariant.

kbrenneman commented 5 years ago

It's a fix, not a simplification. After the changes in 960df18a456f5171a2f5e052278df64d6c663989, the hints parameter to the Notify method is broken, because mate-notification-daemon tries to unpack the wrong data types from it. That means clients can't send a notification with sound, icons, urgency levels, and so on.

You can test that like this:

notify-send --hint=string:sound-file:/path/to/some/sound.wav foo bar

Before 960df18a456f5171a2f5e052278df64d6c663989, that would show a notification and play the sound file. Now, it'll show the notification but ignore the sound.

flexiondotorg commented 4 years ago

I've added this PR as a patch to mate-notification-daemon 1.22.0-2ubuntu1 in Ubuntu MATE 19.10 and can confirm that it works correctly.

raveit65 commented 4 years ago

@flexiondotorg You forgot to merge it ot 1.22. https://github.com/mate-desktop/mate-notification-daemon/commit/960df18a456f5171a2f5e052278df64d6c663989 is in 1.22. Please take a look at https://github.com/mate-desktop/mate-notification-daemon/pull/158