Calendar: make current date label clickable

Once you start navigating between months, you can't return to the
current day.  However, the current day is always displayed above the
calendar grid.  Fix this by making the current date clickable; when
clicked, the calendar grid jumps back to that day.

https://bugzilla.gnome.org/show_bug.cgi?id=641366
This commit is contained in:
Vit Stanislav 2012-01-16 13:01:18 +01:00 committed by Volker Sobek
parent de8348d3b9
commit c07421c195
2 changed files with 15 additions and 4 deletions

View File

@ -1304,12 +1304,18 @@ StScrollBar StButton#vhandle:active {
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
color: #eeeeec; color: #eeeeec;
border-radius: 4px;
} }
.datemenu-date-label:hover,
.datemenu-date-label:focus { .datemenu-date-label:focus {
background-color: #999999; background-color: #999999;
} }
.datemenu-date-label:active {
background-color: #aaaaaa;
}
.calendar-day-base { .calendar-day-base {
font-size: 9pt; font-size: 9pt;
text-align: center; text-align: center;

View File

@ -63,9 +63,14 @@ const DateMenuButton = new Lang.Class({
hbox.add(vbox); hbox.add(vbox);
// Date // Date
this._date = new St.Label({ style_class: 'datemenu-date-label', this._date = new St.Button({ style_class: 'datemenu-date-label',
can_focus: true }); can_focus: true,
vbox.add(this._date); });
this._date.connect('clicked',
Lang.bind(this, function() {
this._calendar.setDate(new Date(), false);
}));
vbox.add(this._date, { x_fill: false });
this._eventList = new Calendar.EventsList(); this._eventList = new Calendar.EventsList();
this._calendar = new Calendar.Calendar(); this._calendar = new Calendar.Calendar();
@ -186,7 +191,7 @@ const DateMenuButton = new Lang.Class({
*/ */
let dateFormat = _("%A %B %e, %Y"); let dateFormat = _("%A %B %e, %Y");
let displayDate = new Date(); let displayDate = new Date();
this._date.set_text(displayDate.toLocaleFormat(dateFormat)); this._date.set_label(displayDate.toLocaleFormat(dateFormat));
}, },
_getCalendarApp: function() { _getCalendarApp: function() {