]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktreeviewcolumn.c
Merge branch 'master' into toolpalette
[~andy/gtk] / gtk / gtktreeviewcolumn.c
index 957c8b793b9039dde4814b7d6ae0f200d7a55949..edec5deffedde0d5540deeb79de1811636d073cf 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+#include <string.h>
 #include "gtktreeviewcolumn.h"
 #include "gtktreeview.h"
 #include "gtktreeprivate.h"
-#include "gtksignal.h"
+#include "gtkcelllayout.h"
 #include "gtkbutton.h"
 #include "gtkalignment.h"
 #include "gtklabel.h"
 #include "gtkhbox.h"
 #include "gtkmarshalers.h"
 #include "gtkarrow.h"
+#include "gtkprivate.h"
 #include "gtkintl.h"
-#include <string.h>
+#include "gtkalias.h"
 
 enum
 {
@@ -36,17 +39,20 @@ enum
   PROP_VISIBLE,
   PROP_RESIZABLE,
   PROP_WIDTH,
+  PROP_SPACING,
   PROP_SIZING,
   PROP_FIXED_WIDTH,
   PROP_MIN_WIDTH,
   PROP_MAX_WIDTH,
   PROP_TITLE,
+  PROP_EXPAND,
   PROP_CLICKABLE,
   PROP_WIDGET,
   PROP_ALIGNMENT,
   PROP_REORDERABLE,
   PROP_SORT_INDICATOR,
-  PROP_SORT_ORDER
+  PROP_SORT_ORDER,
+  PROP_SORT_COLUMN_ID
 };
 
 enum
@@ -62,7 +68,7 @@ struct _GtkTreeViewColumnCellInfo
   GSList *attributes;
   GtkTreeCellDataFunc func;
   gpointer func_data;
-  GtkDestroyNotify destroy;
+  GDestroyNotify destroy;
   gint requested_width;
   gint real_width;
   guint expand : 1;
@@ -72,8 +78,7 @@ struct _GtkTreeViewColumnCellInfo
 };
 
 /* Type methods */
-static void gtk_tree_view_column_init                          (GtkTreeViewColumn       *tree_column);
-static void gtk_tree_view_column_class_init                    (GtkTreeViewColumnClass  *klass);
+static void gtk_tree_view_column_cell_layout_init              (GtkCellLayoutIface      *iface);
 
 /* GObject methods */
 static void gtk_tree_view_column_set_property                  (GObject                 *object,
@@ -86,6 +91,30 @@ static void gtk_tree_view_column_get_property                  (GObject
                                                                GParamSpec              *pspec);
 static void gtk_tree_view_column_finalize                      (GObject                 *object);
 
+/* GtkCellLayout implementation */
+static void gtk_tree_view_column_cell_layout_pack_start         (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell,
+                                                                 gboolean               expand);
+static void gtk_tree_view_column_cell_layout_pack_end           (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell,
+                                                                 gboolean               expand);
+static void gtk_tree_view_column_cell_layout_clear              (GtkCellLayout         *cell_layout);
+static void gtk_tree_view_column_cell_layout_add_attribute      (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell,
+                                                                 const gchar           *attribute,
+                                                                 gint                   column);
+static void gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell,
+                                                                 GtkCellLayoutDataFunc  func,
+                                                                 gpointer               func_data,
+                                                                 GDestroyNotify         destroy);
+static void gtk_tree_view_column_cell_layout_clear_attributes   (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell);
+static void gtk_tree_view_column_cell_layout_reorder            (GtkCellLayout         *cell_layout,
+                                                                 GtkCellRenderer       *cell,
+                                                                 gint                   position);
+static GList *gtk_tree_view_column_cell_layout_get_cells        (GtkCellLayout         *cell_layout);
+
 /* Button handling code */
 static void gtk_tree_view_column_create_button                 (GtkTreeViewColumn       *tree_column);
 static void gtk_tree_view_column_update_button                 (GtkTreeViewColumn       *tree_column);
@@ -123,36 +152,17 @@ static GList *gtk_tree_view_column_cell_prev                   (GtkTreeViewColum
                                                                GList                  *current);
 static void gtk_tree_view_column_clear_attributes_by_info      (GtkTreeViewColumn      *tree_column,
                                                                GtkTreeViewColumnCellInfo *info);
+/* GtkBuildable implementation */
+static void gtk_tree_view_column_buildable_init                 (GtkBuildableIface     *iface);
 
-static GtkObjectClass *parent_class = NULL;
 static guint tree_column_signals[LAST_SIGNAL] = { 0 };
 
+G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, GTK_TYPE_OBJECT,
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
+                                               gtk_tree_view_column_cell_layout_init)
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+                                               gtk_tree_view_column_buildable_init))
 
-GtkType
-gtk_tree_view_column_get_type (void)
-{
-  static GtkType tree_column_type = 0;
-
-  if (!tree_column_type)
-    {
-      static const GTypeInfo tree_column_info =
-      {
-       sizeof (GtkTreeViewColumnClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_tree_view_column_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkTreeViewColumn),
-       0,
-       (GInstanceInitFunc) gtk_tree_view_column_init,
-      };
-
-      tree_column_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTreeViewColumn", &tree_column_info, 0);
-    }
-
-  return tree_column_type;
-}
 
 static void
 gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
@@ -161,8 +171,6 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
 
   object_class = (GObjectClass*) class;
 
-  parent_class = g_type_class_peek_parent (class);
-
   class->clicked = NULL;
 
   object_class->finalize = gtk_tree_view_column_finalize;
@@ -170,138 +178,193 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
   object_class->get_property = gtk_tree_view_column_get_property;
   
   tree_column_signals[CLICKED] =
