[gnome-panel/gtk3] calendar-window: Port 'size-request' signal
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] calendar-window: Port 'size-request' signal
- Date: Mon, 31 Jan 2011 02:54:16 +0000 (UTC)
commit 7f9470c42ba1264667e8b4f916b3f157c6cd1e54
Author: Germán Póo-Caamaño <gpoo gnome org>
Date: Sun Jan 30 18:53:34 2011 -0800
calendar-window: Port 'size-request' signal
Use gtk_widget_set_size_request() instead of handling
"size-request" signal
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
applets/clock/calendar-window.c | 49 +++++++++++---------------------------
1 files changed, 14 insertions(+), 35 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 8e45984..a2726a3 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1311,55 +1311,34 @@ calendar_month_selected (GtkCalendar *calendar,
handle_tasks_changed (calwin);
}
-typedef struct
-{
- GtkWidget *calendar;
- GtkWidget *tree;
-} ConstraintData;
-
static void
-constrain_list_size (GtkWidget *widget,
- GtkRequisition *requisition,
- ConstraintData *constraint)
+setup_list_size_constraint (GtkWidget *widget,
+ GtkWidget *calendar,
+ GtkWidget *tree)
{
- GtkRequisition req;
+ GtkRequisition req;
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
- int screen_h;
- int max_height;
+ int screen_h;
+ int max_height;
+ int req_height;
- /* constrain width to the calendar width */
- gtk_widget_get_preferred_size (constraint->calendar, &req, NULL);
- requisition->width = MIN (requisition->width, req.width);
+ /* constrain width to the calendar width */
+ gtk_widget_get_preferred_size (calendar, &req, NULL);
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_get_preferred_size (constraint->tree, &req, NULL);
+ max_height = (screen_h - req.height) / 3;
+ gtk_widget_get_preferred_size (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 += padding.top + padding.bottom;
-}
-
-static void
-setup_list_size_constraint (GtkWidget *widget,
- GtkWidget *calendar,
- GtkWidget *tree)
-{
- ConstraintData *constraint;
-
- constraint = g_new0 (ConstraintData, 1);
- constraint->calendar = calendar;
- constraint->tree = tree;
-
- g_signal_connect_data (widget, "size-request",
- G_CALLBACK (constrain_list_size), constraint,
- (GClosureNotify) g_free, 0);
+ req_height = MIN (req.height, max_height);
+ req_height += padding.top + padding.bottom;
+ gtk_widget_set_size_request (widget, req.width, req_height);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]