[gnome-calendar] month-view: add widgets margin to its allocation
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: add widgets margin to its allocation
- Date: Mon, 16 Feb 2015 14:32:42 +0000 (UTC)
commit a4212d16f2200c2332eb6ce299e10cdc54828ec4
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sun Feb 15 11:07:12 2015 -0500
month-view: add widgets margin to its allocation
src/gcal-month-view.c | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 6774ce5..37f27b8 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -772,6 +772,7 @@ gcal_month_view_size_allocate (GtkWidget *widget,
gint i, j, sw, shown_rows;
+ GtkBorder margin;
gint padding_bottom, font_height;
PangoLayout *layout;
PangoFontDescription *font_desc;
@@ -917,13 +918,6 @@ gcal_month_view_size_allocate (GtkWidget *widget,
gint cell_idx = g_array_index (cells, gint, i);
gint row = cell_idx / 7;
gint column = cell_idx % 7;
- pos_x = cell_width * column;
- pos_y = cell_height * (row + first_row_gap) + start_grid_y;
-
- child_allocation.x = pos_x;
- child_allocation.y = pos_y + vertical_cell_space - size_left[cell_idx];
- child_allocation.width = cell_width * g_array_index (lengths, gint, i);
- child_allocation.height = natural_height;
if (i != 0)
{
@@ -955,12 +949,24 @@ gcal_month_view_size_allocate (GtkWidget *widget,
gtk_style_context_add_class (gtk_widget_get_style_context (child_widget), "slanted-end");
}
+ gtk_style_context_get_margin (gtk_widget_get_style_context (child_widget),
+ gtk_widget_get_state_flags (child_widget),
+ &margin);
+
+ pos_x = cell_width * column + margin.left;
+ pos_y = cell_height * (row + first_row_gap) + start_grid_y + margin.top;
+
+ child_allocation.x = pos_x;
+ child_allocation.y = pos_y + vertical_cell_space - size_left[cell_idx];
+ child_allocation.width = cell_width * g_array_index (lengths, gint, i) - (margin.left +
margin.right);
+ child_allocation.height = natural_height;
+
gtk_widget_size_allocate (child_widget, &child_allocation);
g_hash_table_remove (ppriv->hidden_as_overflow, uuid);
/* update size_left */
for (j = 0; j < g_array_index (lengths, gint, i); j++)
- size_left[cell_idx + j] -= natural_height;
+ size_left[cell_idx + j] -= natural_height + margin.top + margin.bottom;
}
}
else
@@ -1005,18 +1011,22 @@ gcal_month_view_size_allocate (GtkWidget *widget,
if (size_left[i] > natural_height)
{
- pos_x = cell_width * (i % 7);
- pos_y = cell_height * ((i / 7) + first_row_gap) + start_grid_y;
+ gtk_style_context_get_margin (gtk_widget_get_style_context (child_widget),
+ gtk_widget_get_state_flags (child_widget),
+ &margin);
+
+ pos_x = cell_width * (i % 7) + margin.left;
+ pos_y = cell_height * ((i / 7) + first_row_gap) + start_grid_y + margin.top;
child_allocation.x = pos_x;
child_allocation.y = pos_y + vertical_cell_space - size_left[i];
- child_allocation.width = cell_width;
+ child_allocation.width = cell_width - (margin.left + margin.right);
child_allocation.height = natural_height;
gtk_widget_show (child_widget);
gtk_widget_size_allocate (child_widget, &child_allocation);
g_hash_table_remove (ppriv->hidden_as_overflow, uuid);
- size_left[i] -= natural_height;
+ size_left[i] -= natural_height + margin.top + margin.bottom;
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]