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 778070 - week-view: height of 30 minute events exceeds the tile.
week-view: height of 30 minute events exceeds the tile.
Status: RESOLVED FIXED
Product: gnome-calendar
Classification: Applications
Component: Views
unspecified
Other Linux
: Normal normal
: 3.26
Assigned To: GNOME Calendar maintainers
GNOME Calendar maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-02 10:28 UTC by Mohammed Sadiq
Modified: 2017-03-23 22:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
week-view 30 minute event (image) (1.70 KB, image/png)
2017-02-02 10:28 UTC, Mohammed Sadiq
  Details
week-grid: assign proper tile size to '30 minutes or less' events (1.46 KB, patch)
2017-03-13 08:16 UTC, Yash
none Details | Review
week-grid: assign proper tile size to '30 minutes or less' events (1.88 KB, patch)
2017-03-13 09:10 UTC, Yash
none Details | Review
week-grid: assign proper tile size to '30 minutes or less' events (1.97 KB, patch)
2017-03-13 11:56 UTC, Yash
needs-work Details | Review
week-grid: increase grid cell size (1.18 KB, patch)
2017-03-13 12:02 UTC, Utkarsh Maheshwari
needs-work Details | Review
event-widget: assign display-text in appropriate format to event-widget (8.24 KB, patch)
2017-03-21 23:25 UTC, Yash
none Details | Review
week-grid: remove unneeded usage of natural-height (1.31 KB, patch)
2017-03-21 23:41 UTC, Yash
committed Details | Review
event-widget: assign display-text in appropriate format to event-widget (7.91 KB, patch)
2017-03-23 06:15 UTC, Yash
committed Details | Review

Description Mohammed Sadiq 2017-02-02 10:28:27 UTC
Created attachment 344766 [details]
week-view 30 minute event (image)

in week-view height of 30 minute events exceeds the tile. Please see the attached screenshot.

Thanks
Comment 1 Yash 2017-03-13 08:16:21 UTC
Created attachment 347805 [details] [review]
week-grid: assign proper tile size to '30 minutes or less' events

Earlier the size of the tile for an event which had a duration less than
equal to 30 minutes exceeded the desired size.

This patch fixes this sizing issue by assigning the correct size '33' to
the event, which was earlier assigned wrong size '38'.
Comment 2 Yash 2017-03-13 09:10:56 UTC
Created attachment 347812 [details] [review]
week-grid: assign proper tile size to '30 minutes or less' events

Earlier the size of the tile for an event which had a duration less than
equal to 30 minutes exceeded the desired size.

This patch fixes this sizing issue by assigning the correct size to
the event, which was earlier assigned wrong size.
Comment 3 Yash 2017-03-13 11:56:15 UTC
Created attachment 347823 [details] [review]
week-grid: assign proper tile size to '30 minutes or less' events

Earlier the size of the tile for an event which had a duration less than
equal to 30 minutes exceeded the desired size.

This patch fixes this sizing issue by assigning the correct size to
the event, which was earlier assigned wrong size.
Comment 4 Utkarsh Maheshwari 2017-03-13 12:02:14 UTC
Created attachment 347826 [details] [review]
week-grid: increase grid cell size

The previous grid size was not enough for displaying the 30 minute or
less events and they were "overflowing" into the next half hour.

This fixes the problem by increasing the cell height by a ratio of 
padding.
Comment 5 Georges Basile Stavracas Neto 2017-03-15 00:16:51 UTC
Review of attachment 347823 [details] [review]:

This is the wrong approach. The correct way to handle this is in GcalEventWidget, by checking if the available height is enough to fit the text.

::: src/views/gcal-week-grid.c
@@ +721,3 @@
           child_allocation.width = MAX (width, min_width);
+          /* 48/38 = 1.26 -- (height of 45 mins tile/ height of 30 mins tile) */
+          child_allocation.height = (ABS(height / min_height_corrected) < 1.26) ? min_height_corrected : height;

This is a bad idea. Those sizes work on a default GNOME environment, but e.g. change the font size and it won't be valid anymore.
Comment 6 Georges Basile Stavracas Neto 2017-03-15 00:25:51 UTC
Review of attachment 347826 [details] [review]:

