src/output/cairo.c (xr_chart_renderer): Set the chart size to 0.8 of the smallest...
[pspp] / src / ui / gui / pspp-sheet-view.c
index ab0694bd45521840737b02598a8c3f2023cb97f7..e06ed49a0a15cbf0be23bb83576db0d8ca4ac858 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012, 2013, 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
@@ -46,6 +46,8 @@
 #include "ui/gui/psppire-marshal.h"
 #include "ui/gui/pspp-sheet-selection.h"
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 #define P_(STRING) STRING
 #define GTK_PARAM_READABLE G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
 #define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
@@ -361,10 +363,6 @@ static void     pspp_sheet_view_search_position_func      (PsppSheetView      *t
 static void     pspp_sheet_view_search_disable_popdown    (GtkEntry         *entry,
                                                         GtkMenu          *menu,
                                                         gpointer          data);
-#if GTK3_TRANSITION
-static void     pspp_sheet_view_search_preedit_changed    (GtkIMContext     *im_context,
-                                                        PsppSheetView      *tree_view);
-#endif
 static void     pspp_sheet_view_search_activate           (GtkEntry         *entry,
                                                         PsppSheetView      *tree_view);
 static gboolean pspp_sheet_view_real_search_enable_popdown(gpointer          data);
@@ -617,10 +615,10 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class)
 
     /**
      * PsppSheetView:hover-selection:
-     * 
+     *
      * Enables of disables the hover selection mode of @tree_view.
      * Hover selection makes the selected row follow the pointer.
-     * Currently, this works only for the selection modes 
+     * Currently, this works only for the selection modes
      * %PSPP_SHEET_SELECTION_SINGLE and %PSPP_SHEET_SELECTION_BROWSE.
      *
      * This mode is primarily intended for treeviews in popups, e.g.
@@ -772,27 +770,6 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class)
                                                                GTK_PARAM_READABLE));
 
   /* Signals */
-#if GTK3_TRANSITION
-  /**
-   * PsppSheetView::set-scroll-adjustments
-   * @horizontal: the horizontal #GtkAdjustment
-   * @vertical: the vertical #GtkAdjustment
-   *
-   * Set the scroll adjustments for the tree view. Usually scrolled containers
-   * like #GtkScrolledWindow will emit this signal to connect two instances
-   * of #GtkScrollbar to the scroll directions of the #PsppSheetView.
-   */
-  widget_class->set_scroll_adjustments_signal =
-    g_signal_new ("set-scroll-adjustments",
-                 G_TYPE_FROM_CLASS (o_class),
-                 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                 G_STRUCT_OFFSET (PsppSheetViewClass, set_scroll_adjustments),
-                 NULL, NULL,
-                 psppire_marshal_VOID__OBJECT_OBJECT,
-                 G_TYPE_NONE, 2,
-                 GTK_TYPE_ADJUSTMENT,
-                 GTK_TYPE_ADJUSTMENT);
-#endif
 
   /**
    * PsppSheetView::row-activated:
@@ -801,12 +778,12 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class)
    * @column: the #PsppSheetViewColumn in which the activation occurred
    *
    * The "row-activated" signal is emitted when the method
-   * pspp_sheet_view_row_activated() is called or the user double clicks 
-   * a treeview row. It is also emitted when a non-editable row is 
-   * selected and one of the keys: Space, Shift+Space, Return or 
+   * pspp_sheet_view_row_activated() is called or the user double clicks
+   * a treeview row. It is also emitted when a non-editable row is
+   * selected and one of the keys: Space, Shift+Space, Return or
    * Enter is pressed.
-   * 
-   * For selection handling refer to the <link linkend="TreeWidget">tree 
+   *
+   * For selection handling refer to the <link linkend="TreeWidget">tree
    * widget conceptual overview</link> as well as #PsppSheetSelection.
    */
   tree_view_signals[ROW_ACTIVATED] =
@@ -822,8 +799,8 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class)
 
   /**
    * PsppSheetView::columns-changed:
-   * @tree_view: the object on which the signal is emitted 
-   * 
+   * @tree_view: the object on which the signal is emitted
+   *
    * The number of columns of the treeview has changed.
    */
   tree_view_signals[COLUMNS_CHANGED] =
@@ -838,7 +815,7 @@ pspp_sheet_view_class_init (PsppSheetViewClass *class)
   /**
    * PsppSheetView::cursor-changed:
    * @tree_view: the object on which the signal is emitted
-   * 
+   *
    * The position of the cursor (focused cell) has changed.
    */
   tree_view_signals[CURSOR_CHANGED] =
@@ -1084,9 +1061,9 @@ pspp_sheet_view_init (PsppSheetView *tree_view)
   tree_view->priv->search_equal_func = pspp_sheet_view_search_equal_func;
   tree_view->priv->search_custom_entry_set = FALSE;
   tree_view->priv->typeselect_flush_timeout = 0;
-  tree_view->priv->init_hadjust_value = TRUE;    
+  tree_view->priv->init_hadjust_value = TRUE;
   tree_view->priv->width = 0;
-          
+
   tree_view->priv->hover_selection = FALSE;
 
   tree_view->priv->rubber_banding_enable = FALSE;
@@ -1586,7 +1563,7 @@ pspp_sheet_view_realize (GtkWidget *widget)
   /* Need to call those here, since they create GCs */
   pspp_sheet_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
 
-  install_presize_handler (tree_view); 
+  install_presize_handler (tree_view);
 }
 
 static void
@@ -1633,7 +1610,7 @@ pspp_sheet_view_unrealize (GtkWidget *widget)
       g_source_remove (priv->typeselect_flush_timeout);
       priv->typeselect_flush_timeout = 0;
     }
-  
+
   for (list = priv->columns; list; list = list->next)
     _pspp_sheet_view_column_unrealize_button (PSPP_SHEET_VIEW_COLUMN (list->data));
 
@@ -1707,12 +1684,12 @@ pspp_sheet_view_update_size (PsppSheetView *tree_view)
   if (tree_view->priv->model == NULL)
     {
       tree_view->priv->width = 0;
-      tree_view->priv->prev_width = 0;                   
+      tree_view->priv->prev_width = 0;
       tree_view->priv->height = 0;
       return;
     }
 
-  tree_view->priv->prev_width = tree_view->priv->width;  
+  tree_view->priv->prev_width = tree_view->priv->width;
   tree_view->priv->width = 0;
 
   /* keep this in sync with size_allocate below */
@@ -1750,7 +1727,7 @@ pspp_sheet_view_size_request (GtkWidget      *widget,
   PsppSheetView *tree_view = PSPP_SHEET_VIEW (widget);
   GList *tmp_list;
 
-  /* we validate some rows initially just to make sure we have some size. 
+  /* we validate some rows initially just to make sure we have some size.
    * In practice, with a lot of static lists, this should get a good width.
    */
   initialize_fixed_height_mode (tree_view);
@@ -1770,7 +1747,9 @@ pspp_sheet_view_size_request (GtkWidget      *widget,
       tmp_list = tmp_list->next;
 
       if (gtk_widget_get_visible (child->widget))
-        gtk_widget_size_request (child->widget, &child_requisition);
+       {
+         gtk_widget_get_preferred_size (child->widget, NULL, &child_requisition);
+       }
     }
 }
 
@@ -1802,11 +1781,11 @@ invalidate_column (PsppSheetView       *tree_view,
          invalid_rect.y = 0;
          invalid_rect.width = column->width;
          invalid_rect.height = allocation.height;
-         
+
          gdk_window_invalidate_rect (gtk_widget_get_window (widget), &invalid_rect, TRUE);
          break;
        }
