From c07421c195beb3a3228bd31a92f988394509ff61 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 16 Jan 2012 13:01:18 +0100 Subject: [PATCH] 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 --- data/theme/gnome-shell.css | 6 ++++++ js/ui/dateMenu.js | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 613ae0ca3..ac33643eb 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -1304,12 +1304,18 @@ StScrollBar StButton#vhandle:active { font-weight: bold; text-align: center; color: #eeeeec; + border-radius: 4px; } +.datemenu-date-label:hover, .datemenu-date-label:focus { background-color: #999999; } +.datemenu-date-label:active { + background-color: #aaaaaa; +} + .calendar-day-base { font-size: 9pt; text-align: center; diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index ee36019dc..e86960706 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -63,9 +63,14 @@ const DateMenuButton = new Lang.Class({ hbox.add(vbox); // Date - this._date = new St.Label({ style_class: 'datemenu-date-label', - can_focus: true }); - vbox.add(this._date); + this._date = new St.Button({ style_class: 'datemenu-date-label', + can_focus: true, + }); + 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._calendar = new Calendar.Calendar(); @@ -186,7 +191,7 @@ const DateMenuButton = new Lang.Class({ */ let dateFormat = _("%A %B %e, %Y"); let displayDate = new Date(); - this._date.set_text(displayDate.toLocaleFormat(dateFormat)); + this._date.set_label(displayDate.toLocaleFormat(dateFormat)); }, _getCalendarApp: function() {