sessionMode: Add showCalendarEvents property
Add a sessionMode.showCalendarEvents property, which determines whether the calendar menu should contain an events section or not. https://bugzilla.gnome.org/show_bug.cgi?id=676156
This commit is contained in:
parent
6bee51ed33
commit
ba92cfa064
@ -45,9 +45,7 @@ const DateMenuButton = new Lang.Class({
|
|||||||
Name: 'DateMenuButton',
|
Name: 'DateMenuButton',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function(params) {
|
_init: function() {
|
||||||
params = Params.parse(params, { showEvents: true });
|
|
||||||
|
|
||||||
let item;
|
let item;
|
||||||
let hbox;
|
let hbox;
|
||||||
let vbox;
|
let vbox;
|
||||||
@ -79,7 +77,7 @@ const DateMenuButton = new Lang.Class({
|
|||||||
this._date.style_class = 'datemenu-date-label';
|
this._date.style_class = 'datemenu-date-label';
|
||||||
vbox.add(this._date);
|
vbox.add(this._date);
|
||||||
|
|
||||||
if (params.showEvents) {
|
if (Main.sessionMode.showCalendarEvents) {
|
||||||
this._eventSource = new Calendar.DBusEventSource();
|
this._eventSource = new Calendar.DBusEventSource();
|
||||||
this._eventList = new Calendar.EventsList(this._eventSource);
|
this._eventList = new Calendar.EventsList(this._eventSource);
|
||||||
} else {
|
} else {
|
||||||
@ -110,7 +108,7 @@ const DateMenuButton = new Lang.Class({
|
|||||||
item.actor.reparent(vbox);
|
item.actor.reparent(vbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.showEvents) {
|
if (Main.sessionMode.showCalendarEvents) {
|
||||||
// Add vertical separator
|
// Add vertical separator
|
||||||
|
|
||||||
item = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
|
item = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
|
||||||
|
@ -978,10 +978,7 @@ const Panel = new Lang.Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
if (Main.sessionMode.sessionType == Shell.SessionType.USER)
|
this._dateMenu = new DateMenu.DateMenuButton();
|
||||||
this._dateMenu = new DateMenu.DateMenuButton({ showEvents: true });
|
|
||||||
else
|
|
||||||
this._dateMenu = new DateMenu.DateMenuButton({ showEvents: false });
|
|
||||||
this._centerBox.add(this._dateMenu.actor, { y_fill: true });
|
this._centerBox.add(this._dateMenu.actor, { y_fill: true });
|
||||||
this._menus.addMenu(this._dateMenu.menu);
|
this._menus.addMenu(this._dateMenu.menu);
|
||||||
|
|
||||||
|
@ -10,10 +10,12 @@ const DEFAULT_MODE = 'user';
|
|||||||
const _modes = {
|
const _modes = {
|
||||||
'gdm': { hasOverview: false,
|
'gdm': { hasOverview: false,
|
||||||
hasAppMenu: false,
|
hasAppMenu: false,
|
||||||
|
showCalendarEvents: false,
|
||||||
sessionType: Shell.SessionType.GDM },
|
sessionType: Shell.SessionType.GDM },
|
||||||
|
|
||||||
'user': { hasOverview: true,
|
'user': { hasOverview: true,
|
||||||
hasAppMenu: true,
|
hasAppMenu: true,
|
||||||
|
showCalendarEvents: true,
|
||||||
sessionType: Shell.SessionType.USER }
|
sessionType: Shell.SessionType.USER }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user