-      
+
       column_offset += tmpcolumn->width;
     }
 }
@@ -1921,9 +1900,9 @@ pspp_sheet_view_size_allocate_columns (GtkWidget *widget,
   else
     extra_per_column = 0;
 
-  for (list = (rtl ? last_column : first_column); 
+  for (list = (rtl ? last_column : first_column);
        list != (rtl ? first_column->prev : last_column->next);
-       list = (rtl ? list->prev : list->next)) 
+       list = (rtl ? list->prev : list->next))
     {
       gint real_requested_width = 0;
       gint old_width;
@@ -2030,6 +2009,9 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
   if (allocation->width != old_allocation.width)
     width_changed = TRUE;
 
+  if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
+    allocation->x += allocation->width - tree_view->priv->width ;
+
   gtk_widget_set_allocation (widget, allocation);
 
   /* We size-allocate the columns first because the width of the
@@ -2043,7 +2025,7 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
   gtk_adjustment_set_lower (tree_view->priv->hadjustment, 0);
   gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_page_size (tree_view->priv->hadjustment), tree_view->priv->width));
 
-  if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)   
+  if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
     {
       if (allocation->width < tree_view->priv->width)
         {
@@ -2089,7 +2071,7 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
     pspp_sheet_view_top_row_to_dy (tree_view);
   else
     pspp_sheet_view_dy_to_top_row (tree_view);
-  
+
   if (gtk_widget_get_realized (widget))
     {
       gdk_window_move_resize (gtk_widget_get_window (widget),
@@ -2133,6 +2115,8 @@ pspp_sheet_view_size_allocate (GtkWidget     *widget,
        }
       update_childrens_allocation(tree_view);
     }
+
+  tree_view->priv->resized = TRUE;
 }
 
 /* Grabs the focus and unsets the PSPP_SHEET_VIEW_DRAW_KEYFOCUS flag */
@@ -2564,11 +2548,14 @@ pspp_sheet_view_button_press (GtkWidget      *widget,
        {
          gpointer drag_data;
 
-         if (gdk_pointer_grab (column->window, FALSE,
-                               GDK_POINTER_MOTION_HINT_MASK |
-                               GDK_BUTTON1_MOTION_MASK |
-                               GDK_BUTTON_RELEASE_MASK,
-                               NULL, NULL, event->time))
+         if (GDK_GRAB_SUCCESS != gdk_device_grab (event->device,
+                                                  column->window,
+                                                  GDK_OWNERSHIP_NONE,
+                                                  FALSE,
+                                                  GDK_POINTER_MOTION_HINT_MASK |
+                                                  GDK_BUTTON1_MOTION_MASK |
+                                                  GDK_BUTTON_RELEASE_MASK,
+                                                  NULL, event->time))
            return FALSE;
 
          gtk_grab_add (widget);
@@ -2684,8 +2671,8 @@ pspp_sheet_view_button_release_column_resize (GtkWidget      *widget,
 
   PSPP_SHEET_VIEW_UNSET_FLAG (tree_view, PSPP_SHEET_VIEW_IN_COLUMN_RESIZE);
   gtk_grab_remove (widget);
-  gdk_display_pointer_ungrab (gdk_window_get_display (event->window),
-                             event->time);
+  gdk_device_ungrab (event->device, event->time);
+
   return TRUE;
 }
 
@@ -2849,7 +2836,7 @@ prelight_or_select (PsppSheetView *tree_view,
                    gint         y)
 {
   PsppSheetSelectionMode mode = pspp_sheet_selection_get_mode (tree_view->priv->selection);
-  
+
   if (tree_view->priv->hover_selection &&
       (mode == PSPP_SHEET_SELECTION_SINGLE || mode == PSPP_SHEET_SELECTION_BROWSE) &&
       !(tree_view->priv->edited_column &&
@@ -2860,7 +2847,7 @@ prelight_or_select (PsppSheetView *tree_view,
           if (!pspp_sheet_view_node_is_selected (tree_view, node))
            {
              GtkTreePath *path;
-             
+
              path = _pspp_sheet_view_find_path (tree_view, node);
              pspp_sheet_selection_select_path (tree_view->priv->selection, path);
               if (pspp_sheet_view_node_is_selected (tree_view, node))
@@ -2945,246 +2932,6 @@ update_prelight (PsppSheetView *tree_view,
 static void
 pspp_sheet_view_motion_draw_column_motion_arrow (PsppSheetView *tree_view)
 {
-#if GTK3_TRANSITION
-  PsppSheetViewColumnReorder *reorder = tree_view->priv->cur_reorder;
-  GtkWidget *widget = GTK_WIDGET (tree_view);
-  GdkBitmap *mask = NULL;
-  gint x;
-  gint y;
-  gint width;
-  gint height;
-  gint arrow_type = DRAG_COLUMN_WINDOW_STATE_UNSET;
-  GdkWindowAttr attributes;
-  guint attributes_mask;
-
-  if (!reorder ||
-      reorder->left_column == tree_view->priv->drag_column ||
-      reorder->right_column == tree_view->priv->drag_column)
-    arrow_type = DRAG_COLUMN_WINDOW_STATE_ORIGINAL;
-  else if (reorder->left_column || reorder->right_column)
-    {
-      GdkRectangle visible_rect;
-      pspp_sheet_view_get_visible_rect (tree_view, &visible_rect);
-      if (reorder->left_column)
-       x = reorder->left_column->allocation.x + reorder->left_column->allocation.width;
-      else
-       x = reorder->right_column->allocation.x;
-
-      if (x < visible_rect.x)
-       arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT;
-      else if (x > visible_rect.x + visible_rect.width)
-       arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT;
-      else
-        arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW;
-    }
-
-  /* We want to draw the rectangle over the initial location. */
-  if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
-    {
-      GdkGC *gc;
-      GdkColor col;
-
-      if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
-       {
-         if (tree_view->priv->drag_highlight_window)
-           {
-             gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
-                                       NULL);
-             gdk_window_destroy (tree_view->priv->drag_highlight_window);
-           }
-
-         attributes.window_type = GDK_WINDOW_CHILD;
-         attributes.wclass = GDK_INPUT_OUTPUT;
-          attributes.x = tree_view->priv->drag_column_x;
-          attributes.y = 0;
-         width = attributes.width = tree_view->priv->drag_column->allocation.width;
-         height = attributes.height = tree_view->priv->drag_column->allocation.height;
-         attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
-         attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
-         attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
-         attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-         tree_view->priv->drag_highlight_window = gdk_window_new (tree_view->priv->header_window, &attributes, attributes_mask);
-         gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
-
-         mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
-         gc = gdk_gc_new (mask);
-         col.pixel = 1;
-         gdk_gc_set_foreground (gc, &col);
-         gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
-         col.pixel = 0;
-         gdk_gc_set_foreground(gc, &col);
-         gdk_draw_rectangle (mask, gc, TRUE, 2, 2, width - 4, height - 4);
-         g_object_unref (gc);
-
-         gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
-                                        mask, 0, 0);
-         if (mask) g_object_unref (mask);
-         tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ORIGINAL;
-       }
-    }
-  else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW)
-    {
-      gint i, j = 1;
-      GdkGC *gc;
-      GdkColor col;
-
-      width = tree_view->priv->expander_size;
-
-      /* Get x, y, width, height of arrow */
-      gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
-      if (reorder->left_column)
-       {
-         x += reorder->left_column->allocation.x + reorder->left_column->allocation.width - width/2;
-         height = reorder->left_column->allocation.height;
-       }
-      else
-       {
-         x += reorder->right_column->allocation.x - width/2;
-         height = reorder->right_column->allocation.height;
-       }
-      y -= tree_view->priv->expander_size/2; /* The arrow takes up only half the space */
-      height += tree_view->priv->expander_size;
-
-      /* Create the new window */
-      if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW)
-       {
-         if (tree_view->priv->drag_highlight_window)
-           {
-             gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
-                                       NULL);
-             gdk_window_destroy (tree_view->priv->drag_highlight_window);
-           }
-
-         attributes.window_type = GDK_WINDOW_TEMP;
-         attributes.wclass = GDK_INPUT_OUTPUT;
-         attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
-         attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
-         attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
-         attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-          attributes.x = x;
-          attributes.y = y;
-         attributes.width = width;
-         attributes.height = height;
-         tree_view->priv->drag_highlight_window = gdk_window_new (gtk_widget_get_root_window (widget),
-                                                                  &attributes, attributes_mask);
-         gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
-
-         mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
-         gc = gdk_gc_new (mask);
-         col.pixel = 1;
-         gdk_gc_set_foreground (gc, &col);
-         gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
-
-         /* Draw the 2 arrows as per above */
-         col.pixel = 0;
-         gdk_gc_set_foreground (gc, &col);
-         for (i = 0; i < width; i ++)
-           {
-             if (i == (width/2 - 1))
-               continue;
-             gdk_draw_line (mask, gc, i, j, i, height - j);
-             if (i < (width/2 - 1))
-               j++;
-             else
-               j--;
-           }
-         g_object_unref (gc);
-         gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
-                                        mask, 0, 0);
-         if (mask) g_object_unref (mask);
-       }
-
-      tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ARROW;
-      gdk_window_move (tree_view->priv->drag_highlight_window, x, y);
-    }
-  else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT ||
-          arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
-    {
-      gint i, j = 1;
-      GdkGC *gc;
-      GdkColor col;
-
-      width = tree_view->priv->expander_size;
-
-      /* Get x, y, width, height of arrow */
-      width = width/2; /* remember, the arrow only takes half the available width */
-      gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
-      if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
-       x += widget->allocation.width - width;
-
-      if (reorder->left_column)
-       height = reorder->left_column->allocation.height;
-      else
-       height = reorder->right_column->allocation.height;
-
-      y -= tree_view->priv->expander_size;
-      height += 2*tree_view->priv->expander_size;
-
-      /* Create the new window */
-      if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT &&
-         tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
-       {
-         if (tree_view->priv->drag_highlight_window)
-           {
-             gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
-                                       NULL);
-             gdk_window_destroy (tree_view->priv->drag_highlight_window);
-           }
-
-         attributes.window_type = GDK_WINDOW_TEMP;
-         attributes.wclass = GDK_INPUT_OUTPUT;
-         attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
-         attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
-         attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
-         attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-          attributes.x = x;
-          attributes.y = y;
-         attributes.width = width;
-         attributes.height = height;
-         tree_view->priv->drag_highlight_window = gdk_window_new (NULL, &attributes, attributes_mask);
-         gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
-
-         mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
-         gc = gdk_gc_new (mask);
-         col.pixel = 1;
-         gdk_gc_set_foreground (gc, &col);
-         gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
-
-         /* Draw the 2 arrows as per above */
-         col.pixel = 0;
-         gdk_gc_set_foreground (gc, &col);
-         j = tree_view->priv->expander_size;
-         for (i = 0; i < width; i ++)
-           {
-             gint k;
-             if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT)
-               k = width - i - 1;
-             else
-               k = i;
-             gdk_draw_line (mask, gc, k, j, k, height - j);
-             gdk_draw_line (mask, gc, k, 0, k, tree_view->priv->expander_size - j);
-             gdk_draw_line (mask, gc, k, height, k, height - tree_view->priv->expander_size + j);
-             j--;
-           }
-         g_object_unref (gc);
-         gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
-                                        mask, 0, 0);
-         if (mask) g_object_unref (mask);
-       }
-
-      tree_view->priv->drag_column_window_state = arrow_type;
-      gdk_window_move (tree_view->priv->drag_highlight_window, x, y);
-   }
-  else
-    {
-      g_warning (G_STRLOC"Invalid PsppSheetViewColumnReorder struct");
-      gdk_window_hide (tree_view->priv->drag_highlight_window);
-      return;
-    }
-
-  gdk_window_show (tree_view->priv->drag_highlight_window);
-  gdk_window_raise (tree_view->priv->drag_highlight_window);
-#endif
 }
 
 static gboolean
@@ -3324,7 +3071,7 @@ pspp_sheet_view_motion_drag_column (GtkWidget      *widget,
   x = CLAMP (x + (gint)event->x - column->drag_x, 0,
             MAX (tree_view->priv->width, allocation.width) - column->allocation.width);
   gdk_window_move (tree_view->priv->drag_window, x, y);
-  
+
   /* autoscroll, if needed */
   pspp_sheet_view_horizontal_autoscroll (tree_view);
   /* Update the current reorder position and arrow; */
@@ -3592,7 +3339,7 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view)
   invalid_region = cairo_region_create_rectangle (&old_area);
   cairo_region_union_rectangle (invalid_region, &new_area);
 
-  gdk_rectangle_intersect (GDK_RECTANGLE_PTR (&old_area), 
+  gdk_rectangle_intersect (GDK_RECTANGLE_PTR (&old_area),
                           GDK_RECTANGLE_PTR (&new_area), GDK_RECTANGLE_PTR (&common));
   if (common.width > 2 && common.height > 2)
     {
@@ -3611,7 +3358,7 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view)
     }
 
 #if GTK_MAJOR_VERSION == 3
-  gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE);  
+  gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE);
 #else
   {
     cairo_rectangle_int_t extents;
@@ -3639,52 +3386,6 @@ pspp_sheet_view_update_rubber_band (PsppSheetView *tree_view)
   pspp_sheet_view_update_rubber_band_selection (tree_view);
 }
 
