[gnome-shell] calendar: Respect session mode for section visibility
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] calendar: Respect session mode for section visibility
- Date: Tue, 3 Mar 2015 18:36:05 +0000 (UTC)
commit 313ee70cf7178cb2dd882400bc3c3ba8d21527d5
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Mar 3 02:04:37 2015 +0100
calendar: Respect session mode for section visibility
It doesn't make much sense to show a section if it must remain empty
due to the session mode - there won't be any events if the session
mode disallows events, or notifications if those are disallowed. So
take the session mode into account and update the sections' visibility
accordingly.
https://bugzilla.gnome.org/show_bug.cgi?id=745494
js/ui/calendar.js | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 42f0007..1c47b74 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -1269,6 +1269,12 @@ const MessageListSection = new Lang.Class({
this._list.connect('actor-added', Lang.bind(this, this._sync));
this._list.connect('actor-removed', Lang.bind(this, this._sync));
+ let id = Main.sessionMode.connect('updated',
+ Lang.bind(this, this._sync));
+ this.actor.connect('destroy', function() {
+ Main.sessionMode.disconnect(id);
+ });
+
this._messages = new Map();
this._date = new Date();
this.empty = true;
@@ -1284,6 +1290,10 @@ const MessageListSection = new Lang.Class({
this.emit('key-focus-in', actor);
},
+ get allowed() {
+ return true;
+ },
+
setDate: function(date) {
if (_sameDay(date, this._date))
return;
@@ -1391,8 +1401,8 @@ const MessageListSection = new Lang.Class({
return _sameDay(this._date, today);
},
- _syncVisible: function() {
- this.actor.visible = !this.empty;
+ _shouldShow: function() {
+ return !this.empty;
},
_sync: function() {
@@ -1404,7 +1414,7 @@ const MessageListSection = new Lang.Class({
this.emit('empty-changed');
this._closeButton.visible = this._canClear();
- this._syncVisible();
+ this.actor.visible = this.allowed && this._shouldShow();
}
});
Signals.addSignalMethods(MessageListSection.prototype);
@@ -1430,6 +1440,10 @@ const EventsSection = new Lang.Class({
this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents));
},
+ get allowed() {
+ return Main.sessionMode.showCalendarEvents;
+ },
+
_updateTitle: function() {
let now = new Date();
if (_sameDay(this._date, now)) {
@@ -1521,8 +1535,8 @@ const EventsSection = new Lang.Class({
this._reloadEvents();
},
- _syncVisible: function() {
- this.actor.visible = !this.empty || !this._isToday();
+ _shouldShow: function() {
+ return !this.empty || !this._isToday();
},
_sync: function() {
@@ -1549,9 +1563,11 @@ const NotificationSection = new Lang.Class({
}));
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
+ },
- Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
- this._sessionUpdated();
+ get allowed() {
+ return Main.sessionMode.hasNotifications &&
+ !Main.sessionMode.isGreeter;
},
_sourceAdded: function(tray, source) {
@@ -1627,11 +1643,12 @@ const NotificationSection = new Lang.Class({
app.activate();
},
- _syncVisible: function() {
- this.actor.visible = !this.empty && this._isToday();
+ _shouldShow: function() {
+ return !this.empty && this._isToday();
},
- _sessionUpdated: function() {
+ _sync: function() {
+ this.parent();
this._title.reactive = Main.sessionMode.allowSettings;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]