[gtk+/native-layout] Mass API change commit GtkExtendedCell --> GtkCellSizeRequest



commit ee9115fb9f98d5395c785964246827b2e51f2e36
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Jun 18 17:07:03 2010 -0400

    Mass API change commit GtkExtendedCell --> GtkCellSizeRequest
    
    This commit moves gtkextendedcell.[ch] --> gtkcellsizerequest.[ch]
    and effects the API change all over the tree.
    
    Furthermore it includes the initial height-for-width implementation
    on GtkCellRendererText.

 gtk/Makefile.am           |    4 +-
 gtk/gtk.h                 |    2 +-
 gtk/gtk.symbols           |   24 ++--
 gtk/gtkcellrenderer.c     |   85 +++++++-------
 gtk/gtkcellrenderertext.c |  209 ++++++++++++++++++++------------
 gtk/gtkcellsizerequest.c  |  288 +++++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkcellsizerequest.h  |   92 ++++++++++++++
 gtk/gtkcellview.c         |   10 +-
 gtk/gtkextendedcell.c     |  277 -------------------------------------------
 gtk/gtkextendedcell.h     |   97 ---------------
 gtk/gtkiconview.c         |   37 ++++---
 gtk/gtktreeviewcolumn.c   |   39 ++++---
 12 files changed, 617 insertions(+), 547 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 2d51dcd..e433b47 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -193,6 +193,7 @@ gtk_public_h_sources =          \
 	gtkcellrendererspinner.h\
 	gtkcellrenderertext.h	\
 	gtkcellrenderertoggle.h	\
+	gtkcellsizerequest.h	\
 	gtkcellview.h		\
 	gtkcheckbutton.h	\
 	gtkcheckmenuitem.h	\
@@ -214,7 +215,6 @@ gtk_public_h_sources =          \
 	gtkenums.h		\
 	gtkeventbox.h		\
 	gtkexpander.h		\
-	gtkextendedcell.h	\
 	gtkfilechooser.h        \
 	gtkfilechooserbutton.h  \
 	gtkfilechooserdialog.h  \
@@ -454,6 +454,7 @@ gtk_base_c_sources =            \
 	gtkcellrendererspinner.c\
 	gtkcellrenderertext.c	\
 	gtkcellrenderertoggle.c	\
+	gtkcellsizerequest.c	\
 	gtkcellview.c		\
 	gtkcheckbutton.c	\
 	gtkcheckmenuitem.c	\
@@ -471,7 +472,6 @@ gtk_base_c_sources =            \
 	gtkentrycompletion.c	\
 	gtkeventbox.c		\
 	gtkexpander.c		\
-	gtkextendedcell.c	\
 	gtkfilechooser.c	\
 	gtkfilechooserbutton.c	\
 	gtkfilechooserdefault.c	\
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 449d271..228b94c 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -63,6 +63,7 @@
 #include <gtk/gtkcellrendererspinner.h>
 #include <gtk/gtkcellrenderertext.h>
 #include <gtk/gtkcellrenderertoggle.h>
+#include <gtk/gtkcellsizerequest.h>
 #include <gtk/gtkcellview.h>
 #include <gtk/gtkcheckbutton.h>
 #include <gtk/gtkcheckmenuitem.h>
@@ -84,7 +85,6 @@
 #include <gtk/gtkenums.h>
 #include <gtk/gtkeventbox.h>
 #include <gtk/gtkexpander.h>
-#include <gtk/gtkextendedcell.h>
 #include <gtk/gtkfixed.h>
 #include <gtk/gtkfilechooser.h>
 #include <gtk/gtkfilechooserbutton.h>
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 82d9369..f851a08 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -673,6 +673,18 @@ gtk_cell_renderer_toggle_set_radio
 #endif
 #endif
 
+#if IN_HEADER(__GTK_CELL_SIZE_REQUEST_H__)
+#if IN_FILE(__GTK_CELL_SIZE_REQUEST_C__)
+gtk_cell_size_request_get_height
+gtk_cell_size_request_get_height_for_width
+gtk_cell_size_request_get_request_mode
+gtk_cell_size_request_get_size
+gtk_cell_size_request_get_type G_GNUC_CONST
+gtk_cell_size_request_get_width
+gtk_cell_size_request_get_width_for_height
+#endif
+#endif
+
 #if IN_HEADER(__GTK_CELL_VIEW_H__)
 #if IN_FILE(__GTK_CELL_VIEW_C__)
 gtk_cell_view_get_desired_height_of_row
@@ -1220,18 +1232,6 @@ gtk_expander_set_use_underline
 #endif
 #endif
 