-#if GTK3_TRANSITION
-static void
-pspp_sheet_view_paint_rubber_band (PsppSheetView  *tree_view,
-                               GdkRectangle *area)
-{
-  cairo_t *cr;
-  GdkRectangle rect;
-  GdkRectangle rubber_rect;
-  GtkStyle *style;
-
-  return;
-  rubber_rect.x = MIN (tree_view->priv->press_start_x, tree_view->priv->rubber_band_x);
-  rubber_rect.y = MIN (tree_view->priv->press_start_y, tree_view->priv->rubber_band_y) - tree_view->priv->dy;
-  rubber_rect.width = ABS (tree_view->priv->press_start_x - tree_view->priv->rubber_band_x) + 1;
-  rubber_rect.height = ABS (tree_view->priv->press_start_y - tree_view->priv->rubber_band_y) + 1;
-
-  if (!gdk_rectangle_intersect (&rubber_rect, area, &rect))
-    return;
-
-  cr = gdk_cairo_create (tree_view->priv->bin_window);
-  cairo_set_line_width (cr, 1.0);
-
-  style = gtk_widget_get_style (GTK_WIDGET (tree_view));
-  cairo_set_source_rgba (cr,
-                        style->fg[GTK_STATE_NORMAL].red / 65535.,
-                        style->fg[GTK_STATE_NORMAL].green / 65535.,
-                        style->fg[GTK_STATE_NORMAL].blue / 65535.,
-                        .25);
-
-  gdk_cairo_rectangle (cr, &rect);
-  cairo_clip (cr);
-  cairo_paint (cr);
-
-  cairo_set_source_rgb (cr,
-                       style->fg[GTK_STATE_NORMAL].red / 65535.,
-                       style->fg[GTK_STATE_NORMAL].green / 65535.,
-                       style->fg[GTK_STATE_NORMAL].blue / 65535.);
-
-  cairo_rectangle (cr,
-                  rubber_rect.x + 0.5, rubber_rect.y + 0.5,
-                  rubber_rect.width - 1, rubber_rect.height - 1);
-  cairo_stroke (cr);
-
-  cairo_destroy (cr);
-}
-#endif
 
 
 static gboolean
