[gnome-calendar] month-view: simplify code
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: simplify code
- Date: Sat, 29 Apr 2017 15:57:43 +0000 (UTC)
commit 817325da05c0caefcbef218d40ac3ff2bbbf8480
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Apr 29 12:56:19 2017 -0300
month-view: simplify code
src/views/gcal-month-view.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/views/gcal-month-view.c b/src/views/gcal-month-view.c
index 7f400dc..8cb77c0 100644
--- a/src/views/gcal-month-view.c
+++ b/src/views/gcal-month-view.c
@@ -487,9 +487,13 @@ get_widget_parts (gint first_cell,
GArray *cells,
GArray *lengths)
{
- gint i;
+ gdouble old_y;
+ gdouble y;
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)
{
@@ -501,24 +505,21 @@ get_widget_parts (gint first_cell,
for (i = first_cell; i <= last_cell; i++)
{
if (size_left[i] < natural_height)
+ return FALSE;
+
+ y = vertical_cell_space - size_left[i];
+
+ if (old_y == -1.0 || y != old_y)
{
- return FALSE;
+ current_part_length = 1;
+ g_array_append_val (cells, i);
+ g_array_append_val (lengths, current_part_length);
+ old_y = y;
}
else
{
- y = vertical_cell_space - size_left[i];
- if (y != old_y)
- {
- current_part_length = 1;
- g_array_append_val (cells, i);
- g_array_append_val (lengths, current_part_length);
- old_y = y;
- }
- else
- {
- current_part_length++;
- g_array_index (lengths, gint, lengths->len - 1) = current_part_length;
- }
+ current_part_length++;
+ g_array_index (lengths, gint, lengths->len - 1) = current_part_length;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]