Update to new GnomeIdleMonitor API
https://bugzilla.gnome.org/show_bug.cgi?id=688227
This commit is contained in:
parent
32e8a9b377
commit
261fbef516
@ -1642,7 +1642,6 @@ const MessageTray = new Lang.Class({
|
|||||||
this._closeButton.connect('clicked', Lang.bind(this, this._closeNotification));
|
this._closeButton.connect('clicked', Lang.bind(this, this._closeNotification));
|
||||||
this._notificationWidget.add_actor(this._closeButton);
|
this._notificationWidget.add_actor(this._closeButton);
|
||||||
|
|
||||||
this._idleMonitorBecameActiveId = 0;
|
|
||||||
this._userActiveWhileNotificationShown = false;
|
this._userActiveWhileNotificationShown = false;
|
||||||
|
|
||||||
this.idleMonitor = new GnomeDesktop.IdleMonitor();
|
this.idleMonitor = new GnomeDesktop.IdleMonitor();
|
||||||
@ -2443,9 +2442,6 @@ const MessageTray = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onIdleMonitorBecameActive: function() {
|
_onIdleMonitorBecameActive: function() {
|
||||||
this.idleMonitor.disconnect(this._idleMonitorBecameActiveId);
|
|
||||||
this._idleMonitorBecameActiveId = 0;
|
|
||||||
|
|
||||||
this._userActiveWhileNotificationShown = true;
|
this._userActiveWhileNotificationShown = true;
|
||||||
this._updateNotificationTimeout(2000);
|
this._updateNotificationTimeout(2000);
|
||||||
this._updateState();
|
this._updateState();
|
||||||
@ -2454,12 +2450,11 @@ const MessageTray = new Lang.Class({
|
|||||||
_showNotification: function() {
|
_showNotification: function() {
|
||||||
this._notification = this._notificationQueue.shift();
|
this._notification = this._notificationQueue.shift();
|
||||||
|
|
||||||
let userIdle = this.idleMonitor.get_idletime() > IDLE_TIME;
|
this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() > IDLE_TIME;
|
||||||
if (userIdle) {
|
if (!this._userActiveWhileNotificationShown) {
|
||||||
this._userActiveWhileNotificationShown = false;
|
// If the user isn't active, set up a watch to let us know
|
||||||
this._idleMonitorBecameActiveId = this.idleMonitor.connect('became-active', Lang.bind(this, this._onIdleMonitorBecameActive));
|
// when the user becomes active.
|
||||||
} else {
|
this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
|
||||||
this._userActiveWhileNotificationShown = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._notificationClickedId = this._notification.connect('done-displaying',
|
this._notificationClickedId = this._notification.connect('done-displaying',
|
||||||
@ -2577,10 +2572,6 @@ const MessageTray = new Lang.Class({
|
|||||||
|
|
||||||
this._grabHelper.ungrab({ actor: this._notification.actor });
|
this._grabHelper.ungrab({ actor: this._notification.actor });
|
||||||
|
|
||||||
if (this._idleMonitorBecameActiveId) {
|
|
||||||
this.idleMonitor.disconnect(this._idleMonitorBecameActiveId);
|
|
||||||
this._idleMonitorBecameActiveId = 0;
|
|
||||||
}
|
|
||||||
if (this._notificationExpandedId) {
|
if (this._notificationExpandedId) {
|
||||||
this._notification.disconnect(this._notificationExpandedId);
|
this._notification.disconnect(this._notificationExpandedId);
|
||||||
this._notificationExpandedId = 0;
|
this._notificationExpandedId = 0;
|
||||||
|
@ -42,8 +42,7 @@ const PointerWatcher = new Lang.Class({
|
|||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._idleMonitor = new GnomeDesktop.IdleMonitor();
|
this._idleMonitor = new GnomeDesktop.IdleMonitor();
|
||||||
this._idleMonitor.connect('became-active', Lang.bind(this, this._onIdleMonitorBecameActive));
|
this._idleMonitor.add_idle_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
|
||||||
this._idleMonitor.add_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
|
|
||||||
this._idle = this._idleMonitor.get_idletime() > IDLE_TIME;
|
this._idle = this._idleMonitor.get_idletime() > IDLE_TIME;
|
||||||
this._watches = [];
|
this._watches = [];
|
||||||
this.pointerX = null;
|
this.pointerX = null;
|
||||||
@ -87,6 +86,7 @@ const PointerWatcher = new Lang.Class({
|
|||||||
|
|
||||||
_onIdleMonitorBecameIdle: function(monitor) {
|
_onIdleMonitorBecameIdle: function(monitor) {
|
||||||
this._idle = true;
|
this._idle = true;
|
||||||
|
this._idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
|
||||||
this._updateTimeout();
|
this._updateTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -771,9 +771,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
if (this._activationTime == 0)
|
if (this._activationTime == 0)
|
||||||
this._activationTime = GLib.get_monotonic_time();
|
this._activationTime = GLib.get_monotonic_time();
|
||||||
|
|
||||||
if (this._becameActiveId == 0)
|
this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive);
|
||||||
this._becameActiveId = this.idleMonitor.connect('became-active',
|
|
||||||
Lang.bind(this, this._onUserBecameActive));
|
|
||||||
|
|
||||||
let shouldLock = this._settings.get_boolean(LOCK_ENABLED_KEY) && !this._isLocked;
|
let shouldLock = this._settings.get_boolean(LOCK_ENABLED_KEY) && !this._isLocked;
|
||||||
|
|
||||||
@ -807,7 +805,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
// session is effectivelly locked now, it's time to build and show
|
// session is effectivelly locked now, it's time to build and show
|
||||||
// the lock screen
|
// the lock screen
|
||||||
|
|
||||||
this.idleMonitor.disconnect(this._becameActiveId);
|
this.idleMonitor.remove_watch(this._becameActiveId);
|
||||||
this._becameActiveId = 0;
|
this._becameActiveId = 0;
|
||||||
|
|
||||||
let lightboxWasShown = this._lightbox.shown;
|
let lightboxWasShown = this._lightbox.shown;
|
||||||
@ -1115,7 +1113,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
|
|
||||||
if (this._becameActiveId != 0) {
|
if (this._becameActiveId != 0) {
|
||||||
this.idleMonitor.disconnect(this._becameActiveId);
|
this.idleMonitor.remove_watch(this._becameActiveId);
|
||||||
this._becameActiveId = 0;
|
this._becameActiveId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user