diff options
author | fiaxh <git@lightrise.org> | 2022-02-01 17:38:15 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-02-01 23:37:54 +0100 |
commit | b7ca33a37de5dd2ecffa7575681c6009996b7ba2 (patch) | |
tree | 838f4e36a8052cd5d287069df7b76b7fbd6fb7bd /main/src/ui/application.vala | |
parent | 1e63cb3bd935ad42af7b203efc5f4f83ae131e58 (diff) | |
download | dino-b7ca33a37de5dd2ecffa7575681c6009996b7ba2.tar.gz dino-b7ca33a37de5dd2ecffa7575681c6009996b7ba2.zip |
Initialize and use dbus interfaces async
related #1155
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r-- | main/src/ui/application.vala | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 4f97b7b3..62f01bcb 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -47,11 +47,21 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { } NotificationEvents notification_events = stream_interactor.get_module(NotificationEvents.IDENTITY); - notification_events.register_notification_provider(new GNotificationsNotifier(stream_interactor)); - FreeDesktopNotifier? free_desktop_notifier = FreeDesktopNotifier.try_create(stream_interactor); - if (free_desktop_notifier != null) { - notification_events.register_notification_provider(free_desktop_notifier); - } + get_notifications_dbus.begin((_, res) => { + // It might take a bit to get the interface. NotificationEvents will queue any notifications in the meantime. + try { + DBusNotifications? dbus_notifications = get_notifications_dbus.end(res); + if (dbus_notifications != null) { + FreeDesktopNotifier free_desktop_notifier = new FreeDesktopNotifier(stream_interactor, dbus_notifications); + notification_events.register_notification_provider.begin(free_desktop_notifier); + } else { + notification_events.register_notification_provider.begin(new GNotificationsNotifier(stream_interactor)); + } + } catch (Error e) { + debug("Failed accessing fdo notification server: %s", e.message); + } + }); + notification_events.notify_content_item.connect((content_item, conversation) => { // Set urgency hint also if (normal) notifications are disabled // Don't set urgency hint in GNOME, produces "Window is active" notification |