[gnome-panel/gtk3] calendar-window: Port to gtk_widget_get_preferred_size()
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] calendar-window: Port to gtk_widget_get_preferred_size()
- Date: Mon, 31 Jan 2011 02:12:20 +0000 (UTC)
commit 0a72d76b85d2cfe4ef535b8eb30a9d21f4549fbf
Author: Germán Póo-Caamaño <gpoo gnome org>
Date: Sun Jan 30 18:09:56 2011 -0800
calendar-window: Port to gtk_widget_get_preferred_size()
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
applets/clock/calendar-window.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index dcc51e4..8e45984 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1322,21 +1322,28 @@ constrain_list_size (GtkWidget *widget,
GtkRequisition *requisition,
ConstraintData *constraint)
{
- GtkRequisition req;
- int screen_h;
- int max_height;
+ GtkRequisition req;
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder padding;
+ int screen_h;
+ int max_height;
/* constrain width to the calendar width */
- gtk_widget_size_request (constraint->calendar, &req);
+ gtk_widget_get_preferred_size (constraint->calendar, &req, NULL);
requisition->width = MIN (requisition->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 */
max_height = (screen_h - req.height) / 3;
- gtk_widget_size_request (constraint->tree, &req);
+ gtk_widget_get_preferred_size (constraint->tree, &req, NULL);
+
+ state = gtk_widget_get_state_flags (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 += 2 * gtk_widget_get_style (widget)->ythickness;
+ requisition->height += padding.top + padding.bottom;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]