[gnome-panel/wip/gnome-3.10+: 43/75] Revert "calendar-window: Port 'size-request' signal"
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/gnome-3.10+: 43/75] Revert "calendar-window: Port 'size-request' signal"
- Date: Tue, 7 Oct 2014 22:29:36 +0000 (UTC)
commit 7cc758811f75f6cc4ee8cb498cb8b991b2f3ddc7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Jun 29 22:55:13 2014 +0300
Revert "calendar-window: Port 'size-request' signal"
This reverts commit 7f9470c42ba1264667e8b4f916b3f157c6cd1e54.
applets/clock/calendar-window.c | 49 +++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 14 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 51762e8..ed672fe 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1266,34 +1266,55 @@ calendar_month_selected (GtkCalendar *calendar,
handle_tasks_changed (calwin);
}
+typedef struct
+{
+ GtkWidget *calendar;
+ GtkWidget *tree;
+} ConstraintData;
+
static void
-setup_list_size_constraint (GtkWidget *widget,
- GtkWidget *calendar,
- GtkWidget *tree)
+constrain_list_size (GtkWidget *widget,
+ GtkRequisition *requisition,
+ ConstraintData *constraint)
{
- GtkRequisition req;
+ GtkRequisition req;
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
- int screen_h;
- int max_height;
- int req_height;
+ int screen_h;
+ int max_height;
- /* constrain width to the calendar width */
- gtk_widget_get_preferred_size (calendar, &req, NULL);
+ /* constrain width to the calendar width */
+ 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_get_preferred_size (tree, &req, NULL);
+ max_height = (screen_h - req.height) / 3;
+ 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);
- req_height = MIN (req.height, max_height);
- req_height += padding.top + padding.bottom;
- gtk_widget_set_size_request (widget, req.width, req_height);
+ 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);
}
#endif /* HAVE_EDS */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]