From c291de7479e512791d1676468353f33532fdf2ac Mon Sep 17 00:00:00 2001 From: Andreas Brauchli Date: Mon, 27 Oct 2014 12:35:35 -1000 Subject: [PATCH] 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 --- js/ui/calendar.js | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index ae8bc82db..ab0cc766a 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -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; @@ -65,18 +59,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)); @@ -778,16 +760,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();