After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 641383 - Calendar menu changes height with some months
Calendar menu changes height with some months
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: calendar
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-02-03 17:50 UTC by Milan Bouchet-Valat
Modified: 2013-03-04 18:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Calendar: force all months at the same height (3.09 KB, patch)
2012-10-23 16:22 UTC, Giovanni Campagna
needs-work Details | Review
Calendar: freeze updates when the event source is loading (6.31 KB, patch)
2012-10-23 16:48 UTC, Giovanni Campagna
reviewed Details | Review
Calendar menu with 5 weeks month (525.49 KB, image/png)
2012-11-01 15:22 UTC, Giovanni Campagna
  Details
Calendar menu with 6 weeks month (525.79 KB, image/png)
2012-11-01 15:22 UTC, Giovanni Campagna
  Details
Calendar: force all months at the same height (3.13 KB, patch)
2012-12-03 18:59 UTC, Giovanni Campagna
none Details | Review
Calendar: freeze updates when the event source is loading (6.33 KB, patch)
2012-12-03 19:01 UTC, Giovanni Campagna
reviewed Details | Review
6 weeks (994.56 KB, image/png)
2012-12-10 22:56 UTC, Giovanni Campagna
  Details
4 weeks (994.35 KB, image/png)
2012-12-10 22:57 UTC, Giovanni Campagna
  Details
Calendar: dim days from other months, even if they have events (1.02 KB, patch)
2012-12-17 21:29 UTC, Giovanni Campagna
committed Details | Review
Calendar: force all months at the same height (3.49 KB, patch)
2013-01-19 19:16 UTC, Giovanni Campagna
committed Details | Review
Calendar: freeze updates when the event source is loading (1.99 KB, patch)
2013-03-04 16:07 UTC, Giovanni Campagna
committed Details | Review
Calendar: clean up code by always having an event source (5.38 KB, patch)
2013-03-04 16:07 UTC, Giovanni Campagna
committed Details | Review

Description Milan Bouchet-Valat 2011-02-03 17:50:46 UTC
Some months need 6 lines to be displayed, while others only need 5 (compare for example April and May 2011); 4 weeks also exists (see February 2010). When viewing a month with a different number of lines than the current one, the menu changes height, which doesn't feel good. Instead, a kind of size group should be used so that padding fills the free space when a month with only 3 or 5 weeks is shown.
Comment 1 Allan Day 2012-10-03 09:58:15 UTC
I agree that this would be more elegant.
Comment 2 Giovanni Campagna 2012-10-23 16:22:39 UTC
Created attachment 227077 [details] [review]
Calendar: force all months at the same height

Add extra hidden weeks to avoid having the menu change height
when navigating it.
Comment 3 Giovanni Campagna 2012-10-23 16:48:10 UTC
Created attachment 227080 [details] [review]
Calendar: freeze updates when the event source is loading

Check if the event source is currently doing an async call, and prevent
UI updates in that case. This avoids a flash of "No updates" when switching
months.
Also, some general code cleanups (and possible memory leak fixes) around
event sources.

Another similar issue, this time with events and for the horizontal direction.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-10-29 20:40:56 UTC
Review of attachment 227077 [details] [review]:

::: js/ui/calendar.js
@@ +555,3 @@
         let iter = new Date(beginDate);
         let row = 2;
+        // We want to show always 6 weeks (to keep the calendar menu at the same

6 weeks?

@@ +558,3 @@
+        // height if there are no events), so we pad it with hidden days from the
+        // following month.
+        let nRows = 8;

Unused.

@@ +559,3 @@
+        // following month.
+        let nRows = 8;
+        let finished = false;

I'd prefer a better variable name for this.

