[gnome-calendar/wip/pandusonu/week-view: 24/31] week-header: work around with GtkOverlay error



commit 30dcc084431f76b7cace4c3a4005c8e0d2cc0d1d
Author: pandusonu2 <pandu sonu yahoo com>
Date:   Wed Jul 20 18:22:35 2016 +0530

    week-header: work around with GtkOverlay error
    
    Using the height request function to fix the error with height allocation of GtkOverlay widget.

 data/ui/week-header.ui       |    1 +
 src/views/gcal-week-header.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/week-header.ui b/data/ui/week-header.ui
index a504110..06f5172 100644
--- a/data/ui/week-header.ui
+++ b/data/ui/week-header.ui
@@ -95,6 +95,7 @@
                             <property name="hexpand">True</property>
                             <property name="column-spacing">8</property>
                             <property name="row-spacing">2</property>
+                            <signal name="size-allocate" handler="fix_background_size_request" 
object="GcalWeekHeader" swapped="yes" />
                             <child>
                               <object class="GtkBox">
                                 <property name="visible">True</property>
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index 07dc94e..be52b4f 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -84,6 +84,10 @@ static void           header_expand                         (GcalWeekHeader *sel
 static void           on_expand_action_activated            (GcalWeekHeader *self,
                                                              gpointer        user_data);
 
+static void           fix_background_size_request           (GcalWeekHeader *self,
+                                                             GdkRectangle   *allocation,
+                                                             GtkWidget      *widget);
+
 static void           gcal_week_header_finalize             (GObject *object);
 
 static void           gcal_week_header_get_property         (GObject    *object,
@@ -448,6 +452,14 @@ on_expand_action_activated (GcalWeekHeader *self,
 }
 
 static void
+fix_background_size_request (GcalWeekHeader *self,
+                             GdkRectangle   *allocation,
+                             GtkWidget      *widget)
+{
+  gtk_widget_set_size_request (self->draw_area, -1, allocation->height + gtk_widget_get_margin_top 
(self->scrolledwindow));
+}
+
+static void
 gcal_week_header_finalize (GObject *object)
 {
   GcalWeekHeader *self = GCAL_WEEK_HEADER (object);
@@ -773,6 +785,7 @@ gcal_week_header_class_init (GcalWeekHeaderClass *kclass)
 
   gtk_widget_class_bind_template_callback (widget_class, gcal_week_header_draw);
   gtk_widget_class_bind_template_callback (widget_class, on_expand_action_activated);
+  gtk_widget_class_bind_template_callback (widget_class, fix_background_size_request);
 
   gtk_widget_class_set_css_name (widget_class, "calendar-view");
 }


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