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".
This commit is contained in:
@ -946,8 +946,7 @@ set_default_size (GtkRecentChooserDefault *impl)
|
||||
height = (impl->icon_size + font_size) * NUM_LINES;
|
||||
|
||||
/* Use at least the requisition size... */
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
|
||||
&req, NULL);
|
||||
gtk_widget_get_preferred_size (widget, &req, NULL);
|
||||
width = MAX (width, req.width);
|
||||
height = MAX (height, req.height);
|
||||
|
||||
@ -1849,8 +1848,8 @@ popup_position_func (GtkMenu *menu,
|
||||
gdk_window_get_origin (gtk_widget_get_window (widget),
|
||||
x, y);
|
||||
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
|
||||
&req, NULL);
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (menu),
|
||||
&req, NULL);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
*x += (allocation.width - req.width) / 2;
|
||||
|
||||
Reference in New Issue
Block a user