@@ -3820,36 +3521,35 @@ pspp_sheet_view_draw_vertical_grid_lines (PsppSheetView    *tree_view,
                                          gint max_y)
 {
   GList *list = tree_view->priv->columns;
-  gint i = 0;
-  gint current_x = 0;
+  gint x = 0;
 
   if (tree_view->priv->grid_lines != PSPP_SHEET_VIEW_GRID_LINES_VERTICAL
       && tree_view->priv->grid_lines != PSPP_SHEET_VIEW_GRID_LINES_BOTH)
     return;
 
   /* Only draw the lines for visible rows and columns */
-  for (list = tree_view->priv->columns; list; list = list->next, i++)
+  gboolean rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
+
+  for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
+       list;
+       list = (rtl ? list->prev : list->next))
     {
       PsppSheetViewColumn *column = list->data;
-      gint x;
 
       if (! column->visible)
        continue;
 
-      current_x += column->width;
-
-      /* Generally the grid lines should fit within the column, but for the
-         last visible column we put it just past the end of the column.
-         (Otherwise horizontal grid lines sometimes stick out by one pixel.) */
-      x = current_x;
-      if (i != n_visible_columns - 1)
-        x--;
+      if (!rtl)
+       x += column->width;
 
       cairo_set_line_width (cr, 1.0);
       cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
       cairo_move_to (cr, x + 0.5, min_y);
-      cairo_line_to (cr, x + 0.5, max_y - min_y);
+      cairo_line_to (cr, x + 0.5, max_y - min_y - 0.5);
       cairo_stroke (cr);
+
+      if (rtl)
+       x += column->width;
     }
 }
 
@@ -3885,7 +3585,6 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
   gint horizontal_separator;
   gint focus_line_width;
   gboolean allow_rules;
-  gboolean has_special_cell;
   gboolean rtl;
   gint n_visible_columns;
   gint grid_line_width;
@@ -3901,7 +3600,7 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
 
   GdkRectangle exposed_rect;
   gdk_cairo_get_clip_rectangle (cr, &exposed_rect);
-  
+
   Zarea.x =      0;
   Zarea.y =      0;
   Zarea.height = allocation.height;
@@ -3922,12 +3621,6 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
       return;
     }
 
-#if GTK3_TRANSITION
-  /* clip event->area to the visible area */
-  if (Zarea.height < 0.5)
-    return;
-#endif
-
   validate_visible_area (tree_view);
 
   new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, Zarea.y);
@@ -3935,10 +3628,10 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
   if (new_y < 0)
     new_y = 0;
   y_offset = -pspp_sheet_view_find_offset (tree_view, new_y, &node);
-  bin_window_width = 
+  bin_window_width =
     gdk_window_get_width (tree_view->priv->bin_window);
 
-  bin_window_height = 
+  bin_window_height =
     gdk_window_get_height (tree_view->priv->bin_window);
 
 
@@ -3964,7 +3657,7 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
                           &iter,
                           path);
   gtk_tree_path_free (path);
-  
+
   cursor_path = NULL;
   drag_dest_path = NULL;
 
@@ -3990,7 +3683,7 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
 
   if (draw_vgrid_lines || draw_hgrid_lines)
     gtk_widget_style_get (widget, "grid-line-width", &grid_line_width, NULL);
-  
+
   n_visible_columns = 0;
   for (list = tree_view->priv->columns; list; list = list->next)
     {
@@ -4042,27 +3735,6 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
 
       parity = node % 2;
 
-      if (tree_view->priv->special_cells == PSPP_SHEET_VIEW_SPECIAL_CELLS_DETECT)
-        {
-          /* we *need* to set cell data on all cells before the call
-           * to _has_special_cell, else _has_special_cell() does not
-           * return a correct value.
-           */
-          for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
-               list;
-               list = (rtl ? list->prev : list->next))
-            {
-              PsppSheetViewColumn *column = list->data;
-              pspp_sheet_view_column_cell_set_cell_data (column,
-                                                         tree_view->priv->model,
-                                                         &iter);
-            }
-
-          has_special_cell = pspp_sheet_view_has_special_cell (tree_view);
-        }
-      else
-        has_special_cell = tree_view->priv->special_cells == PSPP_SHEET_VIEW_SPECIAL_CELLS_YES;
-
       for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
           list;
           list = (rtl ? list->prev : list->next))
@@ -4080,15 +3752,6 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
           else
             selected_column = TRUE;
 
-#if GTK3_TRANSITION
-         if (cell_offset > Zarea.x + Zarea.width ||
-             cell_offset + column->width < Zarea.x)
-           {
-             cell_offset += column->width;
-             continue;
-           }
-#endif
-
           if (selected && selected_column)
             flags |= GTK_CELL_RENDERER_SELECTED;
           else
@@ -4137,11 +3800,7 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
              cell_area.height -= grid_line_width;
            }
 
-#if GTK3_TRANSITION
-         if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT)
-#else
          if (!gdk_rectangle_intersect (&background_area, &exposed_rect, NULL))
-#endif
            {
              cell_offset += column->width;
              continue;
@@ -4221,33 +3880,16 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
 
              if (background_area.y >= 0)
                {
-#if GTK3_TRANSITION
-                 gdk_draw_line (event->window,
-                                tree_view->priv->grid_line_gc[widget->state],
-                                background_area.x, background_area.y,
-                                background_area.x + background_area.width,
-                                background_area.y);
-#else
                  cairo_move_to (cr, background_area.x, background_area.y - 0.5);
                  cairo_line_to (cr, background_area.x + background_area.width,
                                 background_area.y - 0.5);
-#endif
                }
 
              if (y_offset + max_height <= Zarea.height - 0.5)
                {
-#if GTK3_TRANSITION
-                 gdk_draw_line (event->window,
-                                tree_view->priv->grid_line_gc[widget->state],
-                                background_area.x, background_area.y + max_height,
-                                background_area.x + background_area.width,
-                                background_area.y + max_height);
-#else
-
                  cairo_move_to (cr, background_area.x, background_area.y + max_height - 0.5);
                  cairo_line_to (cr, background_area.x + background_area.width,
                                 background_area.y + max_height - 0.5);
-#endif
                }
              cairo_stroke (cr);
            }
@@ -4316,17 +3958,6 @@ pspp_sheet_view_draw_bin (GtkWidget      *widget,
               break;
             }
 
-#if GTK3_TRANSITION
-          if (highlight_y >= 0)
-            {
-              gdk_draw_line (event->window,
-                             widget->style->fg_gc[gtk_widget_get_state (widget)],
-                             0,
-                             highlight_y,
-                             rtl ? 0 : bin_window_width,
-                             highlight_y);
-            }
-#endif
         }
 
       y_offset += max_height;
@@ -4353,23 +3984,6 @@ done:
   pspp_sheet_view_draw_vertical_grid_lines (tree_view, cr, n_visible_columns,
                                    min_y, max_y);
 