-#if IN_HEADER(__GTK_EXTENDED_CELL_H__)
-#if IN_FILE(__GTK_EXTENDED_CELL_C__)
-gtk_extended_cell_get_type G_GNUC_CONST
-gtk_extended_cell_get_desired_height
-gtk_extended_cell_get_desired_size
-gtk_extended_cell_get_desired_width
-gtk_extended_cell_get_height_for_width
-gtk_extended_cell_get_width_for_height
-gtk_extended_cell_is_height_for_width
-#endif
-#endif
-
 #if IN_HEADER(__GTK_FILE_CHOOSER_H__)
 #if IN_FILE(__GTK_FILE_CHOOSER_C__)
 gtk_file_chooser_add_filter
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index a6cfb8d..d8f5645 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "gtkcellrenderer.h"
-#include "gtkextendedcell.h"
+#include "gtkcellsizerequest.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkprivate.h"
@@ -39,26 +39,26 @@ static void gtk_cell_renderer_set_property  (GObject              *object,
 static void set_cell_bg_color               (GtkCellRenderer      *cell,
 					     GdkColor             *color);
 
-/* Fallback GtkExtendedCell implementation to use remaining ->get_size() implementations */
-static void gtk_cell_renderer_extended_cell_init   (GtkExtendedCellIface *iface);
-static void gtk_cell_renderer_get_desired_width    (GtkExtendedCell   *cell,
-						    GtkWidget         *widget,
-						    gint              *minimum_size,
-						    gint              *natural_size);
-static void gtk_cell_renderer_get_desired_height   (GtkExtendedCell   *cell,
-						    GtkWidget         *widget,
-						    gint              *minimum_size,
-						    gint              *natural_size);
-static void gtk_cell_renderer_get_height_for_width (GtkExtendedCell   *cell,
-						    GtkWidget         *widget,
-						    gint               width,
-						    gint              *minimum_height,
-						    gint              *natural_height);
-static void gtk_cell_renderer_get_width_for_height (GtkExtendedCell   *cell,
-						    GtkWidget         *widget,
-						    gint               height,
-						    gint              *minimum_width,
-						    gint              *natural_width);
+/* Fallback GtkCellSizeRequest implementation to use remaining ->get_size() implementations */
+static void gtk_cell_renderer_cell_size_request_init   (GtkCellSizeRequestIface *iface);
+static void gtk_cell_renderer_get_width                (GtkCellSizeRequest      *cell,
+							GtkWidget               *widget,
+							gint                    *minimum_size,
+							gint                    *natural_size);
+static void gtk_cell_renderer_get_height               (GtkCellSizeRequest      *cell,
+							GtkWidget               *widget,
+							gint                    *minimum_size,
+							gint                    *natural_size);
+static void gtk_cell_renderer_get_height_for_width     (GtkCellSizeRequest      *cell,
+							GtkWidget               *widget,
+							gint                     width,
+							gint                    *minimum_height,
+							gint                    *natural_height);
+static void gtk_cell_renderer_get_width_for_height     (GtkCellSizeRequest      *cell,
+							GtkWidget               *widget,
+							gint                     height,
+							gint                    *minimum_width,
+							gint                    *natural_width);
 
 
 
@@ -124,9 +124,9 @@ gtk_cell_renderer_get_type (void)
 	NULL,		/* value_table */
       };
 
-      const GInterfaceInfo extended_cell_info =
+      const GInterfaceInfo cell_size_request_info =
       {
-	(GInterfaceInitFunc) gtk_cell_renderer_extended_cell_init,
+	(GInterfaceInitFunc) gtk_cell_renderer_cell_size_request_init,
 	(GInterfaceFinalizeFunc) NULL,
 	NULL /* interface data */
       };
@@ -134,8 +134,8 @@ gtk_cell_renderer_get_type (void)
       cell_renderer_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkCellRenderer",
 						   &cell_renderer_info, G_TYPE_FLAG_ABSTRACT);
 
-      g_type_add_interface_static (cell_renderer_type, GTK_TYPE_EXTENDED_CELL,
-                                   &extended_cell_info) ;
+      g_type_add_interface_static (cell_renderer_type, GTK_TYPE_CELL_SIZE_REQUEST,
+                                   &cell_size_request_info) ;
     }
 
   return cell_renderer_type;
@@ -558,6 +558,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
  *
  * Please note that the values set in @width and @height, as well as those 
  * in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
+ *
+ *
+ * Deprecated: 3.0: Use gtk_cell_size_request_get_size() instead.
  **/
 void
 gtk_cell_renderer_get_size (GtkCellRenderer    *cell,
@@ -1035,17 +1038,17 @@ gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
 }
 
 static void
-gtk_cell_renderer_extended_cell_init (GtkExtendedCellIface *iface)
+gtk_cell_renderer_cell_size_request_init (GtkCellSizeRequestIface *iface)
 {
-  iface->get_desired_width     = gtk_cell_renderer_get_desired_width;
-  iface->get_desired_height    = gtk_cell_renderer_get_desired_height;
+  iface->get_width     = gtk_cell_renderer_get_width;
+  iface->get_height    = gtk_cell_renderer_get_height;
 
   iface->get_width_for_height  = gtk_cell_renderer_get_width_for_height;
   iface->get_height_for_width  = gtk_cell_renderer_get_height_for_width;
 }
 
 static void
