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:
@ -36,7 +36,6 @@
|
||||
#include "gtkcontainer.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkactivatable.h"
|
||||
#include "gtksizerequest.h"
|
||||
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
@ -346,8 +345,7 @@ gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
||||
GtkRequisition image_requisition;
|
||||
guint toggle_spacing;
|
||||
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
|
||||
&image_requisition, NULL);
|
||||
gtk_widget_get_preferred_size (priv->image, &image_requisition, NULL);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu_item),
|
||||
"toggle-spacing", &toggle_spacing,
|
||||
@ -442,8 +440,7 @@ gtk_image_menu_item_size_request (GtkWidget *widget,
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
|
||||
&child_requisition, NULL);
|
||||
gtk_widget_get_preferred_size (priv->image, &child_requisition, NULL);
|
||||
|
||||
child_width = child_requisition.width;
|
||||
child_height = child_requisition.height;
|
||||
@ -501,8 +498,7 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
* come up with a solution that's really better.
|
||||
*/
|
||||
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
|
||||
&child_requisition, NULL);
|
||||
gtk_widget_get_preferred_size (priv->image, &child_requisition, NULL);
|
||||
|
||||
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user