-    g_signal_new ("clicked",
-                  GTK_CLASS_TYPE (object_class),
+    g_signal_new (I_("clicked"),
+                  G_OBJECT_CLASS_TYPE (object_class),
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GtkTreeViewColumnClass, clicked),
                   NULL, NULL,
                   _gtk_marshal_VOID__VOID,
-                  GTK_TYPE_NONE, 0);
+                  G_TYPE_NONE, 0);
 
   g_object_class_install_property (object_class,
                                    PROP_VISIBLE,
                                    g_param_spec_boolean ("visible",
-                                                        _("Visible"),
-                                                        _("Whether to display the column"),
+                                                        P_("Visible"),
+                                                        P_("Whether to display the column"),
                                                          TRUE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_RESIZABLE,
                                    g_param_spec_boolean ("resizable",
-                                                        _("Resizable"),
-                                                        _("Column is user-resizable"),
+                                                        P_("Resizable"),
+                                                        P_("Column is user-resizable"),
                                                          FALSE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_WIDTH,
                                    g_param_spec_int ("width",
-                                                    _("Width"),
-                                                    _("Current width of the column"),
+                                                    P_("Width"),
+                                                    P_("Current width of the column"),
+                                                    0,
+                                                    G_MAXINT,
+                                                    0,
+                                                    GTK_PARAM_READABLE));
+  g_object_class_install_property (object_class,
+                                   PROP_SPACING,
+                                   g_param_spec_int ("spacing",
+                                                    P_("Spacing"),
+                                                    P_("Space which is inserted between cells"),
                                                     0,
                                                     G_MAXINT,
                                                     0,
-                                                    G_PARAM_READABLE));
+                                                    GTK_PARAM_READWRITE));
   g_object_class_install_property (object_class,
                                    PROP_SIZING,
                                    g_param_spec_enum ("sizing",
-                                                      _("Sizing"),
-                                                      _("Resize mode of the column"),
+                                                      P_("Sizing"),
+                                                      P_("Resize mode of the column"),
                                                       GTK_TYPE_TREE_VIEW_COLUMN_SIZING,
-                                                      GTK_TREE_VIEW_COLUMN_AUTOSIZE,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_TREE_VIEW_COLUMN_GROW_ONLY,
+                                                      GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_FIXED_WIDTH,
-                                   g_param_spec_int ("fixed_width",
-                                                     _("Fixed Width"),
-                                                     _("Current fixed width of the column"),
+                                   g_param_spec_int ("fixed-width",
+                                                     P_("Fixed Width"),
+                                                     P_("Current fixed width of the column"),
                                                      1,
                                                      G_MAXINT,
                                                      1, /* not useful */
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_MIN_WIDTH,
-                                   g_param_spec_int ("min_width",
-                                                     _("Minimum Width"),
-                                                     _("Minimum allowed width of the column"),
+                                   g_param_spec_int ("min-width",
+                                                     P_("Minimum Width"),
+                                                     P_("Minimum allowed width of the column"),
                                                      -1,
                                                      G_MAXINT,
                                                      -1,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_MAX_WIDTH,
-                                   g_param_spec_int ("max_width",
-                                                     _("Maximum Width"),
-                                                     _("Maximum allowed width of the column"),
+                                   g_param_spec_int ("max-width",
+                                                     P_("Maximum Width"),
+                                                     P_("Maximum allowed width of the column"),
                                                      -1,
                                                      G_MAXINT,
                                                      -1,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_TITLE,
                                    g_param_spec_string ("title",
-                                                        _("Title"),
-                                                        _("Title to appear in column header"),
+                                                        P_("Title"),
+                                                        P_("Title to appear in column header"),
                                                         "",
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
+  
+  g_object_class_install_property (object_class,
+                                   PROP_EXPAND,
+                                   g_param_spec_boolean ("expand",
+                                                        P_("Expand"),
+                                                        P_("Column gets share of extra width allocated to the widget"),
+                                                        FALSE,
+                                                        GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_CLICKABLE,
                                    g_param_spec_boolean ("clickable",
-                                                        _("Clickable"),
-                                                        _("Whether the header can be clicked"),
-                                                         TRUE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        P_("Clickable"),
+                                                        P_("Whether the header can be clicked"),
+                                                         FALSE,
+                                                         GTK_PARAM_READWRITE));
   
 
   g_object_class_install_property (object_class,
                                    PROP_WIDGET,
                                    g_param_spec_object ("widget",
-                                                        _("Widget"),
-                                                        _("Widget to put in column header button instead of column title"),
+                                                        P_("Widget"),
+                                                        P_("Widget to put in column header button instead of column title"),
                                                         GTK_TYPE_WIDGET,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_ALIGNMENT,
                                    g_param_spec_float ("alignment",
-                                                       _("Alignment"),
-                                                       _("X Alignment of the column header text or widget"),
+                                                       P_("Alignment"),
+                                                       P_("X Alignment of the column header text or widget"),
                                                        0.0,
                                                        1.0,
-                                                       0.5,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                       0.0,
+                                                       GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_REORDERABLE,
                                    g_param_spec_boolean ("reorderable",
-                                                        _("Reorderable"),
-                                                        _("Whether the column can be reordered around the headers"),
+                                                        P_("Reorderable"),
+                                                        P_("Whether the column can be reordered around the headers"),
                                                         FALSE,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_SORT_INDICATOR,
-                                   g_param_spec_boolean ("sort_indicator",
-                                                        _("Sort indicator"),
-                                                        _("Whether to show a sort indicator"),
+                                   g_param_spec_boolean ("sort-indicator",
+                                                        P_("Sort indicator"),
+                                                        P_("Whether to show a sort indicator"),
                                                          FALSE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_SORT_ORDER,
-                                   g_param_spec_enum ("sort_order",
-                                                      _("Sort order"),
-                                                      _("Sort direction the sort indicator should indicate"),
+                                   g_param_spec_enum ("sort-order",
+                                                      P_("Sort order"),
+                                                      P_("Sort direction the sort indicator should indicate"),
                                                       GTK_TYPE_SORT_TYPE,
                                                       GTK_SORT_ASCENDING,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
-  
+                                                      GTK_PARAM_READWRITE));
+
+  /**
+   * GtkTreeViewColumn:sort-column-id:
+   *
+   * Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
+   * clickable. Set to %-1 to make the column unsortable.
+   *
+   * Since: 2.18
+   **/
+  g_object_class_install_property (object_class,
+                                   PROP_SORT_COLUMN_ID,
+                                   g_param_spec_int ("sort-column-id",
+                                                     P_("Sort column ID"),
+                                                     P_("Logical sort column ID this column sorts on when selected for sorting"),
+                                                     -1,
+                                                     G_MAXINT,
+                                                     -1,
+                                                     GTK_PARAM_READWRITE));
+}
+
+static void
+gtk_tree_view_column_buildable_init (GtkBuildableIface *iface)
+{
+  iface->add_child = _gtk_cell_layout_buildable_add_child;
+  iface->custom_tag_start = _gtk_cell_layout_buildable_custom_tag_start;
+  iface->custom_tag_end = _gtk_cell_layout_buildable_custom_tag_end;
+}
+
+static void
+gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface)
+{
+  iface->pack_start = gtk_tree_view_column_cell_layout_pack_start;
+  iface->pack_end = gtk_tree_view_column_cell_layout_pack_end;
+  iface->clear = gtk_tree_view_column_cell_layout_clear;
+  iface->add_attribute = gtk_tree_view_column_cell_layout_add_attribute;
+  iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func;
+  iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes;
+  iface->reorder = gtk_tree_view_column_cell_layout_reorder;
+  iface->get_cells = gtk_tree_view_column_cell_layout_get_cells;
 }
 
 static void
@@ -310,6 +373,7 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
   tree_column->button = NULL;
   tree_column->xalign = 0.0;
   tree_column->width = 0;
+  tree_column->spacing = 0;
   tree_column->requested_width = -1;
   tree_column->min_width = -1;
   tree_column->max_width = -1;
@@ -317,6 +381,7 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
   tree_column->column_type = GTK_TREE_VIEW_COLUMN_GROW_ONLY;
   tree_column->visible = TRUE;
   tree_column->resizable = FALSE;
+  tree_column->expand = FALSE;
   tree_column->clickable = FALSE;
   tree_column->dirty = TRUE;
   tree_column->sort_order = GTK_SORT_ASCENDING;
@@ -327,7 +392,9 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
   tree_column->sort_column_id = -1;
   tree_column->reorderable = FALSE;
   tree_column->maybe_reordered = FALSE;
+  tree_column->fixed_width = 1;
   tree_column->use_resized_width = FALSE;
+  tree_column->title = g_strdup ("");
 }
 
 static void
@@ -342,19 +409,23 @@ gtk_tree_view_column_finalize (GObject *object)
 
       if (info->destroy)
        {
-         GtkDestroyNotify d = info->destroy;
+         GDestroyNotify d = info->destroy;
 
          info->destroy = NULL;
          d (info->func_data);
        }
       gtk_tree_view_column_clear_attributes_by_info (tree_column, info);
-      g_object_unref (G_OBJECT (info->cell));
+      g_object_unref (info->cell);
       g_free (info);
     }
 
   g_free (tree_column->title);
+  g_list_free (tree_column->cell_list);
+
+  if (tree_column->child)
+    g_object_unref (tree_column->child);
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_tree_view_column_parent_class)->finalize (object);
 }
 
 static void
@@ -399,11 +470,21 @@ gtk_tree_view_column_set_property (GObject         *object,
                                           g_value_get_int (value));
       break;
 
+    case PROP_SPACING:
+      gtk_tree_view_column_set_spacing (tree_column,
+                                       g_value_get_int (value));
+      break;
+
     case PROP_TITLE:
       gtk_tree_view_column_set_title (tree_column,
                                       g_value_get_string (value));
       break;
 
+    case PROP_EXPAND:
+      gtk_tree_view_column_set_expand (tree_column,
+                                      g_value_get_boolean (value));
+      break;
+
     case PROP_CLICKABLE:
       gtk_tree_view_column_set_clickable (tree_column,
                                           g_value_get_boolean (value));
@@ -434,6 +515,11 @@ gtk_tree_view_column_set_property (GObject         *object,
                                            g_value_get_enum (value));
       break;
       
+    case PROP_SORT_COLUMN_ID:
+      gtk_tree_view_column_set_sort_column_id (tree_column,
+                                               g_value_get_int (value));
+      break;
+      
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -467,6 +553,11 @@ gtk_tree_view_column_get_property (GObject         *object,
                        gtk_tree_view_column_get_width (tree_column));
       break;
 
+    case PROP_SPACING:
+      g_value_set_int (value,
+                       gtk_tree_view_column_get_spacing (tree_column));
+      break;
+
     case PROP_SIZING:
       g_value_set_enum (value,
                         gtk_tree_view_column_get_sizing (tree_column));
@@ -492,6 +583,11 @@ gtk_tree_view_column_get_property (GObject         *object,
                           gtk_tree_view_column_get_title (tree_column));
       break;
 
+    case PROP_EXPAND:
+      g_value_set_boolean (value,
+                          gtk_tree_view_column_get_expand (tree_column));
+      break;
+
     case PROP_CLICKABLE:
       g_value_set_boolean (value,
                            gtk_tree_view_column_get_clickable (tree_column));
@@ -522,12 +618,205 @@ gtk_tree_view_column_get_property (GObject         *object,
                         gtk_tree_view_column_get_sort_order (tree_column));
       break;
       
+    case PROP_SORT_COLUMN_ID:
+      g_value_set_int (value,
+                       gtk_tree_view_column_get_sort_column_id (tree_column));
+      break;
+      
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
     }
 }
 
+/* Implementation of GtkCellLayout interface
+ */
+
+static void
+gtk_tree_view_column_cell_layout_pack_start (GtkCellLayout   *cell_layout,
+                                             GtkCellRenderer *cell,
+                                             gboolean         expand)
+{
+  GtkTreeViewColumn *column;
+  GtkTreeViewColumnCellInfo *cell_info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+  g_return_if_fail (! gtk_tree_view_column_get_cell_info (column, cell));
+
+  g_object_ref_sink (cell);
+
+  cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1);
+  cell_info->cell = cell;
+  cell_info->expand = expand ? TRUE : FALSE;
+  cell_info->pack = GTK_PACK_START;
+  cell_info->has_focus = 0;
+  cell_info->attributes = NULL;
+
+  column->cell_list = g_list_append (column->cell_list, cell_info);
+}
+
+static void
+gtk_tree_view_column_cell_layout_pack_end (GtkCellLayout   *cell_layout,
+                                           GtkCellRenderer *cell,
+                                           gboolean         expand)
+{
+  GtkTreeViewColumn *column;
+  GtkTreeViewColumnCellInfo *cell_info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+  g_return_if_fail (! gtk_tree_view_column_get_cell_info (column, cell));
+
+  g_object_ref_sink (cell);
+
+  cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1);
+  cell_info->cell = cell;
+  cell_info->expand = expand ? TRUE : FALSE;
+  cell_info->pack = GTK_PACK_END;
+  cell_info->has_focus = 0;
+  cell_info->attributes = NULL;
+
+  column->cell_list = g_list_append (column->cell_list, cell_info);
+}
+
+static void
+gtk_tree_view_column_cell_layout_clear (GtkCellLayout *cell_layout)
+{
+  GtkTreeViewColumn *column;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+  while (column->cell_list)
+    {
+      GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *)column->cell_list->data;
+
+      gtk_tree_view_column_cell_layout_clear_attributes (cell_layout, info->cell);
+      g_object_unref (info->cell);
+      g_free (info);
+      column->cell_list = g_list_delete_link (column->cell_list, 
+                                             column->cell_list);
+    }
+}
+
+static void
+gtk_tree_view_column_cell_layout_add_attribute (GtkCellLayout   *cell_layout,
+                                                GtkCellRenderer *cell,
+                                                const gchar     *attribute,
+                                                gint             column)
+{
+  GtkTreeViewColumn *tree_column;
+  GtkTreeViewColumnCellInfo *info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  tree_column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+  info = gtk_tree_view_column_get_cell_info (tree_column, cell);
+  g_return_if_fail (info != NULL);
+
+  info->attributes = g_slist_prepend (info->attributes, GINT_TO_POINTER (column));
+  info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute));
+
+  if (tree_column->tree_view)
+    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+}
+
+static void
+gtk_tree_view_column_cell_layout_set_cell_data_func (GtkCellLayout         *cell_layout,
+                                                     GtkCellRenderer       *cell,
+                                                     GtkCellLayoutDataFunc  func,
+                                                     gpointer               func_data,
+                                                     GDestroyNotify         destroy)
+{
+  GtkTreeViewColumn *column;
+  GtkTreeViewColumnCellInfo *info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+  info = gtk_tree_view_column_get_cell_info (column, cell);
+  g_return_if_fail (info != NULL);
+
+  if (info->destroy)
+    {
+      GDestroyNotify d = info->destroy;
+
+      info->destroy = NULL;
+      d (info->func_data);
+    }
+
+  info->func = (GtkTreeCellDataFunc)func;
+  info->func_data = func_data;
+  info->destroy = destroy;
+
+  if (column->tree_view)
+    _gtk_tree_view_column_cell_set_dirty (column, TRUE);
+}
+
+static void
+gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout    *cell_layout,
+                                                   GtkCellRenderer  *cell_renderer)
+{
+  GtkTreeViewColumn *column;
+  GtkTreeViewColumnCellInfo *info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+  info = gtk_tree_view_column_get_cell_info (column, cell_renderer);
+  if (info)
+    gtk_tree_view_column_clear_attributes_by_info (column, info);
+}
+
+static void
+gtk_tree_view_column_cell_layout_reorder (GtkCellLayout   *cell_layout,
+                                          GtkCellRenderer *cell,
+                                          gint             position)
+{
+  GList *link;
+  GtkTreeViewColumn *column;
+  GtkTreeViewColumnCellInfo *info;
+
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout));
+  column = GTK_TREE_VIEW_COLUMN (cell_layout);
+
+  info = gtk_tree_view_column_get_cell_info (column, cell);
+
+  g_return_if_fail (info != NULL);
+  g_return_if_fail (position >= 0);
+
+  link = g_list_find (column->cell_list, info);
+
+  g_return_if_fail (link != NULL);
+
+  column->cell_list = g_list_delete_link (column->cell_list, link);
+  column->cell_list = g_list_insert (column->cell_list, info, position);
+
+  if (column->tree_view)
+    gtk_widget_queue_draw (column->tree_view);
+}
+
+static void
+gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
+                                              GtkTreeViewColumnCellInfo *info)
+{
+  GSList *list;
+
+  list = info->attributes;
+
+  while (list && list->next)
+    {
+      g_free (list->data);
+      list = list->next->next;
+    }
+  g_slist_free (info->attributes);
+  info->attributes = NULL;
+
+  if (tree_column->tree_view)
+    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+}
+
 /* Helper functions
  */
 
