diff options
author | Corentin Noël <corentin@elementary.io> | 2018-06-03 16:07:29 +0100 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-04-21 16:35:38 +0200 |
commit | 333f7c5d32aad09b859b39268f43a0fbbd6ec8cf (patch) | |
tree | bb0377faefedd2ee0b330b60b50fa8ba1539fd46 | |
parent | 7f31e29e62f4e78bcf1c2ef7fb3946441dd98735 (diff) | |
download | libnotify-333f7c5d32aad09b859b39268f43a0fbbd6ec8cf.tar.gz |
Send the application ID when possible
-rw-r--r-- | libnotify/notification.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libnotify/notification.c b/libnotify/notification.c index c4f9be5..1c442db 100644 --- a/libnotify/notification.c +++ b/libnotify/notification.c @@ -634,6 +634,9 @@ notify_notification_show (NotifyNotification *notification, GHashTableIter iter; gpointer key, data; GVariant *result; +#ifdef GLIB_VERSION_2_32 + GApplication *application; +#endif g_return_val_if_fail (notification != NULL, FALSE); g_return_val_if_fail (NOTIFY_IS_NOTIFICATION (notification), FALSE); @@ -668,6 +671,21 @@ notify_notification_show (NotifyNotification *notification, g_variant_builder_add (&hints_builder, "{sv}", key, data); } +#ifdef GLIB_VERSION_2_32 + application = g_application_get_default (); + + if (application != NULL) { + GVariant *desktop_entry = g_hash_table_lookup (priv->hints, "desktop-entry"); + + if (desktop_entry == NULL) { + const char *application_id = g_application_get_application_id (application); + + g_variant_builder_add (&hints_builder, "{sv}", "desktop-entry", + g_variant_new_string (application_id)); + } + } +#endif + /* TODO: make this nonblocking */ result = g_dbus_proxy_call_sync (proxy, "Notify", |