diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index c471b038..1f90e829 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -97,6 +97,14 @@ static gint get_cell_and_center_from_position (GcalMonthView *vie static gdouble get_start_grid_y (GtkWidget *widget); +static gboolean get_widget_parts (gint first_cell, + gint last_cell, + gint natural_height, + gdouble vertical_cell_space, + gdouble *size_left, + GArray *cells, + GArray *lengths); + static void gcal_view_interface_init (GcalViewIface *iface); static void gcal_month_view_set_property (GObject *object, @@ -251,6 +259,53 @@ get_start_grid_y (GtkWidget *widget) return start_grid_y; } +static gboolean +get_widget_parts (gint first_cell, + gint last_cell, + gint natural_height, + gdouble vertical_cell_space, + gdouble *size_left, + GArray *cells, + GArray *lengths) +{ + gint i; + gint current_part_length; + gdouble y, old_y = - 1.0; + + if (last_cell < first_cell) + { + gint swap = last_cell; + last_cell = first_cell; + first_cell = swap; + } + + for (i = first_cell; i <= last_cell; i++) + { + if (size_left[i] < natural_height) + { + return FALSE; + } + 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; + } + } + } + + return TRUE; +} + static void gcal_month_view_class_init (GcalMonthViewClass *klass) {