-#if GTK3_TRANSITION
- if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
-   {
-     GdkRectangle *rectangles;
-     gint n_rectangles;
-
-     gdk_region_get_rectangles (event->region,
-                               &rectangles,
-                               &n_rectangles);
-
-     while (n_rectangles--)
-       pspp_sheet_view_paint_rubber_band (tree_view, &rectangles[n_rectangles]);
-
-     g_free (rectangles);
-   }
-#endif
-
   if (cursor_path)
     gtk_tree_path_free (cursor_path);
 
@@ -4872,7 +4486,7 @@ pspp_sheet_view_key_press (GtkWidget   *widget,
       ((GdkEventKey *) new_event)->window = g_object_ref (gtk_widget_get_window (tree_view->priv->search_window));
       gtk_widget_realize (tree_view->priv->search_window);
 
-      popup_menu_id = g_signal_connect (tree_view->priv->search_entry, 
+      popup_menu_id = g_signal_connect (tree_view->priv->search_entry,
                                        "popup-menu", G_CALLBACK (gtk_true),
                                         NULL);
 
@@ -4890,7 +4504,7 @@ pspp_sheet_view_key_press (GtkWidget   *widget,
       gdk_event_free (new_event);
       gtk_widget_hide (tree_view->priv->search_window);
 
-      g_signal_handler_disconnect (tree_view->priv->search_entry, 
+      g_signal_handler_disconnect (tree_view->priv->search_entry,
                                   popup_menu_id);
 
       /* We check to make sure that the entry tried to handle the text, and that
@@ -5079,7 +4693,7 @@ validate_row (PsppSheetView *tree_view,
                         "wide-separators",  &wide_separators,
                         "separator-height", &separator_height,
                        NULL);
-  
+
   draw_vgrid_lines =
     tree_view->priv->grid_lines == PSPP_SHEET_VIEW_GRID_LINES_VERTICAL
     || tree_view->priv->grid_lines == PSPP_SHEET_VIEW_GRID_LINES_BOTH;
@@ -5144,7 +4758,6 @@ validate_visible_area (PsppSheetView *tree_view)
   GtkTreePath *above_path = NULL;
   GtkTreeIter iter;
   int node = -1;
-  gboolean size_changed = FALSE;
   gint total_height;
   gint area_above = 0;
   gint area_below = 0;
@@ -5318,23 +4931,6 @@ validate_visible_area (PsppSheetView *tree_view)
   pspp_sheet_view_set_top_row (tree_view, above_path, -area_above);
   pspp_sheet_view_top_row_to_dy (tree_view);
 
-  /* update width/height and queue a resize */
-  if (size_changed)
-    {
-      GtkRequisition requisition;
-
-      /* We temporarily guess a size, under the assumption that it will be the
-       * same when we get our next size_allocate.  If we don't do this, we'll be
-       * in an inconsistent state if we call top_row_to_dy. */
-
-      gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition);
-      gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->hadjustment), (gfloat)requisition.width));
-      gtk_adjustment_set_upper (tree_view->priv->vadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), (gfloat)requisition.height));
-      gtk_adjustment_changed (tree_view->priv->hadjustment);
-      gtk_adjustment_changed (tree_view->priv->vadjustment);
-      gtk_widget_queue_resize (GTK_WIDGET (tree_view));
-    }
-
   gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
   tree_view->priv->scroll_to_path = NULL;
 
@@ -5405,14 +5001,14 @@ do_presize_handler (PsppSheetView *tree_view)
   if (! gtk_widget_get_realized (GTK_WIDGET (tree_view)))
     return FALSE;
 
-  gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition);
+  gtk_widget_get_preferred_size (GTK_WIDGET (tree_view), NULL, &requisition);
 
   gtk_adjustment_set_upper (tree_view->priv->hadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->hadjustment), (gfloat)requisition.width));
   gtk_adjustment_set_upper (tree_view->priv->vadjustment, MAX (gtk_adjustment_get_upper (tree_view->priv->vadjustment), (gfloat)requisition.height));
   gtk_adjustment_changed (tree_view->priv->hadjustment);
   gtk_adjustment_changed (tree_view->priv->vadjustment);
   gtk_widget_queue_resize (GTK_WIDGET (tree_view));
-                  
+
   return FALSE;
 }
 
@@ -5420,7 +5016,7 @@ static gboolean
 presize_handler_callback (gpointer data)
 {
   do_presize_handler (PSPP_SHEET_VIEW (data));
-                  
+
   return FALSE;
 }
 
@@ -6108,45 +5704,6 @@ static void
 pspp_sheet_view_drag_begin (GtkWidget      *widget,
                           GdkDragContext *context)
 {
-#if GTK3_TRANSITION
-  PsppSheetView *tree_view;
-  GtkTreePath *path = NULL;
-  gint cell_x, cell_y;
-  GdkPixmap *row_pix;
-  TreeViewDragInfo *di;
-
-  tree_view = PSPP_SHEET_VIEW (widget);
-
-  /* if the user uses a custom DND source impl, we don't set the icon here */
-  di = get_info (tree_view);
-
-  if (di == NULL || !di->source_set)
-    return;
-
-  pspp_sheet_view_get_path_at_pos (tree_view,
-                                 tree_view->priv->press_start_x,
-                                 tree_view->priv->press_start_y,
-                                 &path,
-                                 NULL,
-                                 &cell_x,
-                                 &cell_y);
-
-  g_return_if_fail (path != NULL);
-
-  row_pix = pspp_sheet_view_create_row_drag_icon (tree_view,
-                                                path);
-
-  gtk_drag_set_icon_pixmap (context,
-                            gdk_drawable_get_colormap (row_pix),
-                            row_pix,
-                            NULL,
-                            /* the + 1 is for the black border in the icon */
-                            tree_view->priv->press_start_x + 1,
-                            cell_y + 1);
-
-  g_object_unref (row_pix);
-  gtk_tree_path_free (path);
-#endif
 }
 
 
@@ -7051,7 +6608,7 @@ pspp_sheet_view_put (PsppSheetView *tree_view,
                     PsppSheetViewColumn *column)
 {
   PsppSheetViewChild *child;
-  
+
   g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view));
   g_return_if_fail (GTK_IS_WIDGET (child_widget));
 
@@ -7069,7 +6626,7 @@ pspp_sheet_view_put (PsppSheetView *tree_view,
 
   if (gtk_widget_get_realized (GTK_WIDGET (tree_view)))
     gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
-  
+
   gtk_widget_set_parent (child_widget, GTK_WIDGET (tree_view));
 }
 
@@ -7118,7 +6675,7 @@ pspp_sheet_view_row_changed (GtkTreeModel *model,
       if (gtk_widget_get_realized (GTK_WIDGET (tree_view)))
         pspp_sheet_view_node_queue_redraw (tree_view, node);
     }
-  
+
   if (free_path)
     gtk_tree_path_free (path);
 }
