calendar: Do not overload :active to mark selected day

We currently use the :active pseudo class to mark the selected day
in the calendar. Whenever the selected date changes, the class is
added to the corresponding button and removed from all others.
However when the selected date doesn't change (i.e. when clicking
the already selected date), the buttons are not updated and the
use of the :active class conflicts with StButton's builtin handling
of the class - the class is removed on the button up event and the
button is deselected.
Fix this by simply using a different pseudo class.

https://bugzilla.gnome.org/show_bug.cgi?id=746867
This commit is contained in:
Florian Müllner 2016-07-08 02:06:31 +02:00
parent 3d77dd8f51
commit 8347152730
4 changed files with 5 additions and 5 deletions

View File

@ -769,7 +769,7 @@ StScrollBar {
border-radius: 1.4em; } border-radius: 1.4em; }
.calendar-day-base:hover, .calendar-day-base:focus { .calendar-day-base:hover, .calendar-day-base:focus {
background-color: #0d0d0d; } background-color: #0d0d0d; }
.calendar-day-base:active { .calendar-day-base:active, .calendar-day-base:selected {
color: white; color: white;
background-color: #215d9c; background-color: #215d9c;
border-color: transparent; } border-color: transparent; }

@ -1 +1 @@
Subproject commit 31aac7f7b524786965e4c9a1890009ea362b9c87 Subproject commit d184e5c44ed824ab62fc35a4a8d75cda1f387206

View File

@ -769,7 +769,7 @@ StScrollBar {
border-radius: 1.4em; } border-radius: 1.4em; }
.calendar-day-base:hover, .calendar-day-base:focus { .calendar-day-base:hover, .calendar-day-base:focus {
background-color: #454c4c; } background-color: #454c4c; }
.calendar-day-base:active { .calendar-day-base:active, .calendar-day-base:selected {
color: white; color: white;
background-color: #215d9c; background-color: #215d9c;
border-color: transparent; } border-color: transparent; }

View File

@ -686,12 +686,12 @@ const Calendar = new Lang.Class({
this._buttons.forEach(Lang.bind(this, function(button) { this._buttons.forEach(Lang.bind(this, function(button) {
if (sameDay(button._date, this._selectedDate)) { if (sameDay(button._date, this._selectedDate)) {
button.add_style_pseudo_class('active'); button.add_style_pseudo_class('selected');
if (this._shouldDateGrabFocus) if (this._shouldDateGrabFocus)
button.grab_key_focus(); button.grab_key_focus();
} }
else else
button.remove_style_pseudo_class('active'); button.remove_style_pseudo_class('selected');
})); }));
} }
}); });