diff options
author | Benjamin Otte <otte@redhat.com> | 2010-09-21 16:35:17 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-09-26 15:11:45 +0200 |
commit | d9c92598612714683eab96fecf6e90a9531607e5 (patch) | |
tree | 4091fc22f94eeed203385670e1eb05d43b6f264c /gtk/gtktoolbar.c | |
parent | f52a1fcfbde5c1b1108d4a03a9bf5c409b59a73e (diff) | |
download | gtk+-d9c92598612714683eab96fecf6e90a9531607e5.tar.gz |
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".
Diffstat (limited to 'gtk/gtktoolbar.c')
-rw-r--r-- | gtk/gtktoolbar.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index e0692a1386..46d37cf287 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -53,7 +53,6 @@ #include "gtkseparatormenuitem.h" #include "gtkseparatortoolitem.h" #include "gtkstock.h" -#include "gtksizerequest.h" #include "gtktoolshell.h" #include "gtkvbox.h" #include "gtkprivate.h" @@ -923,8 +922,8 @@ gtk_toolbar_size_request (GtkWidget *widget, if (priv->show_arrow) { - gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), - &arrow_requisition, NULL); + gtk_widget_get_preferred_size (priv->arrow_button, + &arrow_requisition, NULL); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) long_req = arrow_requisition.width; @@ -1453,8 +1452,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget, border_width += get_internal_padding (toolbar); - gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), - &arrow_requisition, NULL); + gtk_widget_get_preferred_size (priv->arrow_button, + &arrow_requisition, NULL); shadow_type = get_shadow_type (toolbar); @@ -2322,8 +2321,8 @@ gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, g_assert (content); g_assert (toolbar_content_is_placeholder (content)); - gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->highlight_tool_item), - &requisition, NULL); + gtk_widget_get_preferred_size (GTK_WIDGET (priv->highlight_tool_item), + &requisition, NULL); toolbar_content_set_expand (content, gtk_tool_item_get_expand (tool_item)); @@ -2587,10 +2586,10 @@ menu_position_func (GtkMenu *menu, gint monitor_num; GdkScreen *screen; - gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button), - &req, NULL); - gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), - &menu_req, NULL); + gtk_widget_get_preferred_size (priv->arrow_button, + &req, NULL); + gtk_widget_get_preferred_size (GTK_WIDGET (menu), + &menu_req, NULL); screen = gtk_widget_get_screen (GTK_WIDGET (menu)); monitor_num = gdk_screen_get_monitor_at_window (screen, @@ -3322,8 +3321,8 @@ toolbar_content_size_request (ToolbarContent *content, GtkToolbar *toolbar, GtkRequisition *requisition) { - gtk_size_request_get_size (GTK_SIZE_REQUEST (content->item), - requisition, NULL); + gtk_widget_get_preferred_size (GTK_WIDGET (content->item), + requisition, NULL); if (content->is_placeholder && content->disappearing) { |