@@ +560,3 @@
+        let nRows = 8;
+        let finished = false;
+        while (row < 8) {

8 weeks? What's going on?
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-10-29 20:42:38 UTC
Review of attachment 227080 [details] [review]:

I'd prefer the code cleanups in a separate patch; otherwise looks good.
Comment 6 Giovanni Campagna 2012-10-29 20:54:58 UTC
There are months that are displayed with 6 weeks (Dec 2012 is an example). 8 rows is 6 weeks + the table header + the navigation bar. I should probably explain it in a comment.

Btw, I'm not sure I personally like this solution, it adds empty space at the end of the calendar, and without the events pane it just looks odd.
Comment 7 Allan Day 2012-11-01 09:16:32 UTC
(In reply to comment #6)
...
> Btw, I'm not sure I personally like this solution, it adds empty space at the
> end of the calendar, and without the events pane it just looks odd.

Can you post some screenshots?
Comment 8 Giovanni Campagna 2012-11-01 15:21:39 UTC
Sure
Comment 9 Giovanni Campagna 2012-11-01 15:22:28 UTC
Created attachment 227810 [details]
Calendar menu with 5 weeks month
Comment 10 Giovanni Campagna 2012-11-01 15:22:57 UTC
Created attachment 227811 [details]
Calendar menu with 6 weeks month
Comment 11 Allan Day 2012-11-05 10:04:05 UTC
Thanks Giovanni. I see the problem... I was wondering about reducing the padding below the calendar, or removing the separator. Not sure about that now though. Jimmac - what do you think?
Comment 12 Jakub Steiner 2012-11-05 12:39:19 UTC
I personally prefer the menu changing dimensions to introducing these gaps.
Comment 13 Allan Day 2012-11-05 13:57:19 UTC
(In reply to comment #12)
> I personally prefer the menu changing dimensions to introducing these gaps.

I'm inclined to agree. If there's no other solution, we should probably close this as notabug.
Comment 14 Jasper St. Pierre (not reading bugmail) 2012-11-05 17:31:16 UTC
What Windows 7 does is always show the Calendar with 6 weeks of context, even if one of those weeks is entirely grayed out. We could make the "gray out" more obvious, and always show 6 weeks.
Comment 15 Allan Day 2012-11-08 08:27:38 UTC
(In reply to comment #14)
> What Windows 7 does is always show the Calendar with 6 weeks of context, even
> if one of those weeks is entirely grayed out. We could make the "gray out" more
> obvious, and always show 6 weeks.

That would work.
Comment 16 Jasper St. Pierre (not reading bugmail) 2012-11-08 15:03:56 UTC
I double checked on a 4-week month (like February 2009), and it centers the four weeks inside one week of context on either side.
Comment 17 Giovanni Campagna 2012-12-03 18:59:36 UTC
Created attachment 230565 [details] [review]
Calendar: force all months at the same height

Add one or two weeks from nearby months to avoid changing the menu height
when navigating it.
Comment 18 Giovanni Campagna 2012-12-03 19:01:03 UTC
Created attachment 230566 [details] [review]
Calendar: freeze updates when the event source is loading

Check if the event source is currently doing an async call, and prevent
UI updates in that case. This avoids a flash of "No updates" when switching
months.
Also, some general code cleanups (and possible memory leak fixes) around
event sources.
Comment 19 Jasper St. Pierre (not reading bugmail) 2012-12-03 19:01:38 UTC
Screenshot?
Comment 20 Giovanni Campagna 2012-12-10 22:56:47 UTC
Created attachment 231219 [details]
6 weeks
Comment 21 Giovanni Campagna 2012-12-10 22:57:11 UTC
Created attachment 231221 [details]
4 weeks
Comment 22 Allan Day 2012-12-11 11:10:42 UTC
lgtm
Comment 23 Rui Matos 2012-12-11 13:12:43 UTC
Review of attachment 230565 [details] [review]:

This leaves some months like April 2012 looking visually unbalanced because it starts on the beginning of the first row and then ends with row nr. 6 empty and row nr. 5 having only 2 days. I think a better approach is to add the empty row, when it's needed, as the first one if the number of days to the week start is less than the number of days until the week end. E.g. for this month it would be (0 < 5) .
Comment 24 Giovanni Campagna 2012-12-11 15:36:56 UTC
Btw, I just looked at GtkCalendar and gnome-calendar.
GtkCalendar has no special handling for 4 weeks and forces everything to 6 weeks by adding padding at the end.
gnome-calendar does something very fancy, in that it introduces two half-height rows for 5 weeks, so that the content is always centered.

It is probably desirable to have consistency here, so it would be nice if designers could agree on a common pattern to be applied across all GNOME calendars.
Comment 25 Allan Day 2012-12-14 09:31:52 UTC
(In reply to comment #24)
> Btw, I just looked at GtkCalendar and gnome-calendar.
> GtkCalendar has no special handling for 4 weeks and forces everything to 6
> weeks by adding padding at the end.
> gnome-calendar does something very fancy, in that it introduces two half-height
> rows for 5 weeks, so that the content is always centered.
> 
> It is probably desirable to have consistency here, so it would be nice if
> designers could agree on a common pattern to be applied across all GNOME
> calendars.

The approach being used here is what I've advised for gnome-calendar. (I'm not sure that the half-row approach works tbh.)

One thing I did notice when testing this is that it can be difficult to identify the month when their are events for visible days in the previous and next months. It would be good if we could add a separate style for these days, so we can dim them.
Comment 26 Giovanni Campagna 2012-12-17 21:29:00 UTC
Created attachment 231777 [details] [review]
Calendar: dim days from other months, even if they have events

Invert the order of the declarations, so those for calendar-other-month-day
take priority over those for calendar-day-with-events.

Patches are still missing code review, btw...
Comment 27 Allan Day 2012-12-18 10:10:40 UTC
(In reply to comment #26)
> Created an attachment (id=231777) [details] [review]
> Calendar: dim days from other months, even if they have events
...

Thanks for working on this, Giovanni. I probably wasn't clear before (sorry): I think that we will need an additional .calendar-other-month-day-with-events style for this.
Comment 28 Jasper St. Pierre (not reading bugmail) 2012-12-18 10:17:00 UTC
Make it three separate style classes: .calendar-day.other-month.has-events
Comment 29 Giovanni Campagna 2012-12-18 15:12:46 UTC
source(In reply to comment #27)
> (In reply to comment #26)
> > Created an attachment (id=231777) [details] [review] [details] [review]
> > Calendar: dim days from other months, even if they have events
> ...
> 
> Thanks for working on this, Giovanni. I probably wasn't clear before (sorry): I
> think that we will need an additional .calendar-other-month-day-with-events
> style for this.

Style classes can be combined, like .calendar-other-month-day.calendar-day-with-events.
I just did the move because I didn't think we needed another color for those days, but maybe it's better if you handle this, as you understand visual design more than me.
Comment 30 Jasper St. Pierre (not reading bugmail) 2013-01-15 18:27:14 UTC
(In reply to comment #26)
> Patches are still missing code review, btw...

Rui reviewed the first patch, and I'm not sure which patches we should use, here. Please reattach.

(In reply to comment #28)
> Make it three separate style classes: .calendar-day.other-month.has-events

And please update for this feedback as well.
Comment 31 Giovanni Campagna 2013-01-15 21:14:42 UTC
(In reply to comment #30)
> (In reply to comment #26)
> > Patches are still missing code review, btw...
> 
> Rui reviewed the first patch, and I'm not sure which patches we should use,
> here. Please reattach.

All of them are to be used.

> (In reply to comment #28)
> > Make it three separate style classes: .calendar-day.other-month.has-events
> 
> And please update for this feedback as well.

There is nothing to there: style classes are already separated, and adding a .calendar-day-other-month.calendar-day-with-events selector would be redundant with .calendar-other-month-day - unless I changed the color, but I honestly don't know what color to use.
And no, I won't change the code to use 'other-month' or 'has-events' as style classes, they don't make sense on their own, they are less readable than calendar-day-* and they require combining selectors, which makes the style priorities more complex for no practical gain.
Comment 32 Jasper St. Pierre (not reading bugmail) 2013-01-17 23:06:26 UTC
Review of attachment 230565 [details] [review]:

::: js/ui/calendar.js
@@ +561,3 @@
+        if (this._weekStart == beginDate.getDay() &&
+            beginDate.getMonth() == 1 &&
+            ((year % 4) != 0 || ((year % 100) == 0 && (year % 400) != 0))) {

Can we not use some of the other logic, like that in _getCalendarWeekForDate, to determine if a month has four weeks?
Comment 33 Giovanni Campagna 2013-01-19 19:16:41 UTC
Created attachment 233889 [details] [review]
Calendar: force all months at the same height

Add one or two weeks from nearby months to avoid changing the menu height
when navigating it.
Comment 34 Jasper St. Pierre (not reading bugmail) 2013-03-03 21:22:20 UTC
Review of attachment 230566 [details] [review]:

Can you split out some of the cleanups and memory leak fixes here? It's sort of difficult to review with everything squashed together.

::: js/ui/calendar.js
@@ +581,3 @@
             let rtl = button.get_text_direction() == Clutter.TextDirection.RTL;
 
+            if (this._eventSource.isDummy)

This seems silly to me. I don't see why we should prevent clicking on the day if we don't have an event source. I know it's a sort of pre-existing thing, but...
Comment 35 Jasper St. Pierre (not reading bugmail) 2013-03-03 21:32:47 UTC
Review of attachment 231777 [details] [review]:

OK.
Comment 36 Jasper St. Pierre (not reading bugmail) 2013-03-03 21:33:36 UTC
Review of attachment 233889 [details] [review]:

OK.
Comment 37 Giovanni Campagna 2013-03-04 16:05:40 UTC
(In reply to comment #34)
> Review of attachment 230566 [details] [review]:
> 
> ::: js/ui/calendar.js
> @@ +581,3 @@
>              let rtl = button.get_text_direction() ==
> Clutter.TextDirection.RTL;
> 
> +            if (this._eventSource.isDummy)
> 
> This seems silly to me. I don't see why we should prevent clicking on the day
> if we don't have an event source. I know it's a sort of pre-existing thing,
> but...

Because the events pane is invisible if isDummy, so clicking has no effect.
Comment 38 Giovanni Campagna 2013-03-04 16:07:05 UTC
Created attachment 238003 [details] [review]
Calendar: freeze updates when the event source is loading

Check if the event source is currently doing an async call, and prevent
UI updates in that case. This avoids a flash of "No updates" when switching
months.
Also, some general code cleanups (and possible memory leak fixes) around
event sources.
Comment 39 Giovanni Campagna 2013-03-04 16:07:17 UTC
Created attachment 238004 [details] [review]
Calendar: clean up code by always having an event source

Instead of sometimes having an event source and sometimes not, use
the empty event source when the session mode says the calendar is
disabled. This way, the code can assume an event source object and
avoid checks.
Comment 40 Jasper St. Pierre (not reading bugmail) 2013-03-04 17:53:22 UTC
Review of attachment 238004 [details] [review]:

OK.
Comment 41 Jasper St. Pierre (not reading bugmail) 2013-03-04 17:53:44 UTC
Review of attachment 238003 [details] [review]:

Commit message needs update, but OK.
Comment 42 Giovanni Campagna 2013-03-04 17:57:37 UTC
I'll assume no freeze break is needed, given that it's a small bug fix, it has no documentation impact, and you marked it acn rather than acf.
Comment 43 Giovanni Campagna 2013-03-04 17:59:51 UTC
Attachment 231777 [details] pushed as ec39aa3 - Calendar: dim days from other months, even if they have events
Attachment 233889 [details] pushed as 69cdc5a - Calendar: force all months at the same height
Attachment 238003 [details] pushed as 443fe81 - Calendar: freeze updates when the event source is loading
Attachment 238004 [details] pushed as beb0fdf - Calendar: clean up code by always having an event source