@@ -7446,7 +7003,7 @@ pspp_sheet_view_add_move_binding (GtkBindingSet  *binding_set,
                                GtkMovementStep step,
                                gint            count)
 {
-  
+
   gtk_binding_entry_add_signal (binding_set, keyval, modmask,
                                 "move-cursor", 2,
                                 G_TYPE_ENUM, step,
@@ -7537,7 +7094,7 @@ pspp_sheet_view_set_column_drag_info (PsppSheetView       *tree_view,
 
   /* We know there are always 2 slots possbile, as you can always return column. */
   /* If that's all there is, return */
-  if (tree_view->priv->column_drag_info->next == NULL || 
+  if (tree_view->priv->column_drag_info->next == NULL ||
       (tree_view->priv->column_drag_info->next->next == NULL &&
        ((PsppSheetViewColumnReorder *)tree_view->priv->column_drag_info->data)->right_column == column &&
        ((PsppSheetViewColumnReorder *)tree_view->priv->column_drag_info->next->data)->left_column == column))
@@ -7635,7 +7192,7 @@ _pspp_sheet_view_column_start_drag (PsppSheetView       *tree_view,
   send_event->button.axes = NULL;
   send_event->button.state = 0;
   send_event->button.button = 1;
-  send_event->button.device = 
+  send_event->button.device =
     gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
 
   send_event->button.x_root = 0;
@@ -8446,7 +8003,7 @@ pspp_sheet_view_real_select_cursor_row (PsppSheetView *tree_view,
   if (!(mode & PSPP_SHEET_SELECT_MODE_EXTEND))
     pspp_sheet_view_row_activated (tree_view, cursor_path,
                                  tree_view->priv->focus_column);
-    
+
   gtk_tree_path_free (cursor_path);
 
   return TRUE;
@@ -8519,7 +8076,7 @@ send_focus_change (GtkWidget *widget,
   fevent->focus_change.type = GDK_FOCUS_CHANGE;
   fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget));
   fevent->focus_change.in = in;
-  
+
   gtk_widget_send_focus_change (widget, fevent);
   gdk_event_free (fevent);
 }
@@ -8547,7 +8104,7 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view)
        gtk_window_set_screen (GTK_WINDOW (tree_view->priv->search_window), screen);
        return;
      }
-   
+
   tree_view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
   gtk_window_set_screen (GTK_WINDOW (tree_view->priv->search_window), screen);
 
@@ -8576,7 +8133,7 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view)
   gtk_widget_show (frame);
   gtk_container_add (GTK_CONTAINER (tree_view->priv->search_window), frame);
 
-  vbox = gtk_vbox_new (FALSE, 0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_widget_show (vbox);
   gtk_container_add (GTK_CONTAINER (frame), vbox);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
@@ -8591,13 +8148,6 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view)
                    "activate", G_CALLBACK (pspp_sheet_view_search_activate),
                    tree_view);
 
-#if GTK3_TRANSITION
-  g_signal_connect (GTK_ENTRY (tree_view->priv->search_entry)->im_context,
-                   "preedit-changed",
-                   G_CALLBACK (pspp_sheet_view_search_preedit_changed),
-                   tree_view);
-#endif
-
   gtk_container_add (GTK_CONTAINER (vbox),
                     tree_view->priv->search_entry);
 
@@ -8605,7 +8155,7 @@ pspp_sheet_view_ensure_interactive_directory (PsppSheetView *tree_view)
 }
 
 /* Pops up the interactive search entry.  If keybinding is TRUE then the user
- * started this by typing the start_interactive_search keybinding.  Otherwise, it came from 
+ * started this by typing the start_interactive_search keybinding.  Otherwise, it came from
  */
 static gboolean
 pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view,
@@ -8618,7 +8168,7 @@ pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view,
   GList *list;
   gboolean found_focus = FALSE;
   GtkWidgetClass *entry_parent_class;
-  
+
   if (!tree_view->priv->enable_search && !keybinding)
     return FALSE;
 
@@ -8643,7 +8193,7 @@ pspp_sheet_view_real_start_interactive_search (PsppSheetView *tree_view,
          break;
        }
     }
-  
+
   if (gtk_widget_has_focus (GTK_WIDGET (tree_view)))
     found_focus = TRUE;
 
