[geary/wip/766133-gnotification] Ensure notifications are cleared on app activation
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/766133-gnotification] Ensure notifications are cleared on app activation
- Date: Mon, 15 Apr 2019 08:21:57 +0000 (UTC)
commit 8a401124a175371def05203f355d232d33f05b90
Author: Michael Gratton <mike vee net>
Date: Sun Apr 14 21:40:03 2019 +1000
Ensure notifications are cleared on app activation
Clear both new mail and send mail error notifications on activate, since
in the case of the former the new mail will be selected, and in the
case of the latter an error info bar will be displayed in the main
window.
src/client/application/geary-application.vala | 13 +++++++++++--
src/client/application/geary-controller.vala | 1 -
src/client/notification/notification-desktop.vala | 5 +++++
3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 37ed88b8..1032e510 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -413,8 +413,17 @@ public class GearyApplication : Gtk.Application {
public override void activate() {
base.activate();
- if (!present())
- create_async.begin();
+ // Clear notifications immediately since we are showing a main
+ // window.
+
+ if (present()) {
+ this.controller.notifications.clear_all_notifications();
+ } else {
+ this.create_async.begin((obj, res) => {
+ this.create_async.end(res);
+ this.controller.notifications.clear_all_notifications();
+ });
+ }
}
public bool present() {
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 50e95456..a624362b 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2965,7 +2965,6 @@ public class GearyController : Geary.BaseObject {
case Geary.Protocol.SMTP:
context.account.outgoing.restart.begin(context.cancellable);
- this.notifications.clear_error_notification();
break;
}
}
diff --git a/src/client/notification/notification-desktop.vala
b/src/client/notification/notification-desktop.vala
index 356a6010..20876bd8 100644
--- a/src/client/notification/notification-desktop.vala
+++ b/src/client/notification/notification-desktop.vala
@@ -39,6 +39,11 @@ public class Notification.Desktop : Geary.BaseObject {
this.monitor.new_messages_arrived.disconnect(on_new_messages_arrived);
}
+ public void clear_all_notifications() {
+ clear_arrived_notification();
+ clear_error_notification();
+ }
+
public void clear_arrived_notification() {
this.application.withdraw_notification(ARRIVED_ID);
this.arrived_notification = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]