From 7e53a977b0ebb908b1e735455b38609cfc148b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Sun, 29 Jun 2014 23:14:18 +0300 Subject: [PATCH 2/2] clock: port 'size-request' signal Use "size-allocate" signal instead of "size-request" to set size request for scrolled_window. --- applets/clock/calendar-window.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c index f4f2b74..70fd0fc 100644 --- a/applets/clock/calendar-window.c +++ b/applets/clock/calendar-window.c @@ -1277,7 +1277,7 @@ typedef struct static void constrain_list_size (GtkWidget *widget, - GtkRequisition *requisition, + GtkAllocation *allocation, ConstraintData *constraint) { GtkRequisition req; @@ -1285,11 +1285,13 @@ constrain_list_size (GtkWidget *widget, GtkStateFlags state; GtkBorder padding; int screen_h; + int width; + int height; int max_height; /* constrain width to the calendar width */ gtk_widget_get_preferred_size (constraint->calendar, &req, NULL); - requisition->width = MIN (requisition->width, req.width); + width = MIN (allocation->width, req.width); screen_h = gdk_screen_get_height (gtk_widget_get_screen (widget)); /* constrain height to be the tree height up to a max */ @@ -1300,8 +1302,12 @@ constrain_list_size (GtkWidget *widget, context = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (context, state, &padding); - requisition->height = MIN (req.height, max_height); - requisition->height += padding.top + padding.bottom; + height = MIN (req.height, max_height); + height += padding.top + padding.bottom; + /* top & bottom border */ + height += 2; + + gtk_widget_set_size_request (widget, width, height); } static void @@ -1315,7 +1321,7 @@ setup_list_size_constraint (GtkWidget *widget, constraint->calendar = calendar; constraint->tree = tree; - g_signal_connect_data (widget, "size-request", + g_signal_connect_data (widget, "size-allocate", G_CALLBACK (constrain_list_size), constraint, (GClosureNotify) g_free, 0); } -- 2.1.0.rc1