The approach here is also wrong. See the previous comment.
Comment 7 Yash 2017-03-21 23:25:35 UTC
Created attachment 348451 [details] [review]
event-widget: assign display-text in appropriate format to event-widget

Earlier the height of event-widget with duration of 30 mins or less exceeded
the desired space in week-grid. As height available was not checked beforehand,
this resulted in some event-widgets getting height assigned which was more
than the height available.

This patch fixes the erroneous assignment of event-widget's height by first
comparing the required height with the available height. If the required
height exceeds the available height, then the display-text is given as a
single-line for the widget to fit properly.
Comment 8 Yash 2017-03-21 23:41:16 UTC
Created attachment 348452 [details] [review]
week-grid: remove unneeded usage of natural-height

As the assignment of display-text, and in turn that of event-widget's height,
is taken care of in event-widget, we no longer need to consider natural-
height, while assigning height in week-grid.

This patch fixes this issue by removing natural-height, and directly
assigning the desired value to height.
Comment 9 Georges Basile Stavracas Neto 2017-03-23 01:51:22 UTC
Review of attachment 348451 [details] [review]:

Some commenta below.

::: src/gcal-event-widget.c
@@ +134,3 @@
+static gint
+get_maximum_height (GtkWidget         *widget,
+                    GtkOrientation     orientation)

Rename to 'get_vertical_text_height()'. You don't need the 'orientation' param here; just pass GTK_ORIENTATION_VERTICAL.

@@ +580,3 @@
 
+  /* As vertical widgets have the maximum height */
+  max_height = get_maximum_height (widget, GTK_ORIENTATION_VERTICAL);

Don't use a separate var here. Call 'get_vertical_text_height()' directly inside the if().

@@ +592,2 @@
         {
+          display_text = get_visible_text (widget, GTK_ORIENTATION_HORIZONTAL);

One line if()s don't need '{}'s

@@ +595,3 @@
       else
         {
+          display_text = get_visible_text (widget, GTK_ORIENTATION_VERTICAL);

ditto
Comment 10 Georges Basile Stavracas Neto 2017-03-23 01:51:47 UTC
Review of attachment 348452 [details] [review]:

Looks good.
Comment 11 Georges Basile Stavracas Neto 2017-03-23 01:52:01 UTC
Review of attachment 348451 [details] [review]:

Some commenta below.

::: src/gcal-event-widget.c
@@ +134,3 @@
+static gint
+get_maximum_height (GtkWidget         *widget,
+                    GtkOrientation     orientation)

Rename to 'get_vertical_text_height()'. You don't need the 'orientation' param here; just pass GTK_ORIENTATION_VERTICAL.

@@ +580,3 @@
 
+  /* As vertical widgets have the maximum height */
+  max_height = get_maximum_height (widget, GTK_ORIENTATION_VERTICAL);

Don't use a separate var here. Call 'get_vertical_text_height()' directly inside the if().

@@ +592,2 @@
         {
+          display_text = get_visible_text (widget, GTK_ORIENTATION_HORIZONTAL);

One line if()s don't need '{}'s

@@ +595,3 @@
       else
         {
+          display_text = get_visible_text (widget, GTK_ORIENTATION_VERTICAL);

ditto
Comment 12 Yash 2017-03-23 06:15:52 UTC
Created attachment 348550 [details] [review]
event-widget: assign display-text in appropriate format to event-widget

Earlier the height of event-widget with duration of 30 mins or less exceeded
the desired space in week-grid. As height available was not checked beforehand,
this resulted in some event-widgets getting height assigned which was more
than the height available.

This patch fixes the erroneous assignment of event-widget's height by first
comparing the required height with the available height. If the required
height exceeds the available height, then the display-text is given as a
single-line for the widget to fit properly.
Comment 13 Georges Basile Stavracas Neto 2017-03-23 22:59:23 UTC
Thanks for the patches!

Attachment 348452 [details] pushed as 6cc6e4f - week-grid: remove unneeded usage of natural-height
Attachment 348550 [details] pushed as 26ecf3c - event-widget: assign display-text in appropriate format to event-widget