[gnome-calendar/wip/pandusonu/week-view: 19/31] week-header: set correct padding for the grid



commit ae996e0715fa99f618696e7526f4d9658a10ce7e
Author: pandusonu2 <pandu sonu yahoo com>
Date:   Sat Jun 25 05:18:40 2016 +0530

    week-header: set correct padding for the grid
    
    Set the margin top, left, and right for the grid, according to the mockups.

 data/ui/week-header.ui       |    2 +-
 src/views/gcal-week-header.c |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/week-header.ui b/data/ui/week-header.ui
index ccbd493..212de4a 100644
--- a/data/ui/week-header.ui
+++ b/data/ui/week-header.ui
@@ -65,7 +65,7 @@
                         <property name="visible">True</property>
                         <property name="column-homogeneous">True</property>
                         <property name="hexpand">True</property>
-                        <property name="column-spacing">7</property>
+                        <property name="column-spacing">8</property>
                         <property name="row-spacing">2</property>
                         <child>
                           <object class="GtkBox">
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index b315df9..7a3077b 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -331,15 +331,29 @@ gcal_week_header_size_allocate (GtkWidget     *widget,
   GcalWeekHeader *self = GCAL_WEEK_HEADER (widget);
   GtkStyleContext *context;
   GtkStateFlags state;
+  GtkAllocation draw_alloc;
+
+  gdouble sidebar_width, cell_width;
 
   PangoFontDescription *bold_font;
 
   context = gtk_widget_get_style_context (self->draw_area);
   state = gtk_widget_get_state_flags (self->draw_area);
+  sidebar_width = gcal_week_view_get_sidebar_width (self->draw_area);
+
+  gtk_widget_get_allocation (self->draw_area, &draw_alloc);
+
+  cell_width = (draw_alloc.width - sidebar_width) / 7;
 
   gtk_style_context_get (context, state, "font", &bold_font, NULL);
   pango_font_description_set_weight (bold_font, PANGO_WEIGHT_SEMIBOLD);
 
+  gtk_widget_set_margin_start (self->scrolledwindow,
+                               gcal_week_view_get_sidebar_width (self->draw_area) + 1);
+
+  gtk_widget_set_margin_end (self->scrolledwindow,
+                             gtk_widget_get_allocated_width (self->draw_area) - cell_width * 7 - 
sidebar_width + 7);
+
   gtk_widget_set_margin_top (self->scrolledwindow,
                              (4 * pango_font_description_get_size (bold_font)) / PANGO_SCALE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]