[gnome-shell/datetime: 16/16] Update for comments from code review
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/datetime: 16/16] Update for comments from code review
- Date: Fri, 28 Jan 2011 17:06:11 +0000 (UTC)
commit 8a1313be71b1dab49188812aef124fc2148333a4
Author: David Zeuthen <davidz redhat com>
Date: Fri Jan 28 12:05:17 2011 -0500
Update for comments from code review
See https://bugzilla.gnome.org/show_bug.cgi?id=632109#c41 for the review.
Signed-off-by: David Zeuthen <davidz redhat com>
data/theme/gnome-shell.css | 38 ++++++-------------------------
js/ui/calendar.js | 46 ++++++++++++++++++--------------------
js/ui/dateMenu.js | 23 ++++---------------
src/Makefile-calendar-client.am | 2 +
4 files changed, 37 insertions(+), 72 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index a05418c..73d2b5c 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -702,48 +702,36 @@ StTooltip StLabel {
spacing-columns: 0px;
}
-.calendar-change-month {
+.calendar-month-label {
color: #666666;
font-size: 10px;
padding: 2px;
}
-.calendar-change-month:hover {
- background: #999999;
- border-radius: 5px;
-}
-
-.calendar-change-month:active {
- background: #aaaaaa;
- border-radius: 5px;
-}
-
.calendar-change-month-back {
width: 20px;
height: 20px;
background-image: url("calendar-arrow-left.svg");
+ border-radius: 4px;
}
.calendar-change-month-back:hover {
- background: #999999;
- background-image: url("calendar-arrow-left.svg");
+ background-color: #999999;
}
.calendar-change-month-back:active {
- background: #aaaaaa;
- background-image: url("calendar-arrow-left.svg");
+ background-color: #aaaaaa;
}
.calendar-change-month-forward {
width: 20px;
height: 20px;
background-image: url("calendar-arrow-right.svg");
+ border-radius: 4px;
}
.calendar-change-month-forward:hover {
- background: #999999;
- background-image: url("calendar-arrow-right.svg");
+ background-color: #999999;
}
.calendar-change-month-forward:active {
- background: #aaaaaa;
- background-image: url("calendar-arrow-right.svg");
+ background-color: #aaaaaa;
}
.datemenu-date-label {
@@ -794,7 +782,7 @@ StTooltip StLabel {
}
.calendar-nonwork-day {
- background: #181818;
+ background-color: rgba(128, 128, 128, .1);
}
.calendar-today {
@@ -860,16 +848,6 @@ StTooltip StLabel {
.events-event-box {
}
-.open-calendar {
- padding-bottom: 12px;
- padding-left: 12px;
- height: 40px;
-}
-
-.open-calendar:hover {
- background: #666;
-}
-
.url-highlighter {
link-color: #ccccff;
}
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index e79702d..f803de5 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -390,7 +390,7 @@ Calendar.prototype = {
}
// Start off with the current date
- this.selectedDate = new Date();
+ this._selectedDate = new Date();
this.actor = new St.Table({ homogeneous: false,
style_class: 'calendar',
@@ -405,10 +405,10 @@ Calendar.prototype = {
// Sets the calendar to show a specific date
setDate: function(date) {
- if (!_sameDay(date, this.selectedDate)) {
- this.selectedDate = date;
+ if (!_sameDay(date, this._selectedDate)) {
+ this._selectedDate = date;
this._update();
- this.emit('selected-date-changed', new Date(this.selectedDate));
+ this.emit('selected-date-changed', new Date(this._selectedDate));
}
},
@@ -427,8 +427,8 @@ Calendar.prototype = {
this._topBox.add(back);
back.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked));
- this._dateLabel = new St.Label({style_class: 'calendar-change-month'});
- this._topBox.add(this._dateLabel, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
+ this._monthLabel = new St.Label({style_class: 'calendar-month-label'});
+ this._topBox.add(this._monthLabel, { expand: true, x_fill: false, x_align: St.Align.MIDDLE });
let forward = new St.Button({ style_class: 'calendar-change-month-forward' });
this._topBox.add(forward);
@@ -439,15 +439,15 @@ Calendar.prototype = {
// We need to figure out the abbreviated localized names for the days of the week;
// we do this by just getting the next 7 days starting from right now and then putting
// them in the right cell in the table. It doesn't matter if we add them in order
- let iter = new Date(this.selectedDate);
+ let iter = new Date(this._selectedDate);
iter.setSeconds(0); // Leap second protection. Hah!
iter.setHours(12);
for (let i = 0; i < 7; i++) {
// Could use iter.toLocaleFormat('%a') but that normally gives three characters
// and we want, ideally, a single character for e.g. S M T W T F S
let customDayAbbrev = _getCalendarDayAbbreviation(iter.getDay());
- let label = new St.Label({ text: customDayAbbrev });
- label.style_class = 'calendar-day-base calendar-day-heading';
+ let label = new St.Label({ style_class: 'calendar-day-base calendar-day-heading',
+ text: customDayAbbrev });
this.actor.add(label,
{ row: 1,
col: offsetCols + (7 + iter.getDay() - this._weekStart) % 7,
@@ -485,7 +485,7 @@ Calendar.prototype = {
},
_onPrevMonthButtonClicked: function() {
- let newDate = new Date(this.selectedDate);
+ let newDate = new Date(this._selectedDate);
if (newDate.getMonth() == 0) {
newDate.setMonth(11);
newDate.setFullYear(newDate.getFullYear() - 1);
@@ -496,7 +496,7 @@ Calendar.prototype = {
},
_onNextMonthButtonClicked: function() {
- let newDate = new Date(this.selectedDate);
+ let newDate = new Date(this._selectedDate);
if (newDate.getMonth() == 11) {
newDate.setMonth(0);
newDate.setFullYear(newDate.getFullYear() + 1);
@@ -515,10 +515,10 @@ Calendar.prototype = {
_update: function() {
let now = new Date();
- if (_sameYear(this.selectedDate, now))
- this._dateLabel.text = this.selectedDate.toLocaleFormat(this._headerFormatWithoutYear);
+ if (_sameYear(this._selectedDate, now))
+ this._monthLabel.text = this._selectedDate.toLocaleFormat(this._headerFormatWithoutYear);
else
- this._dateLabel.text = this.selectedDate.toLocaleFormat(this._headerFormat);
+ this._monthLabel.text = this._selectedDate.toLocaleFormat(this._headerFormat);
// Remove everything but the topBox and the weekday labels
let children = this.actor.get_children();
@@ -526,7 +526,7 @@ Calendar.prototype = {
children[i].destroy();
// Start at the beginning of the week before the start of the month
- let beginDate = new Date(this.selectedDate);
+ let beginDate = new Date(this._selectedDate);
beginDate.setDate(1);
beginDate.setSeconds(0);
beginDate.setHours(12);
@@ -540,14 +540,12 @@ Calendar.prototype = {
let iterStr = iter.toUTCString();
button.connect('clicked', Lang.bind(this, function() {
- let newly_selectedDate = new Date(iterStr);
- this.setDate(newly_selectedDate);
+ let newlySelectedDate = new Date(iterStr);
+ this.setDate(newlySelectedDate);
}));
- let styleClass;
- let hasEvents;
- hasEvents = this._eventSource.hasEvents(iter);
- styleClass = 'calendar-day-base calendar-day';
+ let hasEvents = this._eventSource.hasEvents(iter);
+ let styleClass = 'calendar-day-base calendar-day';
if (_isWorkDay(iter))
styleClass += ' calendar-work-day'
else
@@ -561,10 +559,10 @@ Calendar.prototype = {
if (_sameDay(now, iter))
styleClass += ' calendar-today';
- else if (iter.getMonth() != this.selectedDate.getMonth())
+ else if (iter.getMonth() != this._selectedDate.getMonth())
styleClass += ' calendar-other-month-day';
- if (_sameDay(this.selectedDate, iter))
+ if (_sameDay(this._selectedDate, iter))
button.add_style_pseudo_class('active');
if (hasEvents)
@@ -586,7 +584,7 @@ Calendar.prototype = {
iter.setTime(iter.getTime() + MSECS_IN_DAY);
if (iter.getDay() == this._weekStart) {
// We stop on the first "first day of the week" after the month we are displaying
- if (iter.getMonth() > this.selectedDate.getMonth() || iter.getYear() > this.selectedDate.getYear())
+ if (iter.getMonth() > this._selectedDate.getMonth() || iter.getYear() > this._selectedDate.getYear())
break;
row++;
}
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index b790e11..5ee3a5b 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -29,12 +29,10 @@ function _onVertSepRepaint (area)
let cr = area.get_context();
let themeNode = area.get_theme_node();
let [width, height] = area.get_surface_size();
- let found;
- let stippleWidth = 1.0;
let stippleColor = new Clutter.Color();
- [found, stippleWidth] = themeNode.lookup_length('-stipple-width', false);
- themeNode.lookup_color('-stipple-color', false, stippleColor);
+ let stippleWidth = themeNode.get_length('-stipple-width');
let x = Math.floor(width/2) + 0.5;
+ themeNode.lookup_color('-stipple-color', false, stippleColor);
cr.moveTo(x, 0);
cr.lineTo(x, height);
Clutter.cairo_set_source_color(cr, stippleColor);
@@ -58,7 +56,6 @@ DateMenuButton.prototype = {
//this._eventSource = new Calendar.EmptyEventSource();
//this._eventSource = new Calendar.FakeEventSource();
this._eventSource = new Calendar.EvolutionEventSource();
- // TODO: write e.g. EvolutionEventSource
PanelMenu.Button.prototype._init.call(this, St.Align.START);
@@ -88,11 +85,9 @@ DateMenuButton.prototype = {
}));
vbox.add(this._calendar.actor);
- //item = new St.Button({style_class: 'popup-menu-item', label: 'foobar'});
- //vbox.add(item);
item = new PopupMenu.PopupSeparatorMenuItem();
- item.actor.remove_actor(item._drawingArea);
- vbox.add(item._drawingArea);
+ item.setColumnWidths(1);
+ vbox.add(item.actor);
item = new PopupMenu.PopupMenuItem(_("Date and Time Settings"));
item.connect('activate', Lang.bind(this, this._onPreferencesActivate));
vbox.add(item.actor);
@@ -114,7 +109,7 @@ DateMenuButton.prototype = {
item = new PopupMenu.PopupMenuItem(_("Open Calendar"));
item.connect('activate', Lang.bind(this, this._onOpenCalendarActivate));
- vbox.add(item.actor, {y_align : St.Align.END, expand : true, y_fill : false});
+ vbox.add(item.actor, {y_align: St.Align.END, expand: true, y_fill: false});
// Whenever the menu is opened, select today
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
@@ -128,14 +123,6 @@ DateMenuButton.prototype = {
// Done with hbox for calendar and event list
- // Add separator
- //item = new PopupMenu.PopupSeparatorMenuItem();
- //this.menu.addMenuItem(item);
-
- // Add button to get to the Date and Time settings
- //this.menu.addAction(_("Date and Time Settings"),
- // Lang.bind(this, this._onPreferencesActivate));
-
// Track changes to clock settings
this._desktopSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
this._clockSettings = new Gio.Settings({ schema: 'org.gnome.shell.clock' });
diff --git a/src/Makefile-calendar-client.am b/src/Makefile-calendar-client.am
index a79f2cd..cac046f 100644
--- a/src/Makefile-calendar-client.am
+++ b/src/Makefile-calendar-client.am
@@ -18,3 +18,5 @@ libcalendar_client_la_CFLAGS = \
$(NULL)
libcalendar_client_la_LIBADD = $(LIBECAL_LIBS)
+
+EXTRA_DIST += calendar-client/README
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]