[gnome-calendar] year-view: initial GtkWidget::size_allocate impl
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] year-view: initial GtkWidget::size_allocate impl
- Date: Fri, 9 Jan 2015 14:30:06 +0000 (UTC)
commit e57d9ca55e51ae60e7c0ed8c3afaf1cd373f998f
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Mon Dec 29 16:35:41 2014 -0500
year-view: initial GtkWidget::size_allocate impl
This impl uses internals structures from GcalSubscriber
src/gcal-year-view.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 554407c..4322cf8 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -60,6 +60,14 @@ static gboolean get_widget_parts (gint
GArray *cells,
GArray *lengths);
+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_year_view_set_property (GObject *object,
@@ -168,6 +176,53 @@ get_widget_parts (gint first_cell,
return TRUE;
}
+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_year_view_class_init (GcalYearViewClass *klass)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]