[gnome-boxes/gnome-3-4: 12/15] notificationbar: Don't timeout if main window isn't active
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/gnome-3-4: 12/15] notificationbar: Don't timeout if main window isn't active
- Date: Fri, 30 Mar 2012 18:46:37 +0000 (UTC)
commit 5af0ef2390ba7953e9143330abf645089c49f953
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Mar 29 19:10:39 2012 +0300
notificationbar: Don't timeout if main window isn't active
https://bugzilla.gnome.org/show_bug.cgi?id=672983
src/notificationbar.vala | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 0b36e8f..5d507ab 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -59,11 +59,7 @@ private class Boxes.Notificationbar: GLib.Object {
info_bar.disconnect (response_id);
}
- timeout_id = Timeout.add_seconds (6, () => {
- info_bar.response (ResponseType.CANCEL);
-
- return false;
- });
+ add_timeout ();
response_id = info_bar.response.connect ((response) => {
hide ();
@@ -85,6 +81,25 @@ private class Boxes.Notificationbar: GLib.Object {
show ();
}
+ private void add_timeout () {
+ if (!app.window.is_active) {
+ // Don't timeout before user gets a chance to see's the notification
+ ulong active_id = 0;
+ active_id = app.window.notify["is-active"].connect (() => {
+ add_timeout ();
+ app.window.disconnect (active_id);
+ });
+
+ return;
+ }
+
+ timeout_id = Timeout.add_seconds (6, () => {
+ info_bar.response (ResponseType.CANCEL);
+
+ return false;
+ });
+ }
+
private void setup_action_notify () {
info_bar = new InfoBar ();
info_bar.get_style_context ().add_class ("osd");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]