diff options
author | fiaxh <git@mx.ax.lt> | 2017-04-11 00:04:27 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-04-11 00:04:27 +0200 |
commit | 71fab50c8eb80db29d656fc12ce167ec70d71748 (patch) | |
tree | 2595a94ec327d79e5ca32d15f8141d6d5ce172cc /main/src/ui/notifications.vala | |
parent | 9bc83539d124f9645dc92e9e39001cb0192dae61 (diff) | |
download | dino-71fab50c8eb80db29d656fc12ce167ec70d71748.tar.gz dino-71fab50c8eb80db29d656fc12ce167ec70d71748.zip |
Fix alt-tab behaviour when notification is active
Diffstat (limited to 'main/src/ui/notifications.vala')
-rw-r--r-- | main/src/ui/notifications.vala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 029a4b33..af2c80fe 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -10,6 +10,7 @@ public class Notifications : Object { public signal void conversation_selected(Conversation conversation); private StreamInteractor stream_interactor; + private Gtk.Window window; private HashMap<Conversation, Notify.Notification> notifications = new HashMap<Conversation, Notify.Notification>(Conversation.hash_func, Conversation.equals_func); private enum ClosedReason { // org.freedesktop.Notifications.NotificationClosed @@ -19,8 +20,9 @@ public class Notifications : Object { UNDEFINED = 4 } - public Notifications(StreamInteractor stream_interactor) { + public Notifications(StreamInteractor stream_interactor, Gtk.Window window) { this.stream_interactor = stream_interactor; + this.window = window; } public void start() { @@ -32,10 +34,13 @@ public class Notifications : Object { if (!notifications.has_key(conversation)) { notifications[conversation] = new Notify.Notification("", null, null); notifications[conversation].set_hint("transient", true); - notifications[conversation].closed.connect(() => { - if (notifications[conversation].closed_reason == ClosedReason.USER_DISMISSED) { - // USER_DISMISSED + transient = very probably clicked on - conversation_selected(conversation); + notifications[conversation].add_action("default", "Open", () => { + conversation_selected(conversation); + Gdk.X11.Window x11window = window.get_window() as Gdk.X11.Window; + if (x11window != null) { + window.present_with_time(Gdk.X11.get_server_time(x11window)); + } else { + window.present(); } }); } |