-gtk_cell_renderer_get_desired_size (GtkExtendedCell   *cell,
+gtk_cell_renderer_get_desired_size (GtkCellSizeRequest   *cell,
 				    GtkWidget         *widget,
 				    GtkOrientation     orientation,
 				    gint              *minimum_size,
@@ -1082,20 +1085,20 @@ gtk_cell_renderer_get_desired_size (GtkExtendedCell   *cell,
 }
 
 static void
-gtk_cell_renderer_get_desired_width (GtkExtendedCell   *cell,
-				     GtkWidget         *widget,
-				     gint              *minimum_size,
-				     gint              *natural_size)
+gtk_cell_renderer_get_width (GtkCellSizeRequest   *cell,
+			     GtkWidget         *widget,
+			     gint              *minimum_size,
+			     gint              *natural_size)
 {
   gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_HORIZONTAL, 
 				      minimum_size, natural_size);
 }
 
 static void
-gtk_cell_renderer_get_desired_height (GtkExtendedCell   *cell,
-				      GtkWidget         *widget,
-				      gint              *minimum_size,
-				      gint              *natural_size)
+gtk_cell_renderer_get_height (GtkCellSizeRequest   *cell,
+			      GtkWidget         *widget,
+			      gint              *minimum_size,
+			      gint              *natural_size)
 {
   gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_VERTICAL, 
 				      minimum_size, natural_size);
@@ -1103,25 +1106,25 @@ gtk_cell_renderer_get_desired_height (GtkExtendedCell   *cell,
 
 
 static void
-gtk_cell_renderer_get_height_for_width (GtkExtendedCell *cell,
+gtk_cell_renderer_get_height_for_width (GtkCellSizeRequest *cell,
 					GtkWidget       *widget,
 					gint             width,
 					gint            *minimum_height,
 					gint            *natural_height)
 {
   /* Fall back on the height reported from ->get_size() */
-  gtk_extended_cell_get_desired_height (cell, widget, minimum_height, natural_height);
+  gtk_cell_size_request_get_height (cell, widget, minimum_height, natural_height);
 }
 
 static void
-gtk_cell_renderer_get_width_for_height (GtkExtendedCell *cell,
+gtk_cell_renderer_get_width_for_height (GtkCellSizeRequest *cell,
 					GtkWidget       *widget,
 					gint             height,
 					gint            *minimum_width,
 					gint            *natural_width)
 {
   /* Fall back on the width reported from ->get_size() */
-  gtk_extended_cell_get_desired_width (cell, widget, minimum_width, natural_width);
+  gtk_cell_size_request_get_width (cell, widget, minimum_width, natural_width);
 }
 
 /* An internal convenience function for some containers to peek at the
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 859bcc1..1274dc6 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include "gtkcellrenderertext.h"
 #include "gtkeditable.h"
-#include "gtkextendedcell.h"
+#include "gtkcellsizerequest.h"
 #include "gtkentry.h"
 #include "gtkmarshalers.h"
 #include "gtkintl.h"
@@ -39,13 +39,6 @@ static void gtk_cell_renderer_text_set_property  (GObject                  *obje
 						  guint                     param_id,
 						  const GValue             *value,
 						  GParamSpec               *pspec);
-static void gtk_cell_renderer_text_get_size   (GtkCellRenderer          *cell,
-					       GtkWidget                *widget,
-					       GdkRectangle             *cell_area,
-					       gint                     *x_offset,
-					       gint                     *y_offset,
-					       gint                     *width,
-					       gint                     *height);
 static void gtk_cell_renderer_text_render     (GtkCellRenderer          *cell,
 					       GdkWindow                *window,
 					       GtkWidget                *widget,
@@ -62,15 +55,20 @@ static GtkCellEditable *gtk_cell_renderer_text_start_editing (GtkCellRenderer
 							      GdkRectangle         *cell_area,
 							      GtkCellRendererState  flags);
 
-static void       gtk_cell_renderer_text_extended_cell_init (GtkExtendedCellIface  *iface);
-static void       gtk_cell_renderer_text_get_desired_width  (GtkExtendedCell       *cell,
-							     GtkWidget             *widget,
-							     gint                  *minimal_size,
-							     gint                  *desired_size);
-static void       gtk_cell_renderer_text_get_desired_height (GtkExtendedCell       *cell,
-							     GtkWidget             *widget,
-							     gint                  *minimal_size,
-							     gint                  *desired_size);
+static void       gtk_cell_renderer_text_cell_size_request_init (GtkCellSizeRequestIface  *iface);
+static void       gtk_cell_renderer_text_get_width              (GtkCellSizeRequest       *cell,
+							        GtkWidget                 *widget,
+							        gint                      *minimal_size,
+							        gint                      *natural_size);
+static void       gtk_cell_renderer_text_get_height            (GtkCellSizeRequest        *cell,
+							        GtkWidget                 *widget,
+							        gint                      *minimal_size,
+							        gint                      *natural_size);
+static void       gtk_cell_renderer_text_get_height_for_width  (GtkCellSizeRequest        *cell,
+								GtkWidget                 *widget,
+								gint                       width,
+								gint                      *minimum_height,
+								gint                      *natural_height);
 
 enum {
   EDITED,
@@ -162,8 +160,8 @@ struct _GtkCellRendererTextPrivate
 };
 
 G_DEFINE_TYPE_WITH_CODE (GtkCellRendererText, gtk_cell_renderer_text, GTK_TYPE_CELL_RENDERER,
-                         G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_CELL,
-                                                gtk_cell_renderer_text_extended_cell_init))
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_SIZE_REQUEST,
+                                                gtk_cell_renderer_text_cell_size_request_init))
 
 static void
 gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
@@ -198,7 +196,6 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
   object_class->get_property = gtk_cell_renderer_text_get_property;
   object_class->set_property = gtk_cell_renderer_text_set_property;
 
-  cell_class->get_size = gtk_cell_renderer_text_get_size;
   cell_class->render = gtk_cell_renderer_text_render;
   cell_class->start_editing = gtk_cell_renderer_text_start_editing;
 
@@ -1492,6 +1489,7 @@ get_layout (GtkCellRendererText *celltext,
   return layout;
 }
 
+
 static void
 get_size (GtkCellRenderer *cell,
 	  GtkWidget       *widget,
@@ -1607,20 +1605,6 @@ get_size (GtkCellRenderer *cell,
   g_object_unref (layout);
 }
 
-
-static void
-gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
-				 GtkWidget       *widget,
-				 GdkRectangle    *cell_area,
-				 gint            *x_offset,
-				 gint            *y_offset,
-				 gint            *width,
-				 gint            *height)
-{
-  get_size (cell, widget, cell_area, NULL,
-	    x_offset, y_offset, width, height);
-}
-
 static void
 gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
 			       GdkDrawable          *window,
@@ -1944,79 +1928,146 @@ gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer
 }
 
 static void
-gtk_cell_renderer_text_extended_cell_init (GtkExtendedCellIface *iface)
+gtk_cell_renderer_text_cell_size_request_init (GtkCellSizeRequestIface *iface)
 {
   /* Currently cell renderers do natural widths for ellipsizing text 
    * but dont yet do height-for-width/width-for-height calculations for
    * wordwrapping 
    */
-  iface->get_desired_width  = gtk_cell_renderer_text_get_desired_width;
-  iface->get_desired_height = gtk_cell_renderer_text_get_desired_height;
+  iface->get_width  = gtk_cell_renderer_text_get_width;
+  iface->get_height = gtk_cell_renderer_text_get_height;
 }
 
 static void
-gtk_cell_renderer_text_get_desired_size (GtkExtendedCell   *cell,
-					 GtkWidget         *widget,
-					 GtkOrientation     orientation,
-					 gint              *minimal_size,
-					 gint              *desired_size)
+gtk_cell_renderer_text_get_width (GtkCellSizeRequest *cell,
+				  GtkWidget          *widget,
+				  gint               *minimum_size,
+				  gint               *natural_size)
 {
   GtkCellRendererTextPrivate *priv;
+  GtkCellRendererText        *celltext;
+  PangoLayout                *layout;
+  PangoContext               *context;
+  PangoFontMetrics           *metrics;
+  PangoRectangle              rect;
+  gint char_width, digit_width, char_pixels, text_width, ellipsize_chars, guess_width, xpad;
+
+  /* "width-chars" Hard-coded minimum width:
+   *    - minimum size should be MAX (width-chars, strlen ("..."));
+   *    - natural size should be MAX (width-chars, strlen (label->text));
+   *
+   * "wrap-width" User specified natural wrap width
+   *    - minimum size should be MAX (width-chars, 0)
+   *    - natural size should be MIN (wrap-width, strlen (label->text))
+   */
 
+  celltext = GTK_CELL_RENDERER_TEXT (cell);
   priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
+  xpad = GTK_CELL_RENDERER (cell)->xpad;
 
-  if (minimal_size)
-    {
-      if (orientation == GTK_ORIENTATION_HORIZONTAL)
-	get_size (GTK_CELL_RENDERER (cell),
-		  widget, NULL, NULL, NULL, NULL,
-		  minimal_size, NULL);
-      else
-	get_size (GTK_CELL_RENDERER (cell),
-		  widget, NULL, NULL, NULL, NULL,
-		  NULL, minimal_size);
-    }
+
+  layout = get_layout (celltext, widget, FALSE, 0);
+
+  /* Get the layout with the text possibly wrapping at wrap_width */
+  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  guess_width = rect.width;
+
+  /* Fetch the length of the complete unwrapped text */
+  pango_layout_set_width (layout, -1);
+  pango_layout_get_extents (layout, NULL, &rect);
+  text_width = rect.width;
+
+  /* Fetch the average size of a charachter */
+  context = pango_layout_get_context (layout);
+  metrics = pango_context_get_metrics (context, widget->style->font_desc, 
+				       pango_context_get_language (context));
   
-  if (desired_size)
+  char_width = pango_font_metrics_get_approximate_char_width (metrics);
+  digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
+  char_pixels = MAX (char_width, digit_width);
+
+  pango_font_metrics_unref (metrics);
+  g_object_unref (layout);
+
+  /* enforce minimum width for ellipsized labels at ~3 chars */
+  if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
+    ellipsize_chars = 3;
+  else
+    ellipsize_chars = 0;
+  
+  if (minimum_size)
     {
-      PangoEllipsizeMode ellipsize;
-      
-      ellipsize = priv->ellipsize;
-      priv->ellipsize = PANGO_ELLIPSIZE_NONE;
-      
-      if (orientation == GTK_ORIENTATION_HORIZONTAL)
-	get_size (GTK_CELL_RENDERER (cell),
-		  widget, NULL, NULL, NULL, NULL,
-		  desired_size, NULL);
+      if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
+	*minimum_size = 
+	  xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars));
       else
-	get_size (GTK_CELL_RENDERER (cell),
-		  widget, NULL, NULL, NULL, NULL,
-		  NULL, desired_size);
+	/* If no width-chars set, minimum for wrapping text will be the wrap-width */
+	*minimum_size = xpad * 2 + rect.x + guess_width;
+    }
 
-      priv->ellipsize = ellipsize;
+  if (natural_size)
+    {
+      if (priv->wrap_width > -1)
+	*natural_size = xpad * 2 + 
+	  MIN (priv->wrap_width, PANGO_PIXELS (text_width));
+      else /* Natural size is full text here regardless of ellipsize */
+	*natural_size = xpad * 2 + 
+	  MAX ((PANGO_PIXELS (char_width) * priv->width_chars), PANGO_PIXELS (text_width));
     }
 }
 
 static void
-gtk_cell_renderer_text_get_desired_width (GtkExtendedCell   *cell,
-					  GtkWidget         *widget,
-					  gint              *minimum_size,
-					  gint              *desired_size)
+gtk_cell_renderer_text_get_height_for_width (GtkCellSizeRequest *cell,
+					     GtkWidget          *widget,
+					     gint                width,
+					     gint               *minimum_height,
+					     gint               *natural_height)
 {
-  gtk_cell_renderer_text_get_desired_size (cell, widget, GTK_ORIENTATION_HORIZONTAL, 
-					   minimum_size, desired_size);
+  GtkCellRendererTextPrivate *priv;
+  GtkCellRendererText        *celltext;
+  PangoLayout                *layout;
+  gint                        text_height, xpad, ypad;
+
+
+  celltext = GTK_CELL_RENDERER_TEXT (cell);
+  priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
+
+  xpad = GTK_CELL_RENDERER (cell)->xpad;
+  ypad = GTK_CELL_RENDERER (cell)->ypad;
+
+  layout = get_layout (celltext, widget, FALSE, 0);
+
+  pango_layout_set_width (layout, (width - xpad * 2) * PANGO_SCALE);
+  pango_layout_get_pixel_size (layout, NULL, &text_height);
+
+  if (minimum_height)
+    *minimum_height = text_height + ypad * 2;
+
+  if (natural_height)
+    *natural_height = text_height + ypad * 2;
+
+  g_object_unref (layout);
 }
 
 static void
-gtk_cell_renderer_text_get_desired_height (GtkExtendedCell   *cell,
-					   GtkWidget         *widget,
-					   gint              *minimum_size,
-					   gint              *desired_size)
+gtk_cell_renderer_text_get_height (GtkCellSizeRequest *cell,
+				   GtkWidget          *widget,
+				   gint               *minimum_size,
+				   gint               *natural_size)
 {
-  gtk_cell_renderer_text_get_desired_size (cell, widget, GTK_ORIENTATION_VERTICAL, 
-					   minimum_size, desired_size);
+  gint min_width;
+
+  /* Thankfully cell renderers dont rotate, so they only have to do
+   * height-for-width and not the opposite. Here we have only to return
+   * the height for the base minimum width of the renderer.
+   */
+  gtk_cell_size_request_get_width (cell, widget, &min_width, NULL);
+
+  gtk_cell_renderer_text_get_height_for_width (cell, widget, min_width,
+					       minimum_size, natural_size);
 }
 
 
+
 #define __GTK_CELL_RENDERER_TEXT_C__
 #include "gtkaliasdef.c"
diff --git a/gtk/gtkcellsizerequest.c b/gtk/gtkcellsizerequest.c
new file mode 100644
index 0000000..bf98a7e
--- /dev/null
+++ b/gtk/gtkcellsizerequest.c
@@ -0,0 +1,288 @@
+/* gtkcellsizerequest.c
+ * Copyright (C) 2010 Openismus GmbH
+ *
+ * Author:
+ *      Tristan Van Berkom <tristan van berkom gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include "gtkcellrenderer.h"
+#include "gtkcellsizerequest.h"
+#include "gtkintl.h"
+#include "gtkalias.h"
+
+
+#define DEBUG_CELL_SIZE_REQUEST 0
+
+GType
+gtk_cell_size_request_get_type (void)
+{
+  static GType cell_size_request_type = 0;
+
+  if (G_UNLIKELY(!cell_size_request_type))
+    {
+      cell_size_request_type =
+	g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkCellSizeRequest"),
+				       sizeof (GtkCellSizeRequestIface),
+				       NULL, 0, NULL, 0);
+
+      g_type_interface_add_prerequisite (cell_size_request_type, GTK_TYPE_CELL_RENDERER);
+    }
+  return cell_size_request_type;
+}
+
+/**
+ * gtk_cell_size_request_get_request_mode:
+ * @cell: a #GtkCellSizeRequest instance
+ *
+ * Gets whether the cell renderer prefers a height-for-width layout
+ * or a width-for-height layout.
+ *
+ * Returns: The #GtkSizeRequestMode preferred by this renderer.
+ *
+ * Since: 3.0
+ */
+GtkSizeRequestMode
+gtk_cell_size_request_get_request_mode (GtkCellSizeRequest *cell)
+{
+  GtkCellSizeRequestIface *iface;
+
+  g_return_val_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell), FALSE);
+
+  iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+  if (iface->get_request_mode)
+    return iface->get_request_mode (cell);
+
+  /* By default cell renderers are height-for-width. */
+  return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+}
+
+/**
+ * gtk_cell_size_request_get_width:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @minimum_size: location to store the minimum size, or %NULL
+ * @natural_size: location to store the natural size, or %NULL
+ *
+ * Retreives a renderer's natural size when rendered to @widget.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_width (GtkCellSizeRequest *cell,
+				 GtkWidget          *widget,
+				 gint               *minimum_size,
+				 gint               *natural_size)
+{
+  GtkCellSizeRequestIface *iface;
+
+  g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (NULL != minimum_size || NULL != natural_size);
+
+  iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+  iface->get_width (cell, widget, minimum_size, natural_size);
+
+#if DEBUG_CELL_SIZE_REQUEST
+  g_message ("%s returning minimum width: %d and natural width: %d",
+	     G_OBJECT_TYPE_NAME (cell), 
+	     minimum_size ? *minimum_size : 20000, 
+	     natural_size ? *natural_size : 20000);
+#endif
+}
+
+
+/**
+ * gtk_cell_size_request_get_height:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @minimum_size: location to store the minimum size, or %NULL
+ * @natural_size: location to store the natural size, or %NULL
+ *
+ * Retreives a renderer's natural size when rendered to @widget.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_height (GtkCellSizeRequest *cell,
+				  GtkWidget          *widget,
+				  gint               *minimum_size,
+				  gint               *natural_size)
+{
+  GtkCellSizeRequestIface *iface;
+
+  g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (NULL != minimum_size || NULL != natural_size);
+
+  iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+  iface->get_height (cell, widget, minimum_size, natural_size);
+
+#if DEBUG_CELL_SIZE_REQUEST
+  g_message ("%s returning minimum height: %d and natural height: %d",
+	     G_OBJECT_TYPE_NAME (cell), 
+	     minimum_size ? *minimum_size : 20000, 
+	     natural_size ? *natural_size : 20000);
+#endif
+}
+
+
+/**
+ * gtk_cell_size_request_get_width_for_height:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @height: the size which is available for allocation
+ * @minimum_width: location for storing the minimum size, or %NULL
+ * @natural_width: location for storing the preferred size, or %NULL
+ *
+ * Retreives a cell renderers's natural width if it were rendered to 
+ * @widget with the specified @height.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_width_for_height (GtkCellSizeRequest *cell,
+					    GtkWidget          *widget,
+					    gint                height,
+					    gint               *minimum_width,
+					    gint               *natural_width)
+{
+  GtkCellSizeRequestIface *iface;
+
+  g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (NULL != minimum_width || NULL != natural_width);
+
+  iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+  iface->get_width_for_height (cell, widget, height, minimum_width, natural_width);
+
+#if DEBUG_CELL_SIZE_REQUEST
+  g_message ("%s width for height: %d is minimum %d and natural: %d",
+	     G_OBJECT_TYPE_NAME (cell), height,
+	     minimum_width ? *minimum_width : 20000, 
+	     natural_width ? *natural_width : 20000);
+#endif
+}
+
+/**
+ * gtk_cell_size_request_get_height_for_width:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @width: the size which is available for allocation
+ * @minimum_height: location for storing the minimum size, or %NULL
+ * @natural_height: location for storing the preferred size, or %NULL
+ *
+ * Retreives a cell renderers's natural height if it were rendered to 
+ * @widget with the specified @width.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_height_for_width (GtkCellSizeRequest *cell,
+					    GtkWidget          *widget,
+					    gint                width,
+					    gint               *minimum_height,
+					    gint               *natural_height)
+{
+  GtkCellSizeRequestIface *iface;
+
+  g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (NULL != minimum_height || NULL != natural_height);
+
+  iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+  iface->get_height_for_width (cell, widget, width, minimum_height, natural_height);
+
+#if DEBUG_CELL_SIZE_REQUEST
+  g_message ("%s height for width: %d is minimum %d and natural: %d",
+	     G_OBJECT_TYPE_NAME (cell), width,
+	     minimum_height ? *minimum_height : 20000, 
+	     natural_height ? *natural_height : 20000);
+#endif
+}
+
+/**
+ * gtk_cell_size_request_get_size:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @request_natural: Whether to base the contextual request off of the
+ *     base natural or the base minimum
+ * @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
+ * @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
+ *
+ * Retrieves the minimum and natural size of a cell taking
+ * into account the widget's preference for height-for-width management.
+ *
+ * If request_natural is specified, the non-contextual natural value will
+ * be used to make the contextual request; otherwise the minimum will be used.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_size (GtkCellSizeRequest *cell,
+				GtkWidget          *widget,
+				GtkRequisition     *minimum_size,
+				GtkRequisition     *natural_size)
+{
+  gint min_width, nat_width;
+  gint min_height, nat_height;
+
+  g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+
+  if (gtk_cell_size_request_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
+    {
+      gtk_cell_size_request_get_width (cell, widget, &min_width, &nat_width);
+
+      if (minimum_size)
+	{
+	  minimum_size->width = min_width;
+	  gtk_cell_size_request_get_height_for_width (cell, widget, min_width,
+						      &minimum_size->height, NULL);
+	}
+
+      if (natural_size)
+	{
+	  natural_size->width = nat_width;
+	  gtk_cell_size_request_get_height_for_width (cell, widget, nat_width,
+						      NULL, &natural_size->height);
+	}
+    }
+  else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
+    {
+      gtk_cell_size_request_get_height (cell, widget, &min_height, &nat_height);
+
+      if (minimum_size)
+	{
+	  minimum_size->height = min_height;
+	  gtk_cell_size_request_get_width_for_height (cell, widget, min_height,
+						      &minimum_size->width, NULL);
+	}
+
+      if (natural_size)
+	{
+	  natural_size->height = nat_height;
+	  gtk_cell_size_request_get_width_for_height (cell, widget, nat_height,
+						      NULL, &natural_size->width);
+	}
+    }
+}
+
+
+#define __GTK_CELL_SIZE_REQUEST_C__
+#include "gtkaliasdef.c"
diff --git a/gtk/gtkcellsizerequest.h b/gtk/gtkcellsizerequest.h
new file mode 100644
index 0000000..c69fce8
--- /dev/null
+++ b/gtk/gtkcellsizerequest.h
@@ -0,0 +1,92 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Openismus GmbH
+ *
+ * Author:
+ *      Tristan Van Berkom <tristan van berkom gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_CELL_SIZE_REQUEST_H__
+#define __GTK_CELL_SIZE_REQUEST_H__
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_CELL_SIZE_REQUEST            (gtk_cell_size_request_get_type ())
+#define GTK_CELL_SIZE_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_SIZE_REQUEST, GtkCellSizeRequest))
+#define GTK_CELL_SIZE_REQUEST_CLASS(klass)    ((GtkCellSizeRequestIface*)g_type_interface_peek ((klass), GTK_TYPE_CELL_SIZE_REQUEST))
+#define GTK_IS_CELL_SIZE_REQUEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_SIZE_REQUEST))
+#define GTK_CELL_SIZE_REQUEST_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_SIZE_REQUEST, GtkCellSizeRequestIface))
+
+typedef struct _GtkCellSizeRequest           GtkCellSizeRequest;
+typedef struct _GtkCellSizeRequestIface      GtkCellSizeRequestIface;
+
+struct _GtkCellSizeRequestIface
+{
+  GTypeInterface g_iface;
+
+  /* virtual table */
+  GtkSizeRequestMode (* get_request_mode)     (GtkCellSizeRequest *cell);
+  void               (* get_width)            (GtkCellSizeRequest *cell,
+					       GtkWidget          *widget,
+					       gint               *minimum_size,
+					       gint               *natural_size);
+  void               (* get_height_for_width) (GtkCellSizeRequest *cell,
+					       GtkWidget          *widget,
+					       gint                width,
+					       gint               *minimum_height,
+					       gint               *natural_height);
+  void               (* get_height)           (GtkCellSizeRequest *cell,
+					       GtkWidget          *widget,
+					       gint               *minimum_size,
+					       gint               *natural_size);
+  void               (* get_width_for_height) (GtkCellSizeRequest *cell,
+					       GtkWidget          *widget,
+					       gint                height,
+					       gint               *minimum_width,
+					       gint               *natural_width);
+};
+
+GType              gtk_cell_size_request_get_type             (void) G_GNUC_CONST;
+GtkSizeRequestMode gtk_cell_size_request_get_request_mode     (GtkCellSizeRequest *cell);
+void               gtk_cell_size_request_get_width            (GtkCellSizeRequest *cell,
+							       GtkWidget          *widget,
+							       gint               *minimum_size,
+							       gint               *natural_size);
+void               gtk_cell_size_request_get_height_for_width (GtkCellSizeRequest *cell,
+							       GtkWidget          *widget,
+							       gint                width,
+							       gint               *minimum_height,
+							       gint               *natural_height);
+void               gtk_cell_size_request_get_height           (GtkCellSizeRequest *cell,
+							       GtkWidget          *widget,
+							       gint               *minimum_size,
+							       gint               *natural_size);
+void               gtk_cell_size_request_get_width_for_height (GtkCellSizeRequest *cell,
+							       GtkWidget          *widget,
+							       gint                height,
+							       gint               *minimum_width,
+							       gint               *natural_width);
+void               gtk_cell_size_request_get_size             (GtkCellSizeRequest *cell,
+							       GtkWidget          *widget,
+							       GtkRequisition     *minimum_size,
+							       GtkRequisition     *natural_size);
+
+G_END_DECLS
+
+#endif /* __GTK_CELL_SIZE_REQUEST_H__ */
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index c0e3436..1ac2169 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -25,7 +25,7 @@
 #include "gtkcellrenderertext.h"
 #include "gtkcellrendererpixbuf.h"
 #include "gtksizerequest.h"
