summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-09-21 16:35:17 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:11:45 +0200
commitd9c92598612714683eab96fecf6e90a9531607e5 (patch)
tree4091fc22f94eeed203385670e1eb05d43b6f264c /gtk/gtknotebook.c
parentf52a1fcfbde5c1b1108d4a03a9bf5c409b59a73e (diff)
downloadgtk+-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/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5523013e62..00412f229d 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -38,7 +38,6 @@
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtklabel.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkbindings.h"
@@ -1844,8 +1843,8 @@ gtk_notebook_size_request (GtkWidget *widget,
if (gtk_widget_get_visible (page->child))
{
vis_pages++;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->child,
+ &child_requisition, NULL);
requisition->width = MAX (requisition->width,
child_requisition.width);
@@ -1902,8 +1901,8 @@ gtk_notebook_size_request (GtkWidget *widget,
if (!gtk_widget_get_visible (page->tab_label))
gtk_widget_show (page->tab_label);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->tab_label,
+ &child_requisition, NULL);
page->requisition.width = child_requisition.width + 2 * style->xthickness;
page->requisition.height = child_requisition.height + 2 * style->ythickness;
@@ -1938,8 +1937,8 @@ gtk_notebook_size_request (GtkWidget *widget,
{
if (priv->action_widget[i])
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
- &action_widget_requisition[i], NULL);
+ gtk_widget_get_preferred_size (priv->action_widget[i],
+ &action_widget_requisition[i], NULL);
action_widget_requisition[i].width += style->xthickness;
action_widget_requisition[i].height += style->ythickness;
}
@@ -2191,8 +2190,8 @@ gtk_notebook_size_allocate (GtkWidget *widget,
widget_allocation.y = allocation->y + border_width;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (priv->action_widget[i],
+ &requisition, NULL);
switch (tab_pos)
{
@@ -2666,8 +2665,8 @@ popup_position_func (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
gtk_widget_get_allocation (w, &allocation);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &requisition, NULL);
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
*x += allocation.x + allocation.width - requisition.width;
@@ -3252,8 +3251,8 @@ on_drag_icon_draw (GtkWidget *widget,
notebook = GTK_WIDGET (data);
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget,
+ &requisition, NULL);
gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
gtk_paint_extension (gtk_widget_get_style (notebook),
@@ -5828,8 +5827,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
xthickness = style->xthickness;
ythickness = style->ythickness;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
- &tab_requisition, NULL);
+ gtk_widget_get_preferred_size (page->tab_label, &tab_requisition, NULL);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"tab-curvature", &tab_curvature,