Borrowed from gnome-flashback: https://git.gnome.org/browse/gnome-flashback/tree/gnome-flashback/libstatus-notifier-watcher