diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/application.vala | 15 | ||||
-rw-r--r-- | main/src/ui/notifier_freedesktop.vala | 9 | ||||
-rw-r--r-- | main/src/ui/notifier_gnotifications.vala | 9 |
3 files changed, 13 insertions, 20 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 008b15c7..29b61357 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -28,11 +28,22 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { create_actions(); startup.connect(() => { - stream_interactor.get_module(NotificationEvents.IDENTITY).register_notification_provider(new GNotificationsNotifier(stream_interactor)); + 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) { - stream_interactor.get_module(NotificationEvents.IDENTITY).register_notification_provider(free_desktop_notifier); + notification_events.register_notification_provider(free_desktop_notifier); } + 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 + var desktop_env = Environment.get_variable("XDG_CURRENT_DESKTOP"); + if (desktop_env == null || !desktop_env.down().contains("gnome")) { + if (this.active_window != null) { + this.active_window.urgency_hint = true; + } + } + }); }); activate.connect(() => { diff --git a/main/src/ui/notifier_freedesktop.vala b/main/src/ui/notifier_freedesktop.vala index 22b104bc..00ba0d06 100644 --- a/main/src/ui/notifier_freedesktop.vala +++ b/main/src/ui/notifier_freedesktop.vala @@ -107,15 +107,6 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { } catch (Error e) { warning("Failed showing content item notification: %s", e.message); } - - // Don't set urgency hint in GNOME, produces "Window is active" notification - var desktop_env = Environment.get_variable("XDG_CURRENT_DESKTOP"); - if (desktop_env == null || !desktop_env.down().contains("gnome")) { - var app = (GLib.Application.get_default() as Application); - if (app.active_window != null) { - app.active_window.urgency_hint = true; - } - } } public async void notify_subscription_request(Conversation conversation) { diff --git a/main/src/ui/notifier_gnotifications.vala b/main/src/ui/notifier_gnotifications.vala index a7aab753..31d1ffa3 100644 --- a/main/src/ui/notifier_gnotifications.vala +++ b/main/src/ui/notifier_gnotifications.vala @@ -63,15 +63,6 @@ namespace Dino.Ui { if (active_conversation_ids != null) { active_conversation_ids.add(conversation.id.to_string()); } - - // Don't set urgency hint in GNOME, produces "Window is active" notification - var desktop_env = Environment.get_variable("XDG_CURRENT_DESKTOP"); - if (desktop_env == null || !desktop_env.down().contains("gnome")) { - var app = (GLib.Application.get_default() as Application); - if (app.active_window != null) { - app.active_window.urgency_hint = true; - } - } } public async void notify_subscription_request(Conversation conversation) { |