fix: replace deprecated libnotify API calls (#43962)

notify_notification_set_hint_string() is deprecated, so let's use
notify_notification_set_hint() instead.

Xref: 2fe1748295
This commit is contained in:
Charles Kerr 2024-09-26 11:21:45 -05:00 committed by GitHub
parent da6ab92353
commit a974b74e82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,6 @@ if (is_linux) {
"notify_notification_set_image_from_pixbuf", "notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout", "notify_notification_set_timeout",
"notify_notification_set_urgency", "notify_notification_set_urgency",
"notify_notification_set_hint_string",
"notify_notification_set_hint", "notify_notification_set_hint",
"notify_notification_show", "notify_notification_show",
"notify_notification_close", "notify_notification_close",

View file

@ -131,19 +131,20 @@ void LibnotifyNotification::Show(const NotificationOptions& options) {
// Always try to append notifications. // Always try to append notifications.
// Unique tags can be used to prevent this. // Unique tags can be used to prevent this.
if (HasCapability("append")) { if (HasCapability("append")) {
libnotify_loader_.notify_notification_set_hint_string(notification_, libnotify_loader_.notify_notification_set_hint(
"append", "true"); notification_, "append", g_variant_new_string("true"));
} else if (HasCapability("x-canonical-append")) { } else if (HasCapability("x-canonical-append")) {
libnotify_loader_.notify_notification_set_hint_string( libnotify_loader_.notify_notification_set_hint(
notification_, "x-canonical-append", "true"); notification_, "x-canonical-append", g_variant_new_string("true"));
} }
// Send the desktop name to identify the application // Send the desktop name to identify the application
// The desktop-entry is the part before the .desktop // The desktop-entry is the part before the .desktop
std::string desktop_id = platform_util::GetXdgAppId(); std::string desktop_id = platform_util::GetXdgAppId();
if (!desktop_id.empty()) { if (!desktop_id.empty()) {
libnotify_loader_.notify_notification_set_hint_string( libnotify_loader_.notify_notification_set_hint(
notification_, "desktop-entry", desktop_id.c_str()); notification_, "desktop-entry",
g_variant_new_string(desktop_id.c_str()));
} }
libnotify_loader_.notify_notification_set_hint( libnotify_loader_.notify_notification_set_hint(