@@ -555,12 +844,12 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
     gtk_widget_set_parent_window (tree_column->button, tree_view->priv->header_window);
   gtk_widget_set_parent (tree_column->button, GTK_WIDGET (tree_view));
 
-  g_signal_connect (G_OBJECT (tree_column->button), "event",
+  g_signal_connect (tree_column->button, "event",
                    G_CALLBACK (gtk_tree_view_column_button_event),
-                   (gpointer) tree_column);
-  g_signal_connect (G_OBJECT (tree_column->button), "clicked",
-                   (GtkSignalFunc) gtk_tree_view_column_button_clicked,
-                   (gpointer) tree_column);
+                   tree_column);
+  g_signal_connect (tree_column->button, "clicked",
+                   G_CALLBACK (gtk_tree_view_column_button_clicked),
+                   tree_column);
 
   tree_column->alignment = gtk_alignment_new (tree_column->xalign, 0.5, 0.0, 0.0);
 
@@ -575,9 +864,9 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
       gtk_widget_show (child);
     }
 
-  g_signal_connect (G_OBJECT (child), "mnemonic_activate",
+  g_signal_connect (child, "mnemonic-activate",
                    G_CALLBACK (gtk_tree_view_column_mnemonic_activate),
-                   (gpointer) tree_column);
+                   tree_column);
 
   if (tree_column->xalign <= 0.5)
     gtk_box_pack_end (GTK_BOX (hbox), tree_column->arrow, FALSE, FALSE, 0);
@@ -597,10 +886,18 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
 static void 
 gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
 {
+  gint sort_column_id = -1;
   GtkWidget *hbox;
   GtkWidget *alignment;
   GtkWidget *arrow;
   GtkWidget *current_child;
+  GtkArrowType arrow_type = GTK_ARROW_NONE;
+  GtkTreeModel *model;
+
+  if (tree_column->tree_view)
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_column->tree_view));
+  else
+    model = NULL;
 
   /* Create a button if necessary */
   if (tree_column->visible &&
@@ -651,30 +948,44 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
                                          "");
     }
 
-  switch (tree_column->sort_order)
+  if (GTK_IS_TREE_SORTABLE (model))
+    gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
+                                         &sort_column_id,
+                                         NULL);
+
+  if (tree_column->show_sort_indicator)
     {
-    case GTK_SORT_ASCENDING:
-      gtk_arrow_set (GTK_ARROW (arrow),
-                    GTK_ARROW_DOWN,
-                    GTK_SHADOW_IN);
-      break;
+      gboolean alternative;
 
-    case GTK_SORT_DESCENDING:
-      gtk_arrow_set (GTK_ARROW (arrow),
-                    GTK_ARROW_UP,
-                    GTK_SHADOW_IN);
-      break;
-          
-    default:
-      g_warning (G_STRLOC": bad sort order");
-      break;
+      g_object_get (gtk_widget_get_settings (tree_column->tree_view),
+                   "gtk-alternative-sort-arrows", &alternative,
+                   NULL);
+
+      switch (tree_column->sort_order)
+        {
+         case GTK_SORT_ASCENDING:
+           arrow_type = alternative ? GTK_ARROW_UP : GTK_ARROW_DOWN;
+           break;
+
+         case GTK_SORT_DESCENDING:
+           arrow_type = alternative ? GTK_ARROW_DOWN : GTK_ARROW_UP;
+           break;
+
+         default:
+           g_warning (G_STRLOC": bad sort order");
+           break;
+       }
     }
 
+  gtk_arrow_set (GTK_ARROW (arrow),
+                arrow_type,
+                GTK_SHADOW_IN);
+
   /* Put arrow on the right if the text is left-or-center justified, and on the
    * left otherwise; do this by packing boxes, so flipping text direction will
    * reverse things
    */
-  gtk_widget_ref (arrow);
+  g_object_ref (arrow);
   gtk_container_remove (GTK_CONTAINER (hbox), arrow);
 
   if (tree_column->xalign <= 0.5)
@@ -687,9 +998,10 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
       /* move it to the front */
       gtk_box_reorder_child (GTK_BOX (hbox), arrow, 0);
     }
-  gtk_widget_unref (arrow);
+  g_object_unref (arrow);
 