@@ -8714,7 +8264,7 @@ pspp_sheet_view_new_column_width (PsppSheetView *tree_view,
   rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
   column = g_list_nth (tree_view->priv->columns, i)->data;
   width = rtl ? (column->allocation.x + column->allocation.width - *x) : (*x - column->allocation.x);
+
   /* Clamp down the value */
   if (column->min_width == -1)
     width = MAX (column->button_request, width);
@@ -8724,11 +8274,11 @@ pspp_sheet_view_new_column_width (PsppSheetView *tree_view,
     width = MIN (width, column->max_width);
 
   *x = rtl ? (column->allocation.x + column->allocation.width - width) : (column->allocation.x + width);
+
   return width;
 }
 
-void 
+void
 pspp_sheet_view_column_update_button (PsppSheetViewColumn *tree_column);
 
 /* Callbacks */
@@ -9163,7 +8713,7 @@ pspp_sheet_view_set_headers_visible (PsppSheetView *tree_view,
       gdk_window_get_position (tree_view->priv->bin_window, &x, &y);
       if (headers_visible)
        {
-         gdk_window_move_resize (tree_view->priv->bin_window, x, y  + TREE_VIEW_HEADER_HEIGHT (tree_view), 
+         gdk_window_move_resize (tree_view->priv->bin_window, x, y  + TREE_VIEW_HEADER_HEIGHT (tree_view),
                                  tree_view->priv->width, allocation.height -  + TREE_VIEW_HEADER_HEIGHT (tree_view));
 
           if (gtk_widget_get_mapped (GTK_WIDGET (tree_view)))
@@ -9253,11 +8803,11 @@ pspp_sheet_view_set_headers_clickable (PsppSheetView *tree_view,
  *
  * Since: 2.10
  **/
-gboolean 
+gboolean
 pspp_sheet_view_get_headers_clickable (PsppSheetView *tree_view)
 {
   GList *list;
-  
+
   g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), FALSE);
 
   for (list = tree_view->priv->columns; list; list = list->next)
@@ -9391,7 +8941,7 @@ pspp_sheet_view_remove_column (PsppSheetView       *tree_view,
        }
 
       if (tree_view->priv->n_columns == 0 &&
-         pspp_sheet_view_get_headers_visible (tree_view) && 
+         pspp_sheet_view_get_headers_visible (tree_view) &&
          tree_view->priv->header_window)
        gdk_window_hide (tree_view->priv->header_window);
 
@@ -10031,11 +9581,11 @@ pspp_sheet_view_get_cursor (PsppSheetView        *tree_view,
  *
  * Sets the current keyboard focus to be at @path, and selects it.  This is
  * useful when you want to focus the user's attention on a particular row.  If
- * @focus_column is not %NULL, then focus is given to the column specified by 
- * it. Additionally, if @focus_column is specified, and @start_editing is 
- * %TRUE, then editing should be started in the specified cell.  
- * This function is often followed by @gtk_widget_grab_focus (@tree_view) 
- * in order to give keyboard focus to the widget.  Please note that editing 
+ * @focus_column is not %NULL, then focus is given to the column specified by
+ * it. Additionally, if @focus_column is specified, and @start_editing is
+ * %TRUE, then editing should be started in the specified cell.
+ * This function is often followed by @gtk_widget_grab_focus (@tree_view)
+ * in order to give keyboard focus to the widget.  Please note that editing
  * can only happen when the widget is realized.
  *
  * If @path is invalid for @model, the current cursor (if any) will be unset
@@ -10130,11 +9680,11 @@ pspp_sheet_view_set_cursor_on_cell (PsppSheetView       *tree_view,
 /**
  * pspp_sheet_view_get_bin_window:
  * @tree_view: A #PsppSheetView
- * 
+ *
  * Returns the window that @tree_view renders to.  This is used primarily to
  * compare to <literal>event->window</literal> to confirm that the event on
  * @tree_view is on the right window.
- * 
+ *
  * Return value: A #GdkWindow, or %NULL when @tree_view hasn't been realized yet
  **/
 GdkWindow *
@@ -10250,7 +9800,7 @@ pspp_sheet_view_get_path_at_pos (PsppSheetView        *tree_view,
            {
              if (column)
                *column = last_column;
-             
+
              if (cell_x)
                *cell_x = last_column->width + remaining_x;
            }
@@ -10784,7 +10334,7 @@ pspp_sheet_view_get_visible_range (PsppSheetView  *tree_view,
 {
   int node;
   gboolean retval;
-  
+
   g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), FALSE);
 
   if (!tree_view->priv->row_count)
@@ -10877,7 +10427,7 @@ pspp_sheet_view_enable_model_drag_source (PsppSheetView              *tree_view,
  * @n_targets: the number of items in @targets
  * @actions: the bitmask of possible actions for a drag from this
  *    widget
- * 
+ *
  * Turns @tree_view into a drop destination for automatic DND. Calling
  * this method sets #PsppSheetView:reorderable to %FALSE.
  **/
@@ -10931,7 +10481,7 @@ pspp_sheet_view_unset_rows_drag_source (PsppSheetView *tree_view)
       if (!di->dest_set && !di->source_set)
         remove_info (tree_view);
     }
-  
+
   unset_reorderable (tree_view);
 }
 
@@ -10972,7 +10522,7 @@ pspp_sheet_view_unset_rows_drag_dest (PsppSheetView *tree_view)
  * @tree_view: a #PsppSheetView
  * @path: (allow-none): The path of the row to highlight, or %NULL.
  * @pos: Specifies whether to drop before, after or into the row
- * 
+ *
  * Sets the row that is highlighted for feedback.
  **/
 void
@@ -11049,7 +10599,7 @@ pspp_sheet_view_set_drag_dest_row (PsppSheetView            *tree_view,
  * @tree_view: a #PsppSheetView
  * @path: (allow-none): Return location for the path of the highlighted row, or %NULL.
  * @pos: (allow-none): Return location for the drop position, or %NULL
- * 
+ *
  * Gets information about the row that is highlighted for feedback.
  **/
 void
@@ -11083,12 +10633,12 @@ pspp_sheet_view_get_drag_dest_row (PsppSheetView              *tree_view,
  * @drag_y: the position to determine the destination row for
  * @path: (allow-none): Return location for the path of the highlighted row, or %NULL.
  * @pos: (allow-none): Return location for the drop position, or %NULL
- * 
+ *
  * Determines the destination row for a given position.  @drag_x and
  * @drag_y are expected to be in widget coordinates.  This function is only
  * meaningful if @tree_view is realized.  Therefore this function will always
  * return %FALSE if @tree_view is not realized or does not have a model.
- * 
+ *
  * Return value: whether there is a row at the given position, %TRUE if this
  * is indeed the case.
  **/
@@ -11178,130 +10728,6 @@ pspp_sheet_view_get_dest_row_at_pos (PsppSheetView             *tree_view,
 }
 
 
-#if GTK3_TRANSITION
-/* KEEP IN SYNC WITH PSPP_SHEET_VIEW_BIN_EXPOSE */
-/**
- * pspp_sheet_view_create_row_drag_icon:
- * @tree_view: a #PsppSheetView
- * @path: a #GtkTreePath in @tree_view
- *
- * Creates a #GdkPixmap representation of the row at @path.  
- * This image is used for a drag icon.
- *
- * Return value: a newly-allocated pixmap of the drag icon.
- **/
-GdkPixmap *
-pspp_sheet_view_create_row_drag_icon (PsppSheetView  *tree_view,
-                                    GtkTreePath  *path)
-{
-  GtkTreeIter   iter;
-  int node;
-  gint cell_offset;
-  GList *list;
-  GdkRectangle background_area;
-  GdkRectangle expose_area;
-  GtkWidget *widget;
-  /* start drawing inside the black outline */
-  gint x = 1, y = 1;
-  GdkDrawable *drawable;
-  gint bin_window_width;
-  gboolean rtl;
-
-  g_return_val_if_fail (PSPP_IS_SHEET_VIEW (tree_view), NULL);
-  g_return_val_if_fail (path != NULL, NULL);
-
-  widget = GTK_WIDGET (tree_view);
-
-  if (!gtk_widget_get_realized (widget))
-    return NULL;
-
-  _pspp_sheet_view_find_node (tree_view,
-                            path,
-                            &node);
-
-  if (node < 0)
-    return NULL;
-
-  if (!gtk_tree_model_get_iter (tree_view->priv->model,
-                                &iter,
-                                path))
-    return NULL;
-  
-  cell_offset = x;
-
-  background_area.y = y;
-  background_area.height = ROW_HEIGHT (tree_view);
-
-  bin_window_width = gdk_window_get_width (tree_view->priv->bin_window);
-
-  drawable = gdk_pixmap_new (tree_view->priv->bin_window,
-                             bin_window_width + 2,
-                             background_area.height + 2,
-                             -1);
-
-  expose_area.x = 0;
-  expose_area.y = 0;
-  expose_area.width = bin_window_width + 2;
-  expose_area.height = background_area.height + 2;
-
-#if GTK3_TRANSITION
-  gdk_draw_rectangle (drawable,
-                      widget->style->base_gc [gtk_widget_get_state (widget)],
-                      TRUE,
-                      0, 0,
-                      bin_window_width + 2,
-                      background_area.height + 2);
-#endif
-
-  rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
-
-  for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
-      list;
-      list = (rtl ? list->prev : list->next))
-    {
-      PsppSheetViewColumn *column = list->data;
-      GdkRectangle cell_area;
-      gint vertical_separator;
-
-      if (!column->visible)
-        continue;
-
-      pspp_sheet_view_column_cell_set_cell_data (column, tree_view->priv->model, &iter);
-
-      background_area.x = cell_offset;
-      background_area.width = column->width;
-
-      gtk_widget_style_get (widget,
-                           "vertical-separator", &vertical_separator,
-                           NULL);
-
-      cell_area = background_area;
-
-      cell_area.y += vertical_separator / 2;
-      cell_area.height -= vertical_separator;
-
-      if (pspp_sheet_view_column_cell_is_visible (column))
-        _pspp_sheet_view_column_cell_render (column,
-                                             drawable,
-                                             &background_area,
-                                             &cell_area,
-                                             &expose_area,
-                                             0);
-      cell_offset += column->width;
-    }
-
-#if GTK3_TRANSITION
-  gdk_draw_rectangle (drawable,
-                      widget->style->black_gc,
-                      FALSE,
-                      0, 0,
-                      bin_window_width + 1,
-                      background_area.height + 1);
-#endif
-
-  return drawable;
-}
-#endif
 
 /**
  * pspp_sheet_view_set_destroy_count_func:
@@ -11341,8 +10767,8 @@ pspp_sheet_view_set_destroy_count_func (PsppSheetView             *tree_view,
  *
  * If @enable_search is set, then the user can type in text to search through
  * the tree interactively (this is sometimes called "typeahead find").
- * 
- * Note that even if this is %FALSE, the user can still initiate a search 
+ *
+ * Note that even if this is %FALSE, the user can still initiate a search
  * using the "start-interactive-search" key binding.
  */
 void
@@ -11352,7 +10778,7 @@ pspp_sheet_view_set_enable_search (PsppSheetView *tree_view,
   g_return_if_fail (PSPP_IS_SHEET_VIEW (tree_view));
 
   enable_search = !!enable_search;
-  
+
   if (tree_view->priv->enable_search != enable_search)
     {
        tree_view->priv->enable_search = enable_search;
@@ -11364,7 +10790,7 @@ pspp_sheet_view_set_enable_search (PsppSheetView *tree_view,
  * pspp_sheet_view_get_enable_search:
  * @tree_view: A #PsppSheetView
  *
- * Returns whether or not the tree allows to start interactive searching 
+ * Returns whether or not the tree allows to start interactive searching
  * by typing in text.
  *
  * Return value: whether or not to let the user search interactively
@@ -11400,13 +10826,13 @@ pspp_sheet_view_get_search_column (PsppSheetView *tree_view)
  * @column: the column of the model to search in, or -1 to disable searching
  *
  * Sets @column as the column where the interactive search code should
- * search in for the current model. 
- * 
+ * search in for the current model.
+ *
  * If the search column is set, users can use the "start-interactive-search"
  * key binding to bring up search popup. The enable-search property controls
  * whether simply typing text will also start an interactive search.
  *
- * Note that @column refers to a column of the current model. The search 
+ * Note that @column refers to a column of the current model. The search
  * column is reset to -1 when the model is changed.
  */
 void
@@ -11546,7 +10972,7 @@ pspp_sheet_view_set_search_entry (PsppSheetView *tree_view,
                              G_CALLBACK (pspp_sheet_view_search_init),
                              tree_view);
        }
-      
+
         g_signal_connect (tree_view->priv->search_entry, "key-press-event",
                          G_CALLBACK (pspp_sheet_view_search_key_press_event),
                          tree_view);
@@ -11627,7 +11053,7 @@ pspp_sheet_view_search_dialog_hide (GtkWidget   *search_dialog,
       g_source_remove (tree_view->priv->typeselect_flush_timeout);
       tree_view->priv->typeselect_flush_timeout = 0;
     }
-       
+
   if (gtk_widget_get_visible (search_dialog))
     {
       /* send focus-in event */
@@ -11692,26 +11118,6 @@ pspp_sheet_view_search_disable_popdown (GtkEntry *entry,
                    G_CALLBACK (pspp_sheet_view_search_enable_popdown), data);
 }
 
-#if GTK3_TRANSITION
-/* Because we're visible but offscreen, we just set a flag in the preedit
- * callback.
- */
-static void
-pspp_sheet_view_search_preedit_changed (GtkIMContext *im_context,
-                                     PsppSheetView  *tree_view)
-{
-  tree_view->priv->imcontext_changed = 1;
-  if (tree_view->priv->typeselect_flush_timeout)
-    {
-      g_source_remove (tree_view->priv->typeselect_flush_timeout);
-      tree_view->priv->typeselect_flush_timeout =
-       gdk_threads_add_timeout (PSPP_SHEET_VIEW_SEARCH_DIALOG_TIMEOUT,
-                      (GSourceFunc) pspp_sheet_view_search_entry_flush_timeout,
-                      tree_view);
-    }
-
-}
-#endif
 
 static void
 pspp_sheet_view_search_activate (GtkEntry    *entry,
@@ -11728,12 +11134,12 @@ pspp_sheet_view_search_activate (GtkEntry    *entry,
   if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
     {
       path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
-      
+
       _pspp_sheet_view_find_node (tree_view, path, &node);
-      
+
       if (node >= 0 && pspp_sheet_view_node_is_selected (tree_view, node))
        pspp_sheet_view_row_activated (tree_view, path, tree_view->priv->focus_column);
-      
+
       gtk_tree_path_free (path);
     }
 }
@@ -12139,7 +11545,7 @@ pspp_sheet_view_remove_widget (GtkCellEditable *cell_editable,
                                        tree_view);
 
   gtk_container_remove (GTK_CONTAINER (tree_view),
-                       GTK_WIDGET (cell_editable));  
+                       GTK_WIDGET (cell_editable));
 
   /* FIXME should only redraw a single node */
   gtk_widget_queue_draw (GTK_WIDGET (tree_view));
@@ -12432,7 +11838,6 @@ pspp_sheet_view_real_start_editing (PsppSheetView       *tree_view,
 {
   PsppSheetSelectionMode mode = pspp_sheet_selection_get_mode (tree_view->priv->selection);
   gint pre_val = gtk_adjustment_get_value (tree_view->priv->vadjustment);
-  GtkRequisition requisition;
   gint row;
 
   g_return_if_fail (gtk_tree_path_get_depth (path) == 1);
@@ -12521,12 +11926,12 @@ pspp_sheet_view_stop_editing (PsppSheetView *tree_view,
  *
  * Enables of disables the hover selection mode of @tree_view.
  * Hover selection makes the selected row follow the pointer.
- * Currently, this works only for the selection modes 
+ * Currently, this works only for the selection modes
  * %PSPP_SHEET_SELECTION_SINGLE and %PSPP_SHEET_SELECTION_BROWSE.
- * 
+ *
  * Since: 2.6
  **/
-void     
+void
 pspp_sheet_view_set_hover_selection (PsppSheetView *tree_view,
                                   gboolean     hover)
 {
@@ -12543,14 +11948,14 @@ pspp_sheet_view_set_hover_selection (PsppSheetView *tree_view,
 /**
  * pspp_sheet_view_get_hover_selection:
  * @tree_view: a #PsppSheetView
- * 
+ *
  * Returns whether hover selection mode is turned on for @tree_view.
- * 
+ *
  * Return value: %TRUE if @tree_view is in hover selection mode
  *
- * Since: 2.6 
+ * Since: 2.6
  **/
-gboolean 
+gboolean
 pspp_sheet_view_get_hover_selection (PsppSheetView *tree_view)
 {
   return tree_view->priv->hover_selection;
@@ -12564,7 +11969,7 @@ pspp_sheet_view_get_hover_selection (PsppSheetView *tree_view)
  * Enables or disables rubber banding in @tree_view.  If the selection mode is
  * #PSPP_SHEET_SELECTION_MULTIPLE or #PSPP_SHEET_SELECTION_RECTANGLE, rubber
  * banding will allow the user to select multiple rows by dragging the mouse.
- * 
+ *
  * Since: 2.10
  **/
 void
@@ -12584,12 +11989,12 @@ pspp_sheet_view_set_rubber_banding (PsppSheetView *tree_view,
 /**
  * pspp_sheet_view_get_rubber_banding:
  * @tree_view: a #PsppSheetView
- * 
+ *
  * Returns whether rubber banding is turned on for @tree_view.  If the
  * selection mode is #PSPP_SHEET_SELECTION_MULTIPLE or
  * #PSPP_SHEET_SELECTION_RECTANGLE, rubber banding will allow the user to
  * select multiple rows by dragging the mouse.
- * 
+ *
  * Return value: %TRUE if rubber banding in @tree_view is enabled.
  *
  * Since: 2.10
@@ -12603,7 +12008,7 @@ pspp_sheet_view_get_rubber_banding (PsppSheetView *tree_view)
 /**
  * pspp_sheet_view_is_rubber_banding_active:
  * @tree_view: a #PsppSheetView
- * 
+ *
  * Returns whether a rubber banding operation is currently being done
  * in @tree_view.
  *
@@ -12698,11 +12103,11 @@ pspp_sheet_view_set_grid_lines (PsppSheetView           *tree_view,
 
   old_grid_lines = priv->grid_lines;
   priv->grid_lines = grid_lines;
-  
+
   if (old_grid_lines != grid_lines)
     {
       gtk_widget_queue_draw (GTK_WIDGET (tree_view));
-      
+
       g_object_notify (G_OBJECT (tree_view), "enable-grid-lines");
     }
 }
@@ -13084,11 +12489,11 @@ _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
 {
   gboolean continue_emission;
   gboolean signal_handled;
-  
+
   signal_handled = g_value_get_boolean (handler_return);
   g_value_set_boolean (return_accu, signal_handled);
   continue_emission = !signal_handled;
-  
+
   return continue_emission;
 }