Calendar: Inline _ellipsizeEventTime into caller
This patch inlines the function _ellipsizeEventTime into its only caller _addEvent. This also removes the need for the global const EventEllipses and is thus removed by this commit as well. https://bugzilla.gnome.org/show_bug.cgi?id=727302
This commit is contained in:
parent
62b6419332
commit
fb5b368ca7
@ -14,12 +14,6 @@ const Shell = imports.gi.Shell;
|
||||
const MSECS_IN_DAY = 24 * 60 * 60 * 1000;
|
||||
const SHOW_WEEKDATE_KEY = 'show-weekdate';
|
||||
const ELLIPSIS_CHAR = '\u2026';
|
||||
const EventEllipses = {
|
||||
NONE: 0,
|
||||
BEFORE: 1 << 0,
|
||||
AFTER: 1 << 1,
|
||||
BOTH: ~0
|
||||
};
|
||||
|
||||
// alias to prevent xgettext from picking up strings translated in GTK+
|
||||
const gtk30_ = Gettext_gtk30.gettext;
|
||||
@ -66,18 +60,6 @@ function _getEndOfDay(date) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function _ellipsizeEventTime(event, periodBegin, periodEnd) {
|
||||
if (event.allDay)
|
||||
return EventEllipses.NONE;
|
||||
|
||||
let ret = EventEllipses.NONE;
|
||||
if (event.date < periodBegin)
|
||||
ret = EventEllipses.BEFORE;
|
||||
if (event.end > periodEnd)
|
||||
ret |= EventEllipses.AFTER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function _formatEventTime(event, clockFormat, periodBegin, periodEnd) {
|
||||
let ret;
|
||||
let allDay = (event.allDay || (event.date <= periodBegin && event.end >= periodEnd));
|
||||
@ -779,16 +761,15 @@ const EventsList = new Lang.Class({
|
||||
timeLabel.clutter_text.line_wrap = false;
|
||||
timeLabel.clutter_text.ellipsize = false;
|
||||
|
||||
let ellipses = _ellipsizeEventTime(event, periodBegin, periodEnd);
|
||||
let preEllipsisLabel = new St.Label({ style_class: 'events-day-time-ellipses',
|
||||
text: ELLIPSIS_CHAR,
|
||||
y_align: Clutter.ActorAlign.START });
|
||||
let postEllipsisLabel = new St.Label({ style_class: 'events-day-time-ellipses',
|
||||
text: ELLIPSIS_CHAR,
|
||||
y_align: Clutter.ActorAlign.START });
|
||||
if (!(ellipses & EventEllipses.BEFORE))
|
||||
if (event.allDay || event.date >= periodBegin)
|
||||
preEllipsisLabel.opacity = 0;
|
||||
if (!(ellipses & EventEllipses.AFTER))
|
||||
if (event.allDay || event.end <= periodEnd)
|
||||
postEllipsisLabel.opacity = 0;
|
||||
|
||||
let timeLabelBoxLayout = new St.BoxLayout();
|
||||
|
Loading…
Reference in New Issue
Block a user