-  if (tree_column->show_sort_indicator)
+  if (tree_column->show_sort_indicator
+      || (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
     gtk_widget_show (arrow);
   else
     gtk_widget_hide (arrow);
@@ -761,22 +1073,23 @@ gtk_tree_view_column_button_event (GtkWidget *widget,
   g_return_val_if_fail (event != NULL, FALSE);
 
   if (event->type == GDK_BUTTON_PRESS &&
-      column->reorderable)
+      column->reorderable &&
+      ((GdkEventButton *)event)->button == 1)
     {
       column->maybe_reordered = TRUE;
-      gdk_window_get_pointer (widget->window,
+      gdk_window_get_pointer (GTK_BUTTON (widget)->event_window,
                              &column->drag_x,
                              &column->drag_y,
                              NULL);
       gtk_widget_grab_focus (widget);
     }
 
-  if (event->type == GDK_BUTTON_RELEASE &&
-      column->maybe_reordered)
+  if (event->type == GDK_BUTTON_RELEASE ||
+      event->type == GDK_LEAVE_NOTIFY)
     column->maybe_reordered = FALSE;
-
+  
   if (event->type == GDK_MOTION_NOTIFY &&
-      (column->maybe_reordered) &&
+      column->maybe_reordered &&
       (gtk_drag_check_threshold (widget,
                                 column->drag_x,
                                 column->drag_y,
@@ -784,10 +1097,6 @@ gtk_tree_view_column_button_event (GtkWidget *widget,
                                 (gint) ((GdkEventMotion *)event)->y)))
     {
       column->maybe_reordered = FALSE;
-      /* this is to change our drag_x to be relative to
-       * tree_view->priv->bin_window, instead of our window.
-       */
-      column->drag_x -= column->button->allocation.x;
       _gtk_tree_view_column_start_drag (GTK_TREE_VIEW (column->tree_view), column);
       return TRUE;
     }
@@ -814,7 +1123,7 @@ gtk_tree_view_column_button_event (GtkWidget *widget,
 static void
 gtk_tree_view_column_button_clicked (GtkWidget *widget, gpointer data)
 {
-  g_signal_emit_by_name (G_OBJECT (data), "clicked");
+  g_signal_emit_by_name (data, "clicked");
 }
 
 static gboolean
@@ -928,9 +1237,9 @@ gtk_tree_view_column_setup_sort_column_id_callback (GtkTreeViewColumn *tree_colu
 
       if (tree_column->sort_column_changed_signal == 0)
         tree_column->sort_column_changed_signal =
-         g_signal_connect (G_OBJECT (model), "sort_column_changed",
-                            GTK_SIGNAL_FUNC (gtk_tree_view_model_sort_column_changed),
-                            tree_column);
+         g_signal_connect (model, "sort-column-changed",
+                           G_CALLBACK (gtk_tree_view_model_sort_column_changed),
+                           tree_column);
       
       if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
                                                &real_sort_column_id,
@@ -939,10 +1248,12 @@ gtk_tree_view_column_setup_sort_column_id_callback (GtkTreeViewColumn *tree_colu
        {
          gtk_tree_view_column_set_sort_indicator (tree_column, TRUE);
          gtk_tree_view_column_set_sort_order (tree_column, real_order);
-
-         return;
+       }
+      else 
+       {
+         gtk_tree_view_column_set_sort_indicator (tree_column, FALSE);
        }
-    }
+   }
 }
 
 
@@ -956,8 +1267,10 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
   GtkTreeView *tree_view;
   GdkWindowAttr attr;
   guint attributes_mask;
+  gboolean rtl;
 
   tree_view = (GtkTreeView *)column->tree_view;
+  rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
 
   g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
   g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
@@ -973,8 +1286,8 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
   attr.wclass = GDK_INPUT_ONLY;
   attr.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
   attr.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
-  attr.event_mask = gtk_widget_get_events (GTK_WIDGET (tree_view));
-  attr.event_mask = (GDK_BUTTON_PRESS_MASK |
+  attr.event_mask = gtk_widget_get_events (GTK_WIDGET (tree_view)) |
+                    (GDK_BUTTON_PRESS_MASK |
                     GDK_BUTTON_RELEASE_MASK |
                     GDK_POINTER_MOTION_MASK |
                     GDK_POINTER_MOTION_HINT_MASK |
@@ -986,8 +1299,7 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
   attr.width = TREE_VIEW_DRAG_WIDTH;
   attr.height = tree_view->priv->header_height;
 
-  attr.x = (column->button->allocation.x + column->button->allocation.width) - 3;
-          
+  attr.x = (column->button->allocation.x + (rtl ? 0 : column->button->allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
   column->window = gdk_window_new (tree_view->priv->header_window,
                                   &attr, attributes_mask);
   gdk_window_set_user_data (column->window, tree_view);
@@ -1013,9 +1325,12 @@ _gtk_tree_view_column_unset_model (GtkTreeViewColumn *column,
                                   GtkTreeModel      *old_model)
 {
   if (column->sort_column_changed_signal)
-    g_signal_handler_disconnect (G_OBJECT (old_model),
-                                column->sort_column_changed_signal);
-    column->sort_column_changed_signal = 0;
+    {
+      g_signal_handler_disconnect (old_model,
+                                  column->sort_column_changed_signal);
+      column->sort_column_changed_signal = 0;
+    }
+  gtk_tree_view_column_set_sort_indicator (column, FALSE);
 }
 
 void
@@ -1028,9 +1343,9 @@ _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
   gtk_tree_view_column_create_button (column);
 
   column->property_changed_signal =
-         g_signal_connect_swapped (GTK_OBJECT (tree_view),
+         g_signal_connect_swapped (tree_view,
                                    "notify::model",
-                                   GTK_SIGNAL_FUNC (gtk_tree_view_column_setup_sort_column_id_callback),
+                                   G_CALLBACK (gtk_tree_view_column_setup_sort_column_id_callback),
                                    column);
 
   gtk_tree_view_column_setup_sort_column_id_callback (column);
@@ -1045,13 +1360,13 @@ _gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column)
     }
   if (column->property_changed_signal)
     {
-      g_signal_handler_disconnect (G_OBJECT (column->tree_view), column->property_changed_signal);
+      g_signal_handler_disconnect (column->tree_view, column->property_changed_signal);
       column->property_changed_signal = 0;
     }
 
   if (column->sort_column_changed_signal)
     {
-      g_signal_handler_disconnect (G_OBJECT (gtk_tree_view_get_model (GTK_TREE_VIEW (column->tree_view))),
+      g_signal_handler_disconnect (gtk_tree_view_get_model (GTK_TREE_VIEW (column->tree_view)),
                                   column->sort_column_changed_signal);
       column->sort_column_changed_signal = 0;
     }
@@ -1096,8 +1411,9 @@ _gtk_tree_view_column_count_special_cells (GtkTreeViewColumn *column)
     {
       GtkTreeViewColumnCellInfo *cellinfo = list->data;
 
-      if (cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
-         cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
+      if ((cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
+         cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
+         cellinfo->cell->visible)
        i++;
     }
 
@@ -1138,7 +1454,7 @@ gtk_tree_view_column_new (void)
 {
   GtkTreeViewColumn *tree_column;
 
-  tree_column = GTK_TREE_VIEW_COLUMN (gtk_type_new (GTK_TYPE_TREE_VIEW_COLUMN));
+  tree_column = g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, NULL);
 
   return tree_column;
 }
@@ -1155,12 +1471,12 @@ gtk_tree_view_column_new (void)
  * gtk_tree_view_column_set_attributes() on the newly created #GtkTreeViewColumn.
  *
  * Here's a simple example:
- * <informalexample><programlisting>
+ * |[
  *  enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
  *  ...
  *  {
  *    GtkTreeViewColumn *column;
- *    GtkCellRenderer   *renderer = gtk_cell_renderer_text_new (<!-- -->);
+ *    GtkCellRenderer   *renderer = gtk_cell_renderer_text_new ();
  *  
  *    column = gtk_tree_view_column_new_with_attributes ("Title",
  *                                                       renderer,
@@ -1168,7 +1484,7 @@ gtk_tree_view_column_new (void)
  *                                                       "foreground", COLOR_COLUMN,
  *                                                       NULL);
  *  }
- * </programlisting></informalexample>
+ * ]|
  * 
  * Return value: A newly created #GtkTreeViewColumn.
  **/
@@ -1208,69 +1524,38 @@ gtk_tree_view_column_get_cell_info (GtkTreeViewColumn *tree_column,
  * gtk_tree_view_column_pack_start:
  * @tree_column: A #GtkTreeViewColumn.
  * @cell: The #GtkCellRenderer. 
- * @expand: %TRUE if @cell is to be given extra space allocated to box.
+ * @expand: %TRUE if @cell is to be given extra space allocated to @tree_column.
  *
- * Packs the @cell into the beginning column.  If @expand is %TRUE, then the
- * @cell is allocated a share of all available space that the @tree_column has.
+ * Packs the @cell into the beginning of the column. If @expand is %FALSE, then
+ * the @cell is allocated no more space than it needs. Any unused space is divided
+ * evenly between cells for which @expand is %TRUE.
  **/
 void
 gtk_tree_view_column_pack_start (GtkTreeViewColumn *tree_column,
                                 GtkCellRenderer   *cell,
                                 gboolean           expand)
 {
-  GtkTreeViewColumnCellInfo *cell_info;
-
-  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-  g_return_if_fail (! gtk_tree_view_column_get_cell_info (tree_column, cell));
-
-  g_object_ref (G_OBJECT (cell));
-  gtk_object_sink (GTK_OBJECT (cell));
-
-  cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1);
-  cell_info->cell = cell;
-  cell_info->expand = expand ? TRUE : FALSE;
-  cell_info->pack = GTK_PACK_START;
-  cell_info->has_focus = 0;
-  cell_info->attributes = NULL;
-
-  tree_column->cell_list = g_list_append (tree_column->cell_list, cell_info);
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (tree_column), cell, expand);
 }
 
 /**
  * gtk_tree_view_column_pack_end:
  * @tree_column: A #GtkTreeViewColumn.
  * @cell: The #GtkCellRenderer. 
- * @expand: %TRUE if @cell is to be given extra space allocated to box.
+ * @expand: %TRUE if @cell is to be given extra space allocated to @tree_column.
  *
- * Packs the @cell into the column.  If @expand is %TRUE, then the @cell is
- * allocated a share of all available space that the @tree_column has.
+ * Adds the @cell to end of the column. If @expand is %FALSE, then the @cell
+ * is allocated no more space than it needs. Any unused space is divided
+ * evenly between cells for which @expand is %TRUE.
  **/
 void
 gtk_tree_view_column_pack_end (GtkTreeViewColumn  *tree_column,
                               GtkCellRenderer    *cell,
                               gboolean            expand)
 {
-  GtkTreeViewColumnCellInfo *cell_info;
-
-  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-  g_return_if_fail (! gtk_tree_view_column_get_cell_info (tree_column, cell));
-
-  g_object_ref (G_OBJECT (cell));
-  gtk_object_sink (GTK_OBJECT (cell));
-
-  cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1);
-  cell_info->cell = cell;
-  cell_info->expand = expand ? TRUE : FALSE;
-  cell_info->pack = GTK_PACK_END;
-  cell_info->has_focus = 0;
-  cell_info->attributes = NULL;
-
-  tree_column->cell_list = g_list_append (tree_column->cell_list, cell_info);
+  gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (tree_column), cell, expand);
 }
 
-
 /**
  * gtk_tree_view_column_clear:
  * @tree_column: A #GtkTreeViewColumn
@@ -1280,46 +1565,42 @@ gtk_tree_view_column_pack_end (GtkTreeViewColumn  *tree_column,
 void
 gtk_tree_view_column_clear (GtkTreeViewColumn *tree_column)
 {
-  GList *list;
-  g_return_if_fail (tree_column != NULL);
+  gtk_cell_layout_clear (GTK_CELL_LAYOUT (tree_column));
+}
+
+static GList *
+gtk_tree_view_column_cell_layout_get_cells (GtkCellLayout *layout)
+{
+  GtkTreeViewColumn *tree_column = GTK_TREE_VIEW_COLUMN (layout);
+  GList *retval = NULL, *list;
+
+  g_return_val_if_fail (tree_column != NULL, NULL);
 
   for (list = tree_column->cell_list; list; list = list->next)
     {
       GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *)list->data;
 
-      gtk_tree_view_column_clear_attributes (tree_column, info->cell);
-      g_object_unref (G_OBJECT (info->cell));
-      g_free (info);
+      retval = g_list_append (retval, info->cell);
     }
 
-  g_list_free (tree_column->cell_list);
-  tree_column->cell_list = NULL;
+  return retval;
 }
 
 /**
  * gtk_tree_view_column_get_cell_renderers:
  * @tree_column: A #GtkTreeViewColumn
- * 
- * Returns a newly-allocated #GList of all the cell renderers in the column, 
+ *
+ * Returns a newly-allocated #GList of all the cell renderers in the column,
  * in no particular order.  The list must be freed with g_list_free().
- * 
+ *
  * Return value: A list of #GtkCellRenderers
+ *
+ * Deprecated: 2.18: use gtk_cell_layout_get_cells() instead.
  **/
 GList *
 gtk_tree_view_column_get_cell_renderers (GtkTreeViewColumn *tree_column)
 {
-  GList *retval = NULL, *list;
-
-  g_return_val_if_fail (tree_column != NULL, NULL);
-
-  for (list = tree_column->cell_list; list; list = list->next)
-    {
-      GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *)list->data;
-
-      retval = g_list_append (retval, info->cell);
-    }
-
-  return retval;
+  return gtk_tree_view_column_cell_layout_get_cells (GTK_CELL_LAYOUT (tree_column));
 }
 
 /**
@@ -1342,18 +1623,8 @@ gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
                                    const gchar       *attribute,
                                    gint               column)
 {
-  GtkTreeViewColumnCellInfo *info;
-
-  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  info = gtk_tree_view_column_get_cell_info (tree_column, cell_renderer);
-  g_return_if_fail (info != NULL);
-
-  info->attributes = g_slist_prepend (info->attributes, GINT_TO_POINTER (column));
-  info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute));
-
-  if (tree_column->tree_view)
-    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
-
+  gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (tree_column),
+                                 cell_renderer, attribute, column);
 }
 
 static void
@@ -1423,30 +1694,12 @@ gtk_tree_view_column_set_cell_data_func (GtkTreeViewColumn   *tree_column,
                                         GtkCellRenderer     *cell_renderer,
                                         GtkTreeCellDataFunc  func,
                                         gpointer             func_data,
-                                        GtkDestroyNotify     destroy)
+                                        GDestroyNotify       destroy)
 {
-  GtkTreeViewColumnCellInfo *info;
-
-  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell_renderer));
-  info = gtk_tree_view_column_get_cell_info (tree_column, cell_renderer);
-
-  g_return_if_fail (info != NULL);
-
-  if (info->destroy)
-    {
-      GtkDestroyNotify d = info->destroy;
-
-      info->destroy = NULL;
-      d (info->func_data);
-    }
-
-  info->func = func;
-  info->func_data = func_data;
-  info->destroy = destroy;
-
-  if (tree_column->tree_view)
-    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (tree_column),
+                                      cell_renderer,
+                                      (GtkCellLayoutDataFunc)func,
+                                      func_data, destroy);
 }
 
 
@@ -1462,37 +1715,10 @@ void
 gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column,
                                       GtkCellRenderer   *cell_renderer)
 {
-  GtkTreeViewColumnCellInfo *info;
-
-  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell_renderer));
-
-  info = gtk_tree_view_column_get_cell_info (tree_column, cell_renderer);
-
-  gtk_tree_view_column_clear_attributes_by_info (tree_column, info);
-}
-
-static void 
-gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColumn *tree_column,
-                                              GtkTreeViewColumnCellInfo *info)
-{
-  GSList *list;
-
-  list = info->attributes;
-
-  while (list && list->next)
-    {
-      g_free (list->data);
-      list = list->next->next;
-    }
-  g_slist_free (info->attributes);
-  info->attributes = NULL;
-
-  if (tree_column->tree_view)
-    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+  gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (tree_column),
+                                    cell_renderer);
 }
 
-
 /**
  * gtk_tree_view_column_set_spacing:
  * @tree_column: A #GtkTreeViewColumn.
@@ -1584,7 +1810,7 @@ gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column)
  * @resizable: %TRUE, if the column can be resized
  * 
  * If @resizable is %TRUE, then the user can explicitly resize the column by
- * grabbing the outer edge of the column button.  If resizable is TRUE and
+ * grabbing the outer edge of the column button.  If resizable is %TRUE and
  * sizing mode of the column is #GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizing
  * mode is changed to #GTK_TREE_VIEW_COLUMN_GROW_ONLY.
  **/
@@ -1613,9 +1839,9 @@ gtk_tree_view_column_set_resizable (GtkTreeViewColumn *tree_column,
  * gtk_tree_view_column_get_resizable:
  * @tree_column: A #GtkTreeViewColumn
  * 
- * Returns #TRUE if the @tree_column can be resized by the end user.
+ * Returns %TRUE if the @tree_column can be resized by the end user.
  * 
- * Return value: #TRUE, if the @tree_column can be resized.
+ * Return value: %TRUE, if the @tree_column can be resized.
  **/
 gboolean
 gtk_tree_view_column_get_resizable (GtkTreeViewColumn *tree_column)
@@ -1713,6 +1939,7 @@ gtk_tree_view_column_set_fixed_width (GtkTreeViewColumn *tree_column,
   g_return_if_fail (fixed_width > 0);
 
   tree_column->fixed_width = fixed_width;
+  tree_column->use_resized_width = FALSE;
 
   if (tree_column->tree_view &&
       GTK_WIDGET_REALIZED (tree_column->tree_view) &&
@@ -1721,7 +1948,7 @@ gtk_tree_view_column_set_fixed_width (GtkTreeViewColumn *tree_column,
       gtk_widget_queue_resize (tree_column->tree_view);
     }
 
-  g_object_notify (G_OBJECT (tree_column), "fixed_width");
+  g_object_notify (G_OBJECT (tree_column), "fixed-width");
 }
 
 /**
@@ -1772,9 +1999,9 @@ gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
   if (tree_column->max_width != -1 && tree_column->max_width < min_width)
     {
       tree_column->max_width = min_width;
-      g_object_notify (G_OBJECT (tree_column), "max_width");
+      g_object_notify (G_OBJECT (tree_column), "max-width");
     }
-  g_object_notify (G_OBJECT (tree_column), "min_width");
+  g_object_notify (G_OBJECT (tree_column), "min-width");
   g_object_thaw_notify (G_OBJECT (tree_column));
 
   if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
@@ -1832,9 +2059,9 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
   if (max_width != -1 && max_width < tree_column->min_width)
     {
       tree_column->min_width = max_width;
-      g_object_notify (G_OBJECT (tree_column), "min_width");
+      g_object_notify (G_OBJECT (tree_column), "min-width");
     }
-  g_object_notify (G_OBJECT (tree_column), "max_width");
+  g_object_notify (G_OBJECT (tree_column), "max-width");
   g_object_thaw_notify (G_OBJECT (tree_column));
 
   if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
@@ -1889,13 +2116,13 @@ void
 gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
                                const gchar       *title)
 {
+  gchar *new_title;
+  
   g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
 
+  new_title = g_strdup (title);
   g_free (tree_column->title);
-  if (title)
-    tree_column->title = g_strdup (title);
-  else
-    tree_column->title = NULL;
+  tree_column->title = new_title;
 
   gtk_tree_view_column_update_button (tree_column);
   g_object_notify (G_OBJECT (tree_column), "title");
@@ -1918,6 +2145,64 @@ gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column)
   return tree_column->title;
 }
 
+/**
+ * gtk_tree_view_column_set_expand:
+ * @tree_column: A #GtkTreeViewColumn
+ * @expand: %TRUE if the column should take available extra space, %FALSE if not
+ * 
+ * Sets the column to take available extra space.  This space is shared equally
+ * amongst all columns that have the expand set to %TRUE.  If no column has this
+ * option set, then the last column gets all extra space.  By default, every
+ * column is created with this %FALSE.
+ *
+ * Since: 2.4
+ **/
+void
+gtk_tree_view_column_set_expand (GtkTreeViewColumn *tree_column,
+                                gboolean           expand)
+{
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+
+  expand = expand?TRUE:FALSE;
+  if (tree_column->expand == expand)
+    return;
+  tree_column->expand = expand;
+
+  if (tree_column->visible &&
+      tree_column->tree_view != NULL &&
+      GTK_WIDGET_REALIZED (tree_column->tree_view))
+    {
+      /* We want to continue using the original width of the
+       * column that includes additional space added by the user
+       * resizing the columns and possibly extra (expanded) space, which
+       * are not included in the resized width.
+       */
+      tree_column->use_resized_width = FALSE;
+
+      gtk_widget_queue_resize (tree_column->tree_view);
+    }
+
+  g_object_notify (G_OBJECT (tree_column), "expand");
+}
+
+/**
+ * gtk_tree_view_column_get_expand:
+ * @tree_column: a #GtkTreeViewColumn
+ * 
+ * Return %TRUE if the column expands to take any available space.
+ * 
+ * Return value: %TRUE, if the column expands
+ *
+ * Since: 2.4
+ **/
+gboolean
+gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column)
+{
+  g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
+
+  return tree_column->expand;
+}
+
 /**
  * gtk_tree_view_column_set_clickable:
  * @tree_column: A #GtkTreeViewColumn.
@@ -1973,13 +2258,10 @@ gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column,
   g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
 
   if (widget)
-    {
-      gtk_object_ref (GTK_OBJECT (widget));
-      gtk_object_sink (GTK_OBJECT (widget));
-    }
+    g_object_ref_sink (widget);
 
   if (tree_column->child)      
-    gtk_object_unref (GTK_OBJECT (tree_column->child));
+    g_object_unref (tree_column->child);
 
   tree_column->child = widget;
   gtk_tree_view_column_update_button (tree_column);
@@ -2048,9 +2330,9 @@ gtk_tree_view_column_get_alignment (GtkTreeViewColumn *tree_column)
 /**
  * gtk_tree_view_column_set_reorderable:
  * @tree_column: A #GtkTreeViewColumn
- * @reorderable: #TRUE, if the column can be reordered.
+ * @reorderable: %TRUE, if the column can be reordered.
  * 
- * If @reorderable is #TRUE, then the column can be reordered by the end user
+ * If @reorderable is %TRUE, then the column can be reordered by the end user
  * dragging the header.
  **/
 void
@@ -2074,9 +2356,9 @@ gtk_tree_view_column_set_reorderable (GtkTreeViewColumn *tree_column,
  * gtk_tree_view_column_get_reorderable:
  * @tree_column: A #GtkTreeViewColumn
  * 
- * Returns #TRUE if the @tree_column can be reordered by the user.
+ * Returns %TRUE if the @tree_column can be reordered by the user.
  * 
- * Return value: #TRUE if the @tree_column can be reordered by the user.
+ * Return value: %TRUE if the @tree_column can be reordered by the user.
  **/
 gboolean
 gtk_tree_view_column_get_reorderable (GtkTreeViewColumn *tree_column)
@@ -2091,7 +2373,7 @@ gtk_tree_view_column_get_reorderable (GtkTreeViewColumn *tree_column)
  * gtk_tree_view_column_set_sort_column_id:
  * @tree_column: a #GtkTreeViewColumn
  * @sort_column_id: The @sort_column_id of the model to sort on.
- * 
+ *
  * Sets the logical @sort_column_id that this column sorts on when this column 
  * is selected for sorting.  Doing so makes the column header clickable.
  **/
@@ -2100,7 +2382,7 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
                                         gint               sort_column_id)
 {
   g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (sort_column_id >= 0);
+  g_return_if_fail (sort_column_id >= -1);
 
   if (tree_column->sort_column_id == sort_column_id)
     return;
@@ -2110,32 +2392,37 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
   /* Handle unsetting the id */
   if (sort_column_id == -1)
     {
+      GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_column->tree_view));
+
       if (tree_column->sort_clicked_signal)
        {
-         g_signal_handler_disconnect (G_OBJECT (tree_column), tree_column->sort_clicked_signal);
+         g_signal_handler_disconnect (tree_column, tree_column->sort_clicked_signal);
          tree_column->sort_clicked_signal = 0;
        }
 
       if (tree_column->sort_column_changed_signal)
        {
-         g_signal_handler_disconnect (G_OBJECT (tree_column), tree_column->sort_column_changed_signal);
+         g_signal_handler_disconnect (model, tree_column->sort_column_changed_signal);
          tree_column->sort_column_changed_signal = 0;
        }
 
       gtk_tree_view_column_set_sort_order (tree_column, GTK_SORT_ASCENDING);
       gtk_tree_view_column_set_sort_indicator (tree_column, FALSE);
+      gtk_tree_view_column_set_clickable (tree_column, FALSE);
+      g_object_notify (G_OBJECT (tree_column), "sort-column-id");
       return;
     }
 
   gtk_tree_view_column_set_clickable (tree_column, TRUE);
 
   if (! tree_column->sort_clicked_signal)
-    tree_column->sort_clicked_signal = g_signal_connect (G_OBJECT (tree_column),
+    tree_column->sort_clicked_signal = g_signal_connect (tree_column,
                                                          "clicked",
                                                          G_CALLBACK (gtk_tree_view_column_sort),
                                                          NULL);
 
   gtk_tree_view_column_setup_sort_column_id_callback (tree_column);
+  g_object_notify (G_OBJECT (tree_column), "sort-column-id");
 }
 
 /**
@@ -2143,7 +2430,8 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
  * @tree_column: a #GtkTreeViewColumn
  *
  * Gets the logical @sort_column_id that the model sorts on when this
- * column is selected for sorting. See gtk_tree_view_column_set_sort_column_id().
+ * column is selected for sorting.
+ * See gtk_tree_view_column_set_sort_column_id().
  *
  * Return value: the current @sort_column_id for this column, or -1 if
  *               this column can't be used for sorting.
@@ -2180,7 +2468,7 @@ gtk_tree_view_column_set_sort_indicator (GtkTreeViewColumn     *tree_column,
 
   tree_column->show_sort_indicator = setting;
   gtk_tree_view_column_update_button (tree_column);
-  g_object_notify (G_OBJECT (tree_column), "sort_indicator");
+  g_object_notify (G_OBJECT (tree_column), "sort-indicator");
 }
 
 /**
@@ -2227,7 +2515,7 @@ gtk_tree_view_column_set_sort_order      (GtkTreeViewColumn     *tree_column,
 
   tree_column->sort_order = order;
   gtk_tree_view_column_update_button (tree_column);
-  g_object_notify (G_OBJECT (tree_column), "sort_order");
+  g_object_notify (G_OBJECT (tree_column), "sort-order");
 }
 
 /**
@@ -2254,9 +2542,9 @@ gtk_tree_view_column_get_sort_order      (GtkTreeViewColumn     *tree_column)
  * @is_expander: %TRUE, if the row has children
  * @is_expanded: %TRUE, if the row has visible children
  * 
- * Sets the cell renderer based on the @tree_model and @tree_node.  That is, for
+ * Sets the cell renderer based on the @tree_model and @iter.  That is, for
  * every attribute mapping in @tree_column, it will get a value from the set
- * column on the @tree_node, and use that value to set the attribute on the cell
+ * column on the @iter, and use that value to set the attribute on the cell
  * renderer.  This is used primarily by the #GtkTreeView.
  **/
 void
@@ -2271,7 +2559,6 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
   GList *cell_list;
 
   g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
-  g_return_if_fail (tree_column->cell_list != NULL);
 
   if (tree_model == NULL)
     return;
@@ -2284,7 +2571,12 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
       list = info->attributes;
 
       g_object_freeze_notify (cell);
-      g_object_set (cell, "is_expander", is_expander, "is_expanded", is_expanded, NULL);
+
+      if (info->cell->is_expander != is_expander)
+       g_object_set (cell, "is-expander", is_expander, NULL);
+
+      if (info->cell->is_expanded != is_expanded)
+       g_object_set (cell, "is-expanded", is_expanded, NULL);
 
       while (list && list->next)
        {
@@ -2316,12 +2608,12 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
  * primarily by the #GtkTreeView.
  **/
 void
-gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
-                                   GdkRectangle      *cell_area,
-                                   gint              *x_offset,
-                                   gint              *y_offset,
-                                   gint              *width,
-                                   gint              *height)
+gtk_tree_view_column_cell_get_size (GtkTreeViewColumn  *tree_column,
+                                   const GdkRectangle *cell_area,
+                                   gint               *x_offset,
+                                   gint               *y_offset,
+                                   gint               *width,
+                                   gint               *height)
 {
   GList *list;
   gboolean first_cell = TRUE;
@@ -2347,7 +2639,7 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
       if (visible == FALSE)
        continue;
 
-      if (first_cell == FALSE && *width)
+      if (first_cell == FALSE && width)
        *width += tree_column->spacing;
 
       gtk_cell_renderer_get_size (info->cell,
@@ -2367,9 +2659,12 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
     }
 }
 
-/* both rendering and rendering focus are somewhat complicated, and a bit of
- * code.  Rather than duplicate them, we put them together to keep the code in
- * one place
+/* rendering, event handling and rendering focus are somewhat complicated, and
+ * quite a bit of code.  Rather than duplicate them, we put them together to
+ * keep the code in one place.
+ *
+ * To better understand what's going on, check out
+ * docs/tree-column-sizing.png
  */
 enum {
   CELL_ACTION_RENDER,
@@ -2380,11 +2675,11 @@ enum {
 static gboolean
 gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                                          GdkWindow          *window,
-                                         GdkRectangle       *background_area,
-                                         GdkRectangle       *cell_area,
+                                         const GdkRectangle *background_area,
+                                         const GdkRectangle *cell_area,
                                          guint               flags,
                                          gint                action,
-                                         GdkRectangle       *expose_area,     /* RENDER */
+                                         const GdkRectangle *expose_area,     /* RENDER */
                                          GdkRectangle       *focus_rectangle, /* FOCUS  */
                                          GtkCellEditable   **editable_widget, /* EVENT  */
                                          GdkEvent           *event,           /* EVENT  */
@@ -2393,19 +2688,28 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
   GList *list;
   GdkRectangle real_cell_area;
   GdkRectangle real_background_area;
+  GdkRectangle real_expose_area = *cell_area;
+  gint depth = 0;
   gint expand_cell_count = 0;
   gint full_requested_width = 0;
   gint extra_space;
   gint min_x, min_y, max_x, max_y;
   gint focus_line_width;
-  gint dx;
   gint special_cells;
+  gint horizontal_separator;
+  gboolean cursor_row = FALSE;
+  gboolean first_cell = TRUE;
+  gboolean rtl;
+  /* If we have rtl text, we need to transform our areas */
+  GdkRectangle rtl_cell_area;
+  GdkRectangle rtl_background_area;
 
   min_x = G_MAXINT;
   min_y = G_MAXINT;
   max_x = 0;
   max_y = 0;
 
+  rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_column->tree_view)) == GTK_TEXT_DIR_RTL);
   special_cells = _gtk_tree_view_column_count_special_cells (tree_column);
 
   if (special_cells > 1 && action == CELL_ACTION_FOCUS)
@@ -2432,17 +2736,27 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
        }
     }
 
+  cursor_row = flags & GTK_CELL_RENDERER_FOCUSED;
+
   gtk_widget_style_get (GTK_WIDGET (tree_column->tree_view),
                        "focus-line-width", &focus_line_width,
+                       "horizontal-separator", &horizontal_separator,
                        NULL);
 
   real_cell_area = *cell_area;
   real_background_area = *background_area;
-  dx = real_cell_area.x - real_background_area.x - focus_line_width;
+
 
   real_cell_area.x += focus_line_width;
+  real_cell_area.y += focus_line_width;
+  real_cell_area.height -= 2 * focus_line_width;
 
-  /* Find out how many extra space we have to allocate */
+  if (rtl)
+    depth = real_background_area.width - real_cell_area.width;
+  else
+    depth = real_cell_area.x - real_background_area.x;
+
+  /* Find out how much extra space we have to allocate */
   for (list = tree_column->cell_list; list; list = list->next)
     {
       GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *)list->data;
@@ -2453,9 +2767,14 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
       if (info->expand == TRUE)
        expand_cell_count ++;
       full_requested_width += info->requested_width;
+
+      if (!first_cell)
+       full_requested_width += tree_column->spacing;
+
+      first_cell = FALSE;
     }
 
-  extra_space = background_area->width - full_requested_width;
+  extra_space = cell_area->width - full_requested_width;
   if (extra_space < 0)
     extra_space = 0;
   else if (extra_space > 0 && expand_cell_count > 0)
@@ -2472,30 +2791,63 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
       if (! info->cell->visible)
        continue;
 
-      real_background_area.width = info->requested_width +
-       (info->expand?extra_space:0);
-      info->real_width = real_background_area.width;
+      if ((info->has_focus || special_cells == 1) && cursor_row)
+       flags |= GTK_CELL_RENDERER_FOCUSED;
+      else
+        flags &= ~GTK_CELL_RENDERER_FOCUSED;
+
+      info->real_width = info->requested_width + (info->expand?extra_space:0);
 
-      real_cell_area.width = real_background_area.width;
+      /* We constrain ourselves to only the width available */
+      if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width)
+       {
+         info->real_width = cell_area->x + cell_area->width - real_cell_area.x;
+       }   
+
+      if (real_cell_area.x > cell_area->x + cell_area->width)
+       break;
+
+      real_cell_area.width = info->real_width;
       real_cell_area.width -= 2 * focus_line_width;
 
