PsppSheetViewColumn: Replace GtkAlignment with a GtkBin
[pspp] / src / ui / gui / pspp-sheet-view-column.c
index ad214ee522b19cd1fd0832672849cebb381b65a1..4acd3f03b4bd8620f09b87f8f6c810c39e13ce70 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012, 2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -145,7 +145,7 @@ void pspp_sheet_view_column_update_button                 (PsppSheetViewColumn
 
 /* Button signal handlers */
 static gint pspp_sheet_view_column_button_event                  (GtkWidget               *widget,
-                                                               GdkEvent                *event,
+                                                               GdkEventButton             *event,
                                                                gpointer                 data);
 static void pspp_sheet_view_column_button_clicked                (GtkWidget               *widget,
                                                                gpointer                 data);
@@ -186,7 +186,7 @@ static void pspp_sheet_view_column_buildable_init                 (GtkBuildableI
 
 static guint tree_column_signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE_WITH_CODE (PsppSheetViewColumn, pspp_sheet_view_column, GTK_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (PsppSheetViewColumn, pspp_sheet_view_column, G_TYPE_OBJECT,
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
                                                pspp_sheet_view_column_cell_layout_init)
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
@@ -437,12 +437,34 @@ pspp_sheet_view_column_class_init (PsppSheetViewColumnClass *class)
                                                          GTK_PARAM_READWRITE));
 }
 
+
+static void _cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
+                                                  GtkBuilder   *builder,
+                                                  GObject      *child,
+                                                  const gchar  *tagname,
+                                                  gpointer     *data);
+
+
+static void _cell_layout_buildable_add_child (GtkBuildable      *buildable,
+                                                 GtkBuilder        *builder,
+                                                 GObject           *child,
+                                                 const gchar       *type);
+
+
+static gboolean _cell_layout_buildable_custom_tag_start (GtkBuildable  *buildable,
+                                             GtkBuilder    *builder,
+                                             GObject       *child,
+                                             const gchar   *tagname,
+                                             GMarkupParser *parser,
+                                        gpointer      *data);
+
+
 static void
 pspp_sheet_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;
+  iface->add_child = _cell_layout_buildable_add_child;
+  iface->custom_tag_start = _cell_layout_buildable_custom_tag_start;
+  iface->custom_tag_end = _cell_layout_buildable_custom_tag_end;
 }
 
 static void
@@ -462,7 +484,7 @@ static void
 pspp_sheet_view_column_init (PsppSheetViewColumn *tree_column)
 {
   tree_column->button = NULL;
-  tree_column->xalign = 0.0;
+  tree_column->halign = GTK_ALIGN_START;
   tree_column->width = 0;
   tree_column->spacing = 0;
   tree_column->requested_width = -1;
@@ -490,7 +512,6 @@ pspp_sheet_view_column_init (PsppSheetViewColumn *tree_column)
   tree_column->use_resized_width = FALSE;
   tree_column->title = g_strdup ("");
   tree_column->quick_edit = TRUE;
-  tree_column->need_button = FALSE;
 }
 
 static void
@@ -999,10 +1020,8 @@ pspp_sheet_view_column_create_button (PsppSheetViewColumn *tree_column)
   g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view));
   g_return_if_fail (tree_column->button == NULL);
 
-  gtk_widget_push_composite_child ();
   tree_column->button = gtk_button_new ();
   gtk_widget_add_events (tree_column->button, GDK_POINTER_MOTION_MASK);
-  gtk_widget_pop_composite_child ();
 
   /* make sure we own a reference to it as well. */
   if (tree_view->priv->header_window)
@@ -1025,10 +1044,10 @@ pspp_sheet_view_column_create_button (PsppSheetViewColumn *tree_column)
                     G_CALLBACK (on_query_tooltip), tree_column);
   g_object_set (tree_column->button, "has-tooltip", TRUE, NULL);
 
-  tree_column->alignment = gtk_alignment_new (tree_column->xalign, 0.5, 0.0, 0.0);
+  tree_column->bin = gtk_event_box_new ();
+  g_object_set (tree_column->bin, "halign", GTK_ALIGN_CENTER, NULL);
 
-  hbox = gtk_hbox_new (FALSE, 2);
-  tree_column->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
 
   if (tree_column->child)
     child = tree_column->child;
@@ -1042,18 +1061,14 @@ pspp_sheet_view_column_create_button (PsppSheetViewColumn *tree_column)
                    G_CALLBACK (pspp_sheet_view_column_mnemonic_activate),
                    tree_column);
 
