on xenial help sign in
Improve the way notifications interact with power management

The improvements are: 1. PlaceHolder notifications are ignored. 2. Notifications send a Powerd.Off event on destruction, to notify the power manager of their lifetime. (LP: #1570922)

commit35025c725f59f84b666ab23e926bbf6efcf9e0d1 authorAlexandros Frantzis <alexandros.frantzis@canonical.com> dateFri 17 Jun 2016, 01:16 (10 years ago) parent2fe35fdda849f4
1 file changed+16
qml/Notifications/Notification.qml+16
qml/Notifications/Notification.qml+16
@@ -86,6 +86,10 @@ StyledItem {
8686 }
8787
8888 Component.onCompleted: {
89+ if (type === Notification.PlaceHolder) {
90+ return;
91+ }
92+
8993 // Turn on screen as needed (Powerd.Notification means the screen
9094 // stays on for a shorter amount of time)
9195 if (type === Notification.SnapDecision) {
@@ -100,6 +104,18 @@ StyledItem {
100104 }
101105 }
102106
107+ Component.onDestruction: {
108+ if (type === Notification.PlaceHolder) {
109+ return;
110+ }
111+
112+ if (type === Notification.SnapDecision) {
113+ Powerd.setStatus(Powerd.Off, Powerd.SnapDecision);
114+ } else if (type !== Notification.Confirmation) {
115+ Powerd.setStatus(Powerd.Off, Powerd.Notification);
116+ }
117+ }
118+
103119 function closeNotification() {
104120 if (index === ListView.view.currentIndex) { // reset to get the 1st snap decision expanded
105121 ListView.view.currentIndex = -1;