From d9c92598612714683eab96fecf6e90a9531607e5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 Sep 2010 16:35:17 +0200 Subject: Move GtkSizeRequest into GtkWidget It doesn't make sense to keep them separate as GtkSizeRequest requires a GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have one without the other. It also makes the code a lot easier because no casts are required when calling functions. Also, the names would translate to gtk_widget_get_width() and people agreed that this would be a too generic name, so a "preferred" was added to the names. So this patch moves the functions: gtk_size_request_get_request_mode() => gtk_widget_get_request_mode() gtk_size_request_get_width() => gtk_widget_get_preferred_width() gtk_size_request_get_height() => gtk_widget_get_preferred_height() gtk_size_request_get_size() => gtk_widget_get_preferred_size() gtk_size_request_get_width_for_height() => gtk_widget_get_preferred_width_for_height() gtk_size_request_get_height_for_width() => gtk_widget_get_preferred_height_for_width() ... and moves the corresponding vfuncs to the GtkWidgetClass. The patch also renames the implementations of the vfuncs in widgets to include the word "preferrred". --- tests/gtkoffscreenbox.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/gtkoffscreenbox.c') diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c index c8e6250724..a9722efd80 100644 --- a/tests/gtkoffscreenbox.c +++ b/tests/gtkoffscreenbox.c @@ -478,7 +478,7 @@ gtk_offscreen_box_size_request (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1), + gtk_widget_get_preferred_size ( (offscreen_box->child1), &child_requisition, NULL); w = MAX (w, CHILD1_SIZE_SCALE * child_requisition.width); @@ -489,7 +489,7 @@ gtk_offscreen_box_size_request (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2), + gtk_widget_get_preferred_size ( (offscreen_box->child2), &child_requisition, NULL); w = MAX (w, CHILD2_SIZE_SCALE * child_requisition.width); @@ -529,8 +529,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; GtkAllocation child_allocation; - gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1), - &child_requisition, NULL); + gtk_widget_get_preferred_size (offscreen_box->child1, + &child_requisition, NULL); child_allocation.x = child_requisition.width * (CHILD1_SIZE_SCALE - 1.0) / 2; child_allocation.y = start_y + child_requisition.height * (CHILD1_SIZE_SCALE - 1.0) / 2; child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width); @@ -554,8 +554,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget, GtkRequisition child_requisition; GtkAllocation child_allocation; - gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2), - &child_requisition, NULL); + gtk_widget_get_preferred_size (offscreen_box->child2, + &child_requisition, NULL); child_allocation.x = child_requisition.width * (CHILD2_SIZE_SCALE - 1.0) / 2; child_allocation.y = start_y + child_requisition.height * (CHILD2_SIZE_SCALE - 1.0) / 2; child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width); -- cgit v1.2.1