+      if (list->next)
+       {
+         real_background_area.width = info->real_width + depth;
+       }
+      else
+       {
+          /* fill the rest of background for the last cell */
+         real_background_area.width = background_area->x + background_area->width - real_background_area.x;
+       }
+
+      rtl_cell_area = real_cell_area;
+      rtl_background_area = real_background_area;
+      
+      if (rtl)
+       {
+         rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width;
+         rtl_background_area.x = background_area->x + background_area->width - (real_background_area.x - background_area->x) - real_background_area.width;
+       }
+
+      /* RENDER */
       if (action == CELL_ACTION_RENDER)
        {
          gtk_cell_renderer_render (info->cell,
                                    window,
                                    tree_column->tree_view,
-                                   &real_background_area,
-                                   &real_cell_area,
-                                   expose_area,
+                                   &rtl_background_area,
+                                   &rtl_cell_area,
+                                   &real_expose_area, 
                                    flags);
        }
+      /* FOCUS */
       else if (action == CELL_ACTION_FOCUS)
        {
          gint x_offset, y_offset, width, height;
 
          gtk_cell_renderer_get_size (info->cell,
                                      tree_column->tree_view,
-                                     &real_cell_area,
+                                     &rtl_cell_area,
                                      &x_offset, &y_offset,
                                      &width, &height);
 
@@ -2503,24 +2855,25 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
            {
              if (info->has_focus)
                {
-                 min_x = real_cell_area.x + x_offset;
+                 min_x = rtl_cell_area.x + x_offset;
                  max_x = min_x + width;
-                 min_y = real_cell_area.y + y_offset;
+                 min_y = rtl_cell_area.y + y_offset;
                  max_y = min_y + height;
                }
            }
          else
            {
-             if (min_x > (real_cell_area.x + x_offset))
-               min_x = real_cell_area.x + x_offset;
-             if (max_x < real_cell_area.x + x_offset + width)
-               max_x = real_cell_area.x + x_offset + width;
-             if (min_y > (real_cell_area.y + y_offset))
-               min_y = real_cell_area.y + y_offset;
-             if (max_y < real_cell_area.y + y_offset + height)
-               max_y = real_cell_area.y + y_offset + height;
+             if (min_x > (rtl_cell_area.x + x_offset))
+               min_x = rtl_cell_area.x + x_offset;
+             if (max_x < rtl_cell_area.x + x_offset + width)
+               max_x = rtl_cell_area.x + x_offset + width;
+             if (min_y > (rtl_cell_area.y + y_offset))
+               min_y = rtl_cell_area.y + y_offset;
+             if (max_y < rtl_cell_area.y + y_offset + height)
+               max_y = rtl_cell_area.y + y_offset + height;
            }
        }
