[gnome-clocks] application: Withdraw notifications when the windows is focused
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] application: Withdraw notifications when the windows is focused
- Date: Wed, 1 Feb 2017 12:59:28 +0000 (UTC)
commit b84811662ccbf3ed6fd03e3949e15d48fe005b16
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Feb 1 12:46:25 2017 +0100
application: Withdraw notifications when the windows is focused
Clocks should dismiss (withdraw) its notifications when the windows
is focused.
The HIG[0] says that "Notifications in GNOME 3 persist after they
have been initially displayed. It is therefore important to remove
notification messages that are no longer relevant to the user."
[0] https://developer.gnome.org/hig/stable/notifications.html.en
https://bugzilla.gnome.org/show_bug.cgi?id=776043
src/application.vala | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index f9374d8..32c3e74 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -85,6 +85,12 @@ public class Application : Gtk.Application {
ensure_window ();
window.present ();
+
+ window.focus_in_event.connect (() => {
+ withdraw_notifications ();
+
+ return false;
+ });
}
private void update_theme (Gtk.Settings settings) {
@@ -140,15 +146,18 @@ public class Application : Gtk.Application {
system_notifications.append (notification_id);
}
- public override void shutdown () {
- base.shutdown ();
-
- // Withdraw all system notifications
+ private void withdraw_notifications () {
foreach (var notification in system_notifications) {
withdraw_notification (notification);
}
}
+ public override void shutdown () {
+ base.shutdown ();
+
+ withdraw_notifications ();
+ }
+
void on_quit_activate () {
quit ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]