-  if (tree_column->xalign <= 0.5)
-    gtk_box_pack_end (GTK_BOX (hbox), tree_column->arrow, FALSE, FALSE, 0);
-  else
-    gtk_box_pack_start (GTK_BOX (hbox), tree_column->arrow, FALSE, FALSE, 0);
 
-  gtk_box_pack_start (GTK_BOX (hbox), tree_column->alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), tree_column->bin, TRUE, TRUE, 0);
         
-  gtk_container_add (GTK_CONTAINER (tree_column->alignment), child);
+  gtk_container_add (GTK_CONTAINER (tree_column->bin), child);
   gtk_container_add (GTK_CONTAINER (tree_column->button), hbox);
 
   gtk_widget_show (hbox);
-  gtk_widget_show (tree_column->alignment);
+  gtk_widget_show (tree_column->bin);
   pspp_sheet_view_column_update_button (tree_column);
 }
 
@@ -1061,11 +1076,8 @@ void
 pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
 {
   gint sort_column_id = -1;
-  GtkWidget *hbox;
   GtkWidget *alignment;
-  GtkWidget *arrow;
   GtkWidget *current_child;
-  GtkArrowType arrow_type = GTK_ARROW_NONE;
   GtkTreeModel *model;
   gboolean can_focus;
 
@@ -1075,8 +1087,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
     model = NULL;
 
   /* Create a button if necessary */
-  if (tree_column->need_button &&
-      tree_column->visible &&
+  if (tree_column->visible &&
       tree_column->button == NULL &&
       tree_column->tree_view &&
       gtk_widget_get_realized (tree_column->tree_view))
@@ -1085,14 +1096,13 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
   if (! tree_column->button)
     return;
 
-  hbox = GTK_BIN (tree_column->button)->child;
-  alignment = tree_column->alignment;
-  arrow = tree_column->arrow;
-  current_child = GTK_BIN (alignment)->child;
+  alignment = tree_column->bin;
+  current_child = gtk_bin_get_child (GTK_BIN (alignment));
 
   /* Set up the actual button */
-  gtk_alignment_set (GTK_ALIGNMENT (alignment), tree_column->xalign,
-                    0.5, 0.0, 0.0);
+  g_object_set (alignment,
+               "halign", tree_column->halign,
+               "valign", GTK_ALIGN_CENTER, NULL);
       
   if (tree_column->child)
     {
@@ -1129,58 +1139,6 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
                                          &sort_column_id,
                                          NULL);
 
-  if (tree_column->show_sort_indicator)
-    {
-      gboolean alternative;
-
-      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
-   */
-  g_object_ref (arrow);
-  gtk_container_remove (GTK_CONTAINER (hbox), arrow);
-
-  if (tree_column->xalign <= 0.5)
-    {
-      gtk_box_pack_end (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
-    }
-  else
-    {
-      gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
-      /* move it to the front */
-      gtk_box_reorder_child (GTK_BOX (hbox), arrow, 0);
-    }
-  g_object_unref (arrow);
-
-  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);
 
   /* It's always safe to hide the button.  It isn't always safe to show it, as
    * if you show it before it's realized, it'll get the wrong window. */
@@ -1190,7 +1148,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
     {
       if (tree_column->visible)
        {
-         gtk_widget_show_now (tree_column->button);
+         gtk_widget_show (tree_column->button);
          if (tree_column->window)
            {
              if (tree_column->resizable)
@@ -1236,7 +1194,7 @@ pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column)
 
 static gint
 pspp_sheet_view_column_button_event (GtkWidget *widget,
-                                  GdkEvent  *event,
+                                  GdkEventButton  *event,
                                   gpointer   data)
 {
   PsppSheetViewColumn *column = (PsppSheetViewColumn *) data;
@@ -1248,7 +1206,8 @@ pspp_sheet_view_column_button_event (GtkWidget *widget,
       ((GdkEventButton *)event)->button == 1)
     {
       column->maybe_reordered = TRUE;
-      gdk_window_get_pointer (GTK_BUTTON (widget)->event_window,
+      gdk_window_get_device_position (gtk_button_get_event_window (GTK_BUTTON (widget)),
+                                     event->device,
                              &column->drag_x,
                              &column->drag_y,
                              NULL);
@@ -1552,6 +1511,7 @@ pspp_sheet_view_column_setup_sort_column_id_callback (PsppSheetViewColumn *tree_
 void
 _pspp_sheet_view_column_realize_button (PsppSheetViewColumn *column)
 {
+  GtkAllocation allocation;
   PsppSheetView *tree_view;
   GdkWindowAttr attr;
   guint attributes_mask;
@@ -1563,7 +1523,7 @@ _pspp_sheet_view_column_realize_button (PsppSheetViewColumn *column)
   g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view));
   g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (tree_view)));
   g_return_if_fail (tree_view->priv->header_window != NULL);
-  if (!column->need_button || !column->button)
+  if (!column->button)
     return;
 
   g_return_if_fail (column->button != NULL);
@@ -1576,7 +1536,6 @@ _pspp_sheet_view_column_realize_button (PsppSheetViewColumn *column)
   attr.window_type = GDK_WINDOW_CHILD;
   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)) |
                     (GDK_BUTTON_PRESS_MASK |
                     GDK_BUTTON_RELEASE_MASK |
@@ -1589,15 +1548,15 @@ _pspp_sheet_view_column_realize_button (PsppSheetViewColumn *column)
   attr.y = 0;
   attr.width = TREE_VIEW_DRAG_WIDTH;
   attr.height = tree_view->priv->header_height;
-
-  attr.x = (column->button->allocation.x + (rtl ? 0 : column->button->allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
+  gtk_widget_get_allocation (column->button, &allocation);
+  attr.x = (allocation.x + (rtl ? 0 : 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);
 
   pspp_sheet_view_column_update_button (column);
 
-  gdk_cursor_unref (attr.cursor);
+  g_object_unref (attr.cursor);
 }
 
 void
@@ -1632,8 +1591,7 @@ _pspp_sheet_view_column_set_tree_view (PsppSheetViewColumn *column,
   g_assert (column->tree_view == NULL);
 
   column->tree_view = GTK_WIDGET (tree_view);
-  if (column->need_button)
-    pspp_sheet_view_column_create_button (column);
+  pspp_sheet_view_column_create_button (column);
 
   column->property_changed_signal =
          g_signal_connect_swapped (tree_view,
@@ -1674,9 +1632,12 @@ _pspp_sheet_view_column_has_editable_cell (PsppSheetViewColumn *column)
   GList *list;
 
   for (list = column->cell_list; list; list = list->next)
-    if (((PsppSheetViewColumnCellInfo *)list->data)->cell->mode ==
-       GTK_CELL_RENDERER_MODE_EDITABLE)
-      return TRUE;
+    {
+      GtkCellRendererMode mode;
+      g_object_get (((PsppSheetViewColumnCellInfo *)list->data)->cell, "mode", &mode, NULL);
+      if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
+       return TRUE;
+    }
 
   return FALSE;
 }
@@ -1704,9 +1665,12 @@ _pspp_sheet_view_column_count_special_cells (PsppSheetViewColumn *column)
     {
       PsppSheetViewColumnCellInfo *cellinfo = list->data;
 
-      if ((cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
-         cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
-         cellinfo->cell->visible)
+      GtkCellRendererMode mode;
+      g_object_get (cellinfo->cell, "mode", &mode, NULL);
+
+      if ((mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
+         mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
+         gtk_cell_renderer_get_visible (cellinfo->cell))
        i++;
     }
 
@@ -2517,21 +2481,19 @@ pspp_sheet_view_column_get_widget (PsppSheetViewColumn *tree_column)
  * @xalign: The alignment, which is between [0.0 and 1.0] inclusive.
  * 
  * Sets the alignment of the title or custom widget inside the column header.
- * The alignment determines its location inside the button -- 0.0 for left, 0.5
- * for center, 1.0 for right.
+ * The alignment determines its location inside the button.
  **/
 void
 pspp_sheet_view_column_set_alignment (PsppSheetViewColumn *tree_column,
-                                    gfloat             xalign)
+                                    GtkAlign  xalign)
 {
   g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column));
 
-  xalign = CLAMP (xalign, 0.0, 1.0);
 
-  if (tree_column->xalign == xalign)
+  if (tree_column->halign == xalign)
     return;
 
-  tree_column->xalign = xalign;
+  tree_column->halign = xalign;
   pspp_sheet_view_column_update_button (tree_column);
   g_object_notify (G_OBJECT (tree_column), "alignment");
 }
@@ -2540,19 +2502,19 @@ pspp_sheet_view_column_set_alignment (PsppSheetViewColumn *tree_column,
  * pspp_sheet_view_column_get_alignment:
  * @tree_column: A #PsppSheetViewColumn.
  * 
- * Returns the current x alignment of @tree_column.  This value can range
- * between 0.0 and 1.0.
+ * Returns the current x alignment of @tree_column.
  * 
  * Return value: The current alignent of @tree_column.
  **/
-gfloat
+GtkAlign
 pspp_sheet_view_column_get_alignment (PsppSheetViewColumn *tree_column)
 {
-  g_return_val_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column), 0.5);
+  g_return_val_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column), GTK_ALIGN_CENTER);
 
-  return tree_column->xalign;
+  return tree_column->halign;
 }
 
+
 /**
  * pspp_sheet_view_column_set_reorderable:
  * @tree_column: A #PsppSheetViewColumn
@@ -3094,12 +3056,11 @@ enum {
 
 static gboolean
 pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
-                                         GdkWindow          *window,
+                                           cairo_t *cr,
                                          const GdkRectangle *background_area,
                                          const GdkRectangle *cell_area,
                                          guint               flags,
                                          gint                action,
-                                         const GdkRectangle *expose_area,     /* RENDER */
                                          GdkRectangle       *focus_rectangle, /* FOCUS  */
                                          GtkCellEditable   **editable_widget, /* EVENT  */
                                          GdkEvent           *event,           /* EVENT  */
@@ -3108,7 +3069,6 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *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;
@@ -3181,7 +3141,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
     {
       PsppSheetViewColumnCellInfo *info = (PsppSheetViewColumnCellInfo *)list->data;
 
-      if (! info->cell->visible)
+      if (! gtk_cell_renderer_get_visible (info->cell))
        continue;
 
       if (info->expand == TRUE)
@@ -3208,7 +3168,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
       if (info->pack == GTK_PACK_END)
        continue;
 
-      if (! info->cell->visible)
+      if (! gtk_cell_renderer_get_visible (info->cell))
        continue;
 
       if ((info->has_focus || special_cells == 1) && cursor_row)
@@ -3253,11 +3213,10 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
       if (action == CELL_ACTION_RENDER)
        {
          gtk_cell_renderer_render (info->cell,
-                                   window,
+                                   cr,
                                    tree_column->tree_view,
                                    &rtl_background_area,
                                    &rtl_cell_area,
-                                   &real_expose_area, 
                                    flags);
        }
       /* FOCUS */
@@ -3383,7 +3342,7 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
       if (info->pack == GTK_PACK_START)
        continue;
 
-      if (! info->cell->visible)
+      if (! gtk_cell_renderer_get_visible (info->cell))
        continue;
 
       if ((info->has_focus || special_cells == 1) && cursor_row)
@@ -3418,11 +3377,10 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
       if (action == CELL_ACTION_RENDER)
        {
          gtk_cell_renderer_render (info->cell,
-                                   window,
+                                   cr,
                                    tree_column->tree_view,
                                    &rtl_background_area,
                                    &rtl_cell_area,
-                                   &real_expose_area,
                                    flags);
        }
       /* FOCUS */
@@ -3566,7 +3524,6 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
  * @window: a #GdkDrawable to draw to
  * @background_area: entire cell area (including tree expanders and maybe padding on the sides)
  * @cell_area: area normally rendered by a cell renderer
- * @expose_area: area that actually needs updating
  * @flags: flags that affect rendering
  * 
  * Renders the cell contained by #tree_column. This is used primarily by the
@@ -3574,24 +3531,21 @@ pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn  *tree_column,
  **/
 void
 _pspp_sheet_view_column_cell_render (PsppSheetViewColumn  *tree_column,
-                                  GdkWindow          *window,
+                                    cairo_t *cr,
                                   const GdkRectangle *background_area,
                                   const GdkRectangle *cell_area,
-                                  const GdkRectangle *expose_area,
                                   guint               flags)
 {
   g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column));
   g_return_if_fail (background_area != NULL);
   g_return_if_fail (cell_area != NULL);
-  g_return_if_fail (expose_area != NULL);
 
   pspp_sheet_view_column_cell_process_action (tree_column,
-                                           window,
+                                             cr,
                                            background_area,
                                            cell_area,
                                            flags,
                                            CELL_ACTION_RENDER,
-                                           expose_area,
                                            NULL, NULL, NULL, NULL);
 }
 
@@ -3612,7 +3566,7 @@ _pspp_sheet_view_column_cell_event (PsppSheetViewColumn  *tree_column,
                                                   cell_area,
                                                   flags,
                                                   CELL_ACTION_EVENT,
-                                                  NULL, NULL,
+                                                  NULL,
                                                   editable_widget,
                                                   event,
                                                   path_string);
@@ -3630,7 +3584,6 @@ _pspp_sheet_view_column_get_focus_area (PsppSheetViewColumn  *tree_column,
                                            cell_area,
                                            0,
                                            CELL_ACTION_FOCUS,
-                                           NULL,
                                            focus_area,
                                            NULL, NULL, NULL);
 }
@@ -3886,10 +3839,9 @@ _pspp_sheet_view_column_cell_focus (PsppSheetViewColumn *tree_column,
 
 void
 _pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn  *tree_column,
-                                      GdkWindow          *window,
+                                        cairo_t *cr,
                                       const GdkRectangle *background_area,
                                       const GdkRectangle *cell_area,
-                                      const GdkRectangle *expose_area,
                                       guint               flags)
 {
   gint focus_line_width;
@@ -3919,22 +3871,21 @@ _pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn  *tree_column,
     {
       GdkRectangle focus_rectangle;
       pspp_sheet_view_column_cell_process_action (tree_column,
-                                               window,
+                                                 cr,
                                                background_area,
                                                cell_area,
                                                flags,
                                                CELL_ACTION_FOCUS,
-                                               expose_area,
                                                &focus_rectangle,
                                                NULL, NULL, NULL);
 
       cell_state = flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED :
              (flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
              (flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL));
-      gtk_paint_focus (tree_column->tree_view->style,
-                      window,
+
+      gtk_paint_focus (gtk_widget_get_style (GTK_WIDGET (tree_column->tree_view)),
+                      cr,
                       cell_state,
-                      cell_area,
                       tree_column->tree_view,
                       "treeview",
                       focus_rectangle.x,
@@ -3965,7 +3916,7 @@ pspp_sheet_view_column_cell_is_visible (PsppSheetViewColumn *tree_column)
     {
       PsppSheetViewColumnCellInfo *info = (PsppSheetViewColumnCellInfo *) list->data;
 
-      if (info->cell->visible)
+      if (gtk_cell_renderer_get_visible (info->cell))
        return TRUE;
     }
 
@@ -4089,7 +4040,7 @@ _pspp_sheet_view_column_get_neighbor_sizes (PsppSheetViewColumn *column,
       if (info->cell == cell)
        break;
       
-      if (info->cell->visible)
+      if (gtk_cell_renderer_get_visible (info->cell))
        l += info->real_width + column->spacing;
     }
 
@@ -4099,7 +4050,7 @@ _pspp_sheet_view_column_get_neighbor_sizes (PsppSheetViewColumn *column,
       
       list = pspp_sheet_view_column_cell_next (column, list);
 
-      if (info->cell->visible)
+      if (gtk_cell_renderer_get_visible (info->cell))
        r += info->real_width + column->spacing;
     }
 
@@ -4146,7 +4097,7 @@ pspp_sheet_view_column_cell_get_position (PsppSheetViewColumn *tree_column,
           break;
         }
 
-      if (cellinfo->cell->visible)
+      if (gtk_cell_renderer_get_visible (cellinfo->cell))
         current_x += cellinfo->real_width;
     }
 
@@ -4273,8 +4224,8 @@ static const GMarkupParser attributes_parser =
     attributes_text_element,
   };
 
-gboolean
-_gtk_cell_layout_buildable_custom_tag_start (GtkBuildable  *buildable,
+static gboolean
+_cell_layout_buildable_custom_tag_start (GtkBuildable  *buildable,
                                              GtkBuilder    *builder,
                                              GObject       *child,
                                              const gchar   *tagname,
@@ -4301,8 +4252,8 @@ _gtk_cell_layout_buildable_custom_tag_start (GtkBuildable  *buildable,
   return FALSE;
 }
 
-void
-_gtk_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
+static void
+_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
                                            GtkBuilder   *builder,
                                            GObject      *child,
                                            const gchar  *tagname,
@@ -4315,8 +4266,8 @@ _gtk_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
   g_slice_free (AttributesSubParserData, parser_data);
 }
 
-void
-_gtk_cell_layout_buildable_add_child (GtkBuildable      *buildable,
+static void
+_cell_layout_buildable_add_child (GtkBuildable      *buildable,
                                       GtkBuilder        *builder,
                                       GObject           *child,
                                       const gchar       *type)
@@ -4379,15 +4330,3 @@ pspp_sheet_view_column_can_focus (PsppSheetViewColumn       *tree_column)
 {
   return tree_column->reorderable || tree_column->clickable;
 }
-
-void
-pspp_sheet_view_column_set_need_button (PsppSheetViewColumn       *tree_column,
-                                        gboolean                   need_button)
-{
-  if (tree_column->need_button != need_button)
-    {
-      tree_column->need_button = need_button;
-      pspp_sheet_view_column_update_button (tree_column);
-      _pspp_sheet_view_column_realize_button (tree_column);
-    }
-}