month-view: simplify code

This commit is contained in:
Georges Basile Stavracas Neto
2017-04-29 12:57:06 -03:00
parent 7dc5eb5bf5
commit 817325da05
+9 -8
View File
@@ -487,9 +487,13 @@ get_widget_parts (gint first_cell,
GArray *cells, GArray *cells,
GArray *lengths) GArray *lengths)
{ {
gint i; gdouble old_y;
gdouble y;
gint current_part_length; gint current_part_length;
gdouble y, old_y = - 1.0; gint i;
old_y = -1.0;
current_part_length = 0;
if (last_cell < first_cell) if (last_cell < first_cell)
{ {
@@ -501,13 +505,11 @@ get_widget_parts (gint first_cell,
for (i = first_cell; i <= last_cell; i++) for (i = first_cell; i <= last_cell; i++)
{ {
if (size_left[i] < natural_height) if (size_left[i] < natural_height)
{
return FALSE; return FALSE;
}
else
{
y = vertical_cell_space - size_left[i]; y = vertical_cell_space - size_left[i];
if (y != old_y)
if (old_y == -1.0 || y != old_y)
{ {
current_part_length = 1; current_part_length = 1;
g_array_append_val (cells, i); g_array_append_val (cells, i);
@@ -520,7 +522,6 @@ get_widget_parts (gint first_cell,
g_array_index (lengths, gint, lengths->len - 1) = current_part_length; g_array_index (lengths, gint, lengths->len - 1) = current_part_length;
} }
} }
}
return TRUE; return TRUE;
} }