calendar: Simplify placeholder
Without the events section in the message list, the placeholder can only reflect whether or not there are notifications. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1282
This commit is contained in:
parent
ff55cf017e
commit
8451df977c
@ -31,10 +31,6 @@ function sameDay(dateA, dateB) {
|
|||||||
return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate());
|
return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isToday(date) {
|
|
||||||
return sameDay(new Date(), date);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _isWorkDay(date) {
|
function _isWorkDay(date) {
|
||||||
/* Translators: Enter 0-6 (Sunday-Saturday) for non-work days. Examples: "0" (Sunday) "6" (Saturday) "06" (Sunday and Saturday). */
|
/* Translators: Enter 0-6 (Sunday-Saturday) for non-work days. Examples: "0" (Sunday) "6" (Saturday) "06" (Sunday and Saturday). */
|
||||||
let days = C_('calendar-no-work', "06");
|
let days = C_('calendar-no-work', "06");
|
||||||
@ -891,41 +887,13 @@ class Placeholder extends St.BoxLayout {
|
|||||||
super._init({ style_class: 'message-list-placeholder', vertical: true });
|
super._init({ style_class: 'message-list-placeholder', vertical: true });
|
||||||
this._date = new Date();
|
this._date = new Date();
|
||||||
|
|
||||||
let todayFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-notifications.svg');
|
const file = Gio.File.new_for_uri(
|
||||||
let otherFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-events.svg');
|
'resource:///org/gnome/shell/theme/no-notifications.svg');
|
||||||
this._todayIcon = new Gio.FileIcon({ file: todayFile });
|
this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file }) });
|
||||||
this._otherIcon = new Gio.FileIcon({ file: otherFile });
|
|
||||||
|
|
||||||
this._icon = new St.Icon();
|
|
||||||
this.add_actor(this._icon);
|
this.add_actor(this._icon);
|
||||||
|
|
||||||
this._label = new St.Label();
|
this._label = new St.Label({ text: _('No Notifications') });
|
||||||
this.add_actor(this._label);
|
this.add_actor(this._label);
|
||||||
|
|
||||||
this._sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
setDate(date) {
|
|
||||||
if (sameDay(this._date, date))
|
|
||||||
return;
|
|
||||||
this._date = date;
|
|
||||||
this._sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
_sync() {
|
|
||||||
let today = isToday(this._date);
|
|
||||||
if (today && this._icon.gicon == this._todayIcon)
|
|
||||||
return;
|
|
||||||
if (!today && this._icon.gicon == this._otherIcon)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (today) {
|
|
||||||
this._icon.gicon = this._todayIcon;
|
|
||||||
this._label.text = _("No Notifications");
|
|
||||||
} else {
|
|
||||||
this._icon.gicon = this._otherIcon;
|
|
||||||
this._label.text = _("No Events");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1064,6 +1032,5 @@ class CalendarMessageList extends St.Widget {
|
|||||||
|
|
||||||
setDate(date) {
|
setDate(date) {
|
||||||
this._sectionList.get_children().forEach(s => s.setDate(date));
|
this._sectionList.get_children().forEach(s => s.setDate(date));
|
||||||
this._placeholder.setDate(date);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user