+      /* EVENT */
       else if (action == CELL_ACTION_EVENT)
        {
          gboolean try_event = FALSE;
@@ -2534,8 +2887,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                      cell_area->x + cell_area->width > ((GdkEventButton *)event)->x)
                    try_event = TRUE;
                }
-             else if (real_cell_area.x <= ((GdkEventButton *)event)->x &&
-                 real_cell_area.x + real_cell_area.width > ((GdkEventButton *)event)->x)
+             else if (rtl_cell_area.x <= ((GdkEventButton *)event)->x &&
+                 rtl_cell_area.x + rtl_cell_area.width > ((GdkEventButton *)event)->x)
                  /* only activate cell if the user clicked on an individual
                   * cell
                   */
@@ -2550,7 +2903,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
            {
              gboolean visible, mode;
 
-             g_object_get (G_OBJECT (info->cell),
+             g_object_get (info->cell,
                            "visible", &visible,
                            "mode", &mode,
                            NULL);
@@ -2560,10 +2913,13 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                                                  event,
                                                  tree_column->tree_view,
                                                  path_string,
-                                                 background_area,
-                                                 cell_area,
+                                                 &rtl_background_area,
+                                                 &rtl_cell_area,
                                                  flags))
-                   return TRUE;
+                   {
+                      flags &= ~GTK_CELL_RENDERER_FOCUSED;
+                     return TRUE;
+                   }
                }
              else if (visible && mode == GTK_CELL_RENDERER_MODE_EDITABLE)
                {
@@ -2572,8 +2928,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                                                     event,
                                                     tree_column->tree_view,
                                                     path_string,
-                                                    background_area,
-                                                    cell_area,
+                                                    &rtl_background_area,
+                                                    &rtl_cell_area,
                                                     flags);
 
                  if (*editable_widget != NULL)
