[gnome-shell] Calendar: Inline _ellipsizeEventTime into caller
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Calendar: Inline _ellipsizeEventTime into caller
- Date: Tue, 28 Oct 2014 00:31:23 +0000 (UTC)
commit fb5b368ca773c200358cf04e553778a7d254ac06
Author: Andreas Brauchli <a brauchli elementarea net>
Date: Mon Oct 27 12:35:35 2014 -1000
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 files changed, 2 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 2c43689..e639ef7 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;
@@ -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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]