-#include "gtkextendedcell.h"
+#include "gtkcellsizerequest.h"
 #include "gtkprivate.h"
 #include <gobject/gmarshal.h>
 #include "gtkbuildable.h"
@@ -1207,8 +1207,8 @@ gtk_cell_view_get_size (GtkSizeRequest *widget,
 
 	  if (orientation == GTK_ORIENTATION_HORIZONTAL)
 	    {
-	      gtk_extended_cell_get_desired_width (GTK_EXTENDED_CELL (info->cell),
-						   GTK_WIDGET (cellview), &cell_min, &cell_nat);
+	      gtk_cell_size_request_get_width (GTK_CELL_SIZE_REQUEST (info->cell),
+					       GTK_WIDGET (cellview), &cell_min, &cell_nat);
 
 	      info->requested_width = cell_min;
 	      info->natural_width   = cell_nat;
@@ -1218,8 +1218,8 @@ gtk_cell_view_get_size (GtkSizeRequest *widget,
 	    }
 	  else
 	    {
-	      gtk_extended_cell_get_desired_height (GTK_EXTENDED_CELL (info->cell),
-						    GTK_WIDGET (cellview), &cell_min, &cell_nat);
+	      gtk_cell_size_request_get_height (GTK_CELL_SIZE_REQUEST (info->cell),
+						GTK_WIDGET (cellview), &cell_min, &cell_nat);
 	      minimum = MAX (minimum, cell_min);
 	      natural = MAX (natural, cell_nat);
 	    }
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 62e002b..3d29ccc 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -40,6 +40,7 @@
 #include "gtkcombobox.h"
 #include "gtktextbuffer.h"
 #include "gtktreednd.h"
+#include "gtkcellsizerequest.h"
 #include "gtkprivate.h"
 #include "gtkalias.h"
 
@@ -2943,6 +2944,7 @@ adjust_wrap_width (GtkIconView     *icon_view,
   if (icon_view->priv->text_cell != -1 &&
       icon_view->priv->pixbuf_cell != -1)
     {
+      GtkRequisition min_size;
       gint item_width;
 
       text_info = g_list_nth_data (icon_view->priv->cell_list,
@@ -2950,12 +2952,10 @@ adjust_wrap_width (GtkIconView     *icon_view,
       pixbuf_info = g_list_nth_data (icon_view->priv->cell_list,
 				     icon_view->priv->pixbuf_cell);
       
-      gtk_cell_renderer_get_size (pixbuf_info->cell, 
-				  GTK_WIDGET (icon_view), 
-				  NULL, NULL, NULL,
-				  &pixbuf_width, 
-				  NULL);
-	  
+      gtk_cell_size_request_get_size (GTK_CELL_SIZE_REQUEST (pixbuf_info->cell), 
+				      GTK_WIDGET (icon_view),
+				      &min_size, NULL);
+      pixbuf_width = min_size.width;
 
       if (icon_view->priv->item_width > 0)
 	item_width = icon_view->priv->item_width;
@@ -3010,14 +3010,16 @@ gtk_icon_view_calculate_item_size (GtkIconView     *icon_view,
   for (l = icon_view->priv->cell_list; l; l = l->next)
     {
       GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
-      
+      GtkRequisition min_size;
+
       if (!info->cell->visible)
 	continue;
       
-      gtk_cell_renderer_get_size (info->cell, GTK_WIDGET (icon_view), 
-				  NULL, NULL, NULL,
-				  &item->box[info->position].width, 
-				  &item->box[info->position].height);
+      gtk_cell_size_request_get_size (GTK_CELL_SIZE_REQUEST (info->cell), 
+				      GTK_WIDGET (icon_view), 
+				      &min_size, NULL);
+      item->box[info->position].width  = min_size.width;
+      item->box[info->position].height = min_size.height;
 
       if (icon_view->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
 	{
@@ -3069,7 +3071,8 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
     for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
       {
 	GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
-	
+	GtkRequisition min_size;
+
 	if (info->pack == (k ? GTK_PACK_START : GTK_PACK_END))
 	  continue;
 
@@ -3094,9 +3097,13 @@ gtk_icon_view_calculate_item_size2 (GtkIconView     *icon_view,
 	    cell_area.height = max_height[i];
 	  }
 	
-	gtk_cell_renderer_get_size (info->cell, GTK_WIDGET (icon_view), NULL, NULL, NULL,
-				    &item->box[info->position].width, &item->box[info->position].height);
-
+      
+	gtk_cell_size_request_get_size (GTK_CELL_SIZE_REQUEST (info->cell), 
+					GTK_WIDGET (icon_view), 
+					&min_size, NULL);
+	item->box[info->position].width  = min_size.width;
+	item->box[info->position].height = min_size.height;
+      
 	_gtk_cell_renderer_calc_offset (info->cell, &cell_area,
 					gtk_widget_get_direction (GTK_WIDGET (icon_view)),
 					item->box[info->position].width, item->box[info->position].height,
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index dcf5959..6a91f20 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -26,7 +26,7 @@
 #include "gtkbutton.h"
 #include "gtkalignment.h"
 #include "gtklabel.h"
-#include "gtkextendedcell.h"
+#include "gtkcellsizerequest.h"
 #include "gtkhbox.h"
 #include "gtkmarshalers.h"
 #include "gtkarrow.h"
@@ -2628,15 +2628,15 @@ gtk_tree_view_column_cell_get_real_size (GtkTreeViewColumn  *tree_column,
 	  nat_req.width += tree_column->spacing;
         }
 
-      /* XXX TODO: Cell renderers are not really doing height-for-width yet.
+      /* XXX TODO: Update to use w4h of cell-renderer apis...
        */
-      gtk_extended_cell_get_desired_width (GTK_EXTENDED_CELL (info->cell),
-					   tree_column->tree_view,
-					   &min_req.width, &nat_req.width);
-      gtk_extended_cell_get_height_for_width (GTK_EXTENDED_CELL (info->cell),
-					      tree_column->tree_view,
-					      nat_req.width,
-					      &min_req.height, &nat_req.height);
+      gtk_cell_size_request_get_width (GTK_CELL_SIZE_REQUEST (info->cell),
+				       tree_column->tree_view,
+				       &min_req.width, &nat_req.width);
+      gtk_cell_size_request_get_height_for_width (GTK_CELL_SIZE_REQUEST (info->cell),
+						  tree_column->tree_view,
+						  nat_req.width,
+						  &min_req.height, &nat_req.height);
 
       min_req.width += focus_line_width * 2;
       min_req.height += focus_line_width * 2;
@@ -2873,12 +2873,13 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
       else if (action == CELL_ACTION_FOCUS)
 	{
 	  gint x_offset, y_offset, width, height;
+	  GtkRequisition min_size;
 
-
-	  gtk_cell_renderer_get_size (info->cell,
-				      tree_column->tree_view,
-				      NULL, NULL, NULL,
-				      &width, &height);
+	  gtk_cell_size_request_get_size (GTK_CELL_SIZE_REQUEST (info->cell), 
+					  tree_column->tree_view, 
+					  &min_size, NULL);
+	  width  = min_size.width;
+	  height = min_size.height;
 
 	  _gtk_cell_renderer_calc_offset (info->cell, &rtl_cell_area,
 					  gtk_widget_get_direction (tree_column->tree_view),
@@ -3042,11 +3043,13 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
       else if (action == CELL_ACTION_FOCUS)
 	{
 	  gint width, height, x_offset, y_offset;
+	  GtkRequisition min_size;
 
-	  gtk_cell_renderer_get_size (info->cell,
-				      tree_column->tree_view,
-				      NULL, NULL, NULL,
-				      &width, &height);
+	  gtk_cell_size_request_get_size (GTK_CELL_SIZE_REQUEST (info->cell), 
+					  tree_column->tree_view, 
+					  &min_size, NULL);
+	  width  = min_size.width;
+	  height = min_size.height;
 
 	  _gtk_cell_renderer_calc_offset (info->cell, &rtl_cell_area,
 					  gtk_widget_get_direction (tree_column->tree_view),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]