@@ -2582,14 +2938,21 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                      info->in_editing_mode = TRUE;
                      gtk_tree_view_column_focus_cell (tree_column, info->cell);
                      
+                      flags &= ~GTK_CELL_RENDERER_FOCUSED;
+
                      return TRUE;
                    }
                }
            }
        }
 
-      real_cell_area.x += (info->real_width + tree_column->spacing);
-      real_background_area.x += (info->real_width + tree_column->spacing);
+      flags &= ~GTK_CELL_RENDERER_FOCUSED;
+
+      real_cell_area.x += (real_cell_area.width + 2 * focus_line_width + tree_column->spacing);
+      real_background_area.x += real_background_area.width + tree_column->spacing;
+
+      /* Only needed for first cell */
+      depth = 0;
     }
 
   /* iterate list for PACK_END cells */
@@ -2603,30 +2966,53 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
       if (! info->cell->visible)
        continue;
 
-      real_background_area.width = info->requested_width +
-       (info->expand?extra_space:0);
-      info->real_width = real_background_area.width;
+      if ((info->has_focus || special_cells == 1) && cursor_row)
+       flags |= GTK_CELL_RENDERER_FOCUSED;
+      else
+        flags &= ~GTK_CELL_RENDERER_FOCUSED;
 
-      real_cell_area.width = real_background_area.width;
+      info->real_width = info->requested_width + (info->expand?extra_space:0);
+
+      /* We constrain ourselves to only the width available */
+      if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width)
+       {
+         info->real_width = cell_area->x + cell_area->width - real_cell_area.x;
+       }   
+
+      if (real_cell_area.x > cell_area->x + cell_area->width)
+       break;
+
+      real_cell_area.width = info->real_width;
       real_cell_area.width -= 2 * focus_line_width;
+      real_background_area.width = info->real_width + depth;
 
+      rtl_cell_area = real_cell_area;
+      rtl_background_area = real_background_area;
+      if (rtl)
+       {
+         rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width;
+         rtl_background_area.x = background_area->x + background_area->width - (real_background_area.x - background_area->x) - real_background_area.width;
+       }
+
+      /* RENDER */
       if (action == CELL_ACTION_RENDER)
        {
          gtk_cell_renderer_render (info->cell,
                                    window,
                                    tree_column->tree_view,
-                                   &real_background_area,
-                                   &real_cell_area,
-                                   expose_area,
+                                   &rtl_background_area,
+                                   &rtl_cell_area,
+                                   &real_expose_area,
                                    flags);
        }
+      /* FOCUS */
       else if (action == CELL_ACTION_FOCUS)
        {
          gint x_offset, y_offset, width, height;
 
          gtk_cell_renderer_get_size (info->cell,
                                      tree_column->tree_view,
-                                     &real_cell_area,
+                                     &rtl_cell_area,
                                      &x_offset, &y_offset,
                                      &width, &height);
 
@@ -2634,24 +3020,25 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
            {
              if (info->has_focus)
                {
-                 min_x = real_cell_area.x + x_offset;
+                 min_x = rtl_cell_area.x + x_offset;
                  max_x = min_x + width;
-                 min_y = real_cell_area.y + y_offset;
+                 min_y = rtl_cell_area.y + y_offset;
                  max_y = min_y + height;
                }
            }
          else
            {
-             if (min_x > (real_cell_area.x + x_offset))
-               min_x = real_cell_area.x + x_offset;
-             if (max_x < real_cell_area.x + x_offset + width)
-               max_x = real_cell_area.x + x_offset + width;
-             if (min_y > (real_cell_area.y + y_offset))
-               min_y = real_cell_area.y + y_offset;
-             if (max_y < real_cell_area.y + y_offset + height)
-               max_y = real_cell_area.y + y_offset + height;
+             if (min_x > (rtl_cell_area.x + x_offset))
+               min_x = rtl_cell_area.x + x_offset;
+             if (max_x < rtl_cell_area.x + x_offset + width)
+               max_x = rtl_cell_area.x + x_offset + width;
+             if (min_y > (rtl_cell_area.y + y_offset))
+               min_y = rtl_cell_area.y + y_offset;
+             if (max_y < rtl_cell_area.y + y_offset + height)
+               max_y = rtl_cell_area.y + y_offset + height;
            }
        }
+      /* EVENT */
       else if (action == CELL_ACTION_EVENT)
         {
          gboolean try_event = FALSE;
@@ -2665,8 +3052,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                      cell_area->x + cell_area->width > ((GdkEventButton *)event)->x)
                    try_event = TRUE;
                }
-             else if (real_cell_area.x <= ((GdkEventButton *)event)->x &&
-                 real_cell_area.x + real_cell_area.width > ((GdkEventButton *)event)->x)
+             else if (rtl_cell_area.x <= ((GdkEventButton *)event)->x &&
+                 rtl_cell_area.x + rtl_cell_area.width > ((GdkEventButton *)event)->x)
                /* only activate cell if the user clicked on an individual
                 * cell
                 */
@@ -2681,7 +3068,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
            {
              gboolean visible, mode;
 
-             g_object_get (G_OBJECT (info->cell),
+             g_object_get (info->cell,
                            "visible", &visible,
                            "mode", &mode,
                            NULL);
@@ -2691,10 +3078,13 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                                                  event,
                                                  tree_column->tree_view,
                                                  path_string,
-                                                 background_area,
-                                                 cell_area,
+                                                 &rtl_background_area,
+                                                 &rtl_cell_area,
                                                  flags))
-                   return TRUE;
+                   {
+                     flags &= ~GTK_CELL_RENDERER_FOCUSED;
+                     return TRUE;
+                   }
                }
              else if (visible && mode == GTK_CELL_RENDERER_MODE_EDITABLE)
                {
@@ -2703,8 +3093,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                                                     event,
                                                     tree_column->tree_view,
                                                     path_string,
-                                                    background_area,
-                                                    cell_area,
+                                                    &rtl_background_area,
+                                                    &rtl_cell_area,
                                                     flags);
 
                  if (*editable_widget != NULL)
@@ -2713,14 +3103,20 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
                      info->in_editing_mode = TRUE;
                      gtk_tree_view_column_focus_cell (tree_column, info->cell);
 
+                     flags &= ~GTK_CELL_RENDERER_FOCUSED;
                      return TRUE;
                    }
                }
            }
        }
 
-      real_cell_area.x += (info->real_width + tree_column->spacing);
-      real_background_area.x += (info->real_width + tree_column->spacing);
+      flags &= ~GTK_CELL_RENDERER_FOCUSED;
+
+      real_cell_area.x += (real_cell_area.width + 2 * focus_line_width + tree_column->spacing);
+      real_background_area.x += (real_background_area.width + tree_column->spacing);
+
+      /* Only needed for first cell */
+      depth = 0;
     }
 
   /* fill focus_rectangle when required */
@@ -2757,12 +3153,12 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn  *tree_column,
  * #GtkTreeView.
  **/
 void
-_gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
-                                  GdkWindow         *window,
-                                  GdkRectangle      *background_area,
-                                  GdkRectangle      *cell_area,
-                                  GdkRectangle      *expose_area,
-                                  guint              flags)
+_gtk_tree_view_column_cell_render (GtkTreeViewColumn  *tree_column,
+                                  GdkWindow          *window,
+                                  const GdkRectangle *background_area,
+                                  const GdkRectangle *cell_area,
+                                  const GdkRectangle *expose_area,
+                                  guint               flags)
 {
   g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
   g_return_if_fail (background_area != NULL);
@@ -2784,8 +3180,8 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn  *tree_column,
                                  GtkCellEditable   **editable_widget,
                                  GdkEvent           *event,
                                  gchar              *path_string,
-                                 GdkRectangle       *background_area,
-                                 GdkRectangle       *cell_area,
+                                 const GdkRectangle *background_area,
+                                 const GdkRectangle *cell_area,
                                  guint               flags)
 {
   g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
@@ -2802,6 +3198,24 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn  *tree_column,
                                                   path_string);
 }
 
+void
+_gtk_tree_view_column_get_focus_area (GtkTreeViewColumn  *tree_column,
+                                     const GdkRectangle *background_area,
+                                     const GdkRectangle *cell_area,
+                                     GdkRectangle       *focus_area)
+{
+  gtk_tree_view_column_cell_process_action (tree_column,
+                                           NULL,
+                                           background_area,
+                                           cell_area,
+                                           0,
+                                           CELL_ACTION_FOCUS,
+                                           NULL,
+                                           focus_area,
+                                           NULL, NULL, NULL);
+}
+
+
 /* cell list manipulation */
 static GList *
 gtk_tree_view_column_cell_first (GtkTreeViewColumn *tree_column)
@@ -2934,8 +3348,10 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
                                  gboolean           right)
 {
   gint count;
+  gboolean rtl;
 
   count = _gtk_tree_view_column_count_special_cells (tree_column);
+  rtl = gtk_widget_get_direction (GTK_WIDGET (tree_column->tree_view)) == GTK_TEXT_DIR_RTL;
 
   /* if we are the current focus column and have multiple editable cells,
    * try to select the next one, else move the focus to the next column
@@ -2960,8 +3376,16 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
          if (!list || !info || !info->has_focus)
            return FALSE;
 
-         next = gtk_tree_view_column_cell_next (tree_column, list);
-         prev = gtk_tree_view_column_cell_prev (tree_column, list);
+         if (rtl)
+           {
+             prev = gtk_tree_view_column_cell_next (tree_column, list);
+             next = gtk_tree_view_column_cell_prev (tree_column, list);
+           }
+         else
+           {
+             next = gtk_tree_view_column_cell_next (tree_column, list);
+             prev = gtk_tree_view_column_cell_prev (tree_column, list);
+           }
 
          info->has_focus = FALSE;
          if (direction > 0 && next)
@@ -2972,8 +3396,12 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
            }
          else if (direction > 0 && !next && !right)
            {
-             /* keep focus on latest cell */
-             info = gtk_tree_view_column_cell_last (tree_column)->data;
+             /* keep focus on last cell */
+             if (rtl)
+               info = gtk_tree_view_column_cell_first (tree_column)->data;
+             else
+               info = gtk_tree_view_column_cell_last (tree_column)->data;
+
              info->has_focus = TRUE;
              return TRUE;
            }
@@ -2986,7 +3414,11 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
          else if (direction < 0 && !prev && !left)
            {
              /* keep focus on first cell */
-             info = gtk_tree_view_column_cell_first (tree_column)->data;
+             if (rtl)
+               info = gtk_tree_view_column_cell_last (tree_column)->data;
+             else
+               info = gtk_tree_view_column_cell_first (tree_column)->data;
+
              info->has_focus = TRUE;
              return TRUE;
            }
@@ -3009,21 +3441,36 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
            info->has_focus = FALSE;
        }
 
-      if (direction > 0)
-       ((GtkTreeViewColumnCellInfo *)gtk_tree_view_column_cell_first (tree_column)->data)->has_focus = TRUE;
-      else if (direction < 0)
-       ((GtkTreeViewColumnCellInfo *)gtk_tree_view_column_cell_last (tree_column)->data)->has_focus = TRUE;
+      list = NULL;
+      if (rtl)
+        {
+         if (direction > 0)
+           list = gtk_tree_view_column_cell_last (tree_column);
+         else if (direction < 0)
+           list = gtk_tree_view_column_cell_first (tree_column);
+       }
+      else
+        {
+         if (direction > 0)
+           list = gtk_tree_view_column_cell_first (tree_column);
+         else if (direction < 0)
+           list = gtk_tree_view_column_cell_last (tree_column);
+       }
+
+      if (list)
+       ((GtkTreeViewColumnCellInfo *) list->data)->has_focus = TRUE;
     }
+
   return TRUE;
 }
 
 void
-_gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn       *tree_column,
-                                      GdkWindow               *window,
-                                      GdkRectangle            *background_area,
-                                      GdkRectangle            *cell_area,
-                                      GdkRectangle            *expose_area,
-                                      guint                    flags)
+_gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn  *tree_column,
+                                      GdkWindow          *window,
+                                      const GdkRectangle *background_area,
+                                      const GdkRectangle *cell_area,
+                                      const GdkRectangle *expose_area,
+                                      guint               flags)
 {
   gint focus_line_width;
   GtkStateType cell_state;
@@ -3067,7 +3514,7 @@ _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn       *tree_column,
       gtk_paint_focus (tree_column->tree_view->style,
                       window,
                       cell_state,
-                      NULL,
+                      cell_area,
                       tree_column->tree_view,
                       "treeview",
                       focus_rectangle.x,
@@ -3081,11 +3528,11 @@ _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn       *tree_column,
  * gtk_tree_view_column_cell_is_visible:
  * @tree_column: A #GtkTreeViewColumn
  * 
- * Returns #TRUE if any of the cells packed into the @tree_column are visible.
+ * Returns %TRUE if any of the cells packed into the @tree_column are visible.
  * For this to be meaningful, you must first initialize the cells with
  * gtk_tree_view_column_cell_set_cell_data()
  * 
- * Return value: #TRUE, if any of the cells packed into the @tree_column are currently visible
+ * Return value: %TRUE, if any of the cells packed into the @tree_column are currently visible
  **/
 gboolean
 gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column)
@@ -3107,11 +3554,13 @@ gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column)
 
 /**
  * gtk_tree_view_column_focus_cell:
- * @tree_view: A #GtkTreeView
+ * @tree_column: A #GtkTreeViewColumn
  * @cell: A #GtkCellRenderer
  *
  * Sets the current keyboard focus to be at @cell, if the column contains
  * 2 or more editable and activatable cells.
+ *
+ * Since: 2.2
  **/
 void
 gtk_tree_view_column_focus_cell (GtkTreeViewColumn *tree_column,
@@ -3165,7 +3614,6 @@ _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
       info->requested_width = 0;
     }
   tree_column->dirty = TRUE;
-  tree_column->resized_width = MAX (tree_column->requested_width, tree_column->button_request);
   tree_column->requested_width = -1;
   tree_column->width = 0;
 
@@ -3208,52 +3656,133 @@ _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
                                          gint              *right)
 {
   GList *list;
+  GtkTreeViewColumnCellInfo *info;
+  gint l, r;
+  gboolean rtl;
 
-  if (left)
-    {
-      *left = 0;
-      list = gtk_tree_view_column_cell_first (column);
+  l = r = 0;
 
-      for (; list; list = gtk_tree_view_column_cell_next (column, list))
-        {
-         GtkTreeViewColumnCellInfo *info =
-           (GtkTreeViewColumnCellInfo *)list->data;
+  list = gtk_tree_view_column_cell_first (column);  
 
-         if (info->cell == cell)
-           break;
+  while (list)
+    {
+      info = (GtkTreeViewColumnCellInfo *)list->data;
+      
+      list = gtk_tree_view_column_cell_next (column, list);
 
-         *left += info->real_width;
-       }
+      if (info->cell == cell)
+       break;
+      
+      if (info->cell->visible)
+       l += info->real_width + column->spacing;
     }
 
-  if (right)
+  while (list)
     {
-      GList *next;
+      info = (GtkTreeViewColumnCellInfo *)list->data;
+      
+      list = gtk_tree_view_column_cell_next (column, list);
 
-      *right = 0;
-      list = gtk_tree_view_column_cell_first (column);
+      if (info->cell->visible)
+       r += info->real_width + column->spacing;
+    }
 
-      for (; list; list = gtk_tree_view_column_cell_next (column, list))
-        {
-         GtkTreeViewColumnCellInfo *info =
-           (GtkTreeViewColumnCellInfo *)list->data;
+  rtl = (gtk_widget_get_direction (GTK_WIDGET (column->tree_view)) == GTK_TEXT_DIR_RTL);
+  if (left)
+    *left = rtl ? r : l;
 
-         if (info->cell == cell)
-           break;
-       }
+  if (right)
+    *right = rtl ? l : r;
+}
 
-      /* skip cell */
-      next = gtk_tree_view_column_cell_next (column, list);
-      if (list && next)
+/**
+ * gtk_tree_view_column_cell_get_position:
+ * @tree_column: a #GtkTreeViewColumn
+ * @cell_renderer: a #GtkCellRenderer
+ * @start_pos: return location for the horizontal position of @cell within
+ *            @tree_column, may be %NULL
+ * @width: return location for the width of @cell, may be %NULL
+ *
+ * Obtains the horizontal position and size of a cell in a column. If the
+ * cell is not found in the column, @start_pos and @width are not changed and
+ * %FALSE is returned.
+ * 
+ * Return value: %TRUE if @cell belongs to @tree_column.
+ */
+gboolean
+gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column,
+                                       GtkCellRenderer   *cell_renderer,
+                                       gint              *start_pos,
+                                       gint              *width)
+{
+  GList *list;
+  gint current_x = 0;
+  gboolean found_cell = FALSE;
+  GtkTreeViewColumnCellInfo *cellinfo = NULL;
+
+  list = gtk_tree_view_column_cell_first (tree_column);
+  for (; list; list = gtk_tree_view_column_cell_next (tree_column, list))
+    {
+      cellinfo = list->data;
+      if (cellinfo->cell == cell_renderer)
         {
-         list = next;
-         for ( ; list; list = gtk_tree_view_column_cell_next (column, list))
-           {
-             GtkTreeViewColumnCellInfo *info =
-               (GtkTreeViewColumnCellInfo *)list->data;
+          found_cell = TRUE;
+          break;
+        }
 
-             *right += info->real_width;
-           }
-       }
+      if (cellinfo->cell->visible)
+        current_x += cellinfo->real_width;
+    }
+
+  if (found_cell)
+    {
+      if (start_pos)
+        *start_pos = current_x;
+      if (width)
+        *width = cellinfo->real_width;
     }
+
+  return found_cell;
 }
+
+/**
+ * gtk_tree_view_column_queue_resize:
+ * @tree_column: A #GtkTreeViewColumn
+ *
+ * Flags the column, and the cell renderers added to this column, to have
+ * their sizes renegotiated.
+ *
+ * Since: 2.8
+ **/
+void
+gtk_tree_view_column_queue_resize (GtkTreeViewColumn *tree_column)
+{
+  g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+
+  if (tree_column->tree_view)
+    _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
+}
+
+/**
+ * gtk_tree_view_column_get_tree_view:
+ * @tree_column: A #GtkTreeViewColumn
+ *
+ * Returns the #GtkTreeView wherein @tree_column has been inserted.  If
+ * @column is currently not inserted in any tree view, %NULL is
+ * returned.
+ *
+ * Return value: The tree view wherein @column has been inserted if any,
+ *               %NULL otherwise.
+ *
+ * Since: 2.12
+ */
+GtkWidget *
+gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column)
+{
+  g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
+
+  return tree_column->tree_view;
+}
+
+#define __GTK_TREE_VIEW_COLUMN_C__
+#include "gtkaliasdef.c"