From: Ben Pfaff <blp@cs.stanford.edu>
Date: Sun, 28 Oct 2012 20:22:33 +0000 (-0700)
Subject: pspp-sheet-view: Fix warning using arrow keys to navigate column buttons.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fbuilds%2F20121106032209%2Fpspp;p=pspp

pspp-sheet-view: Fix warning using arrow keys to navigate column buttons.

Before this commit, clicking on a column head button in the data sheet,
then holding down the right arrow key until the data sheet began to scroll
right would often produce a warning of the form:

** (psppire:16451): WARNING **: Internal button not found

because nothing caused the underlying GtkButton to be instantiated in this
scenario.  This commit fixes the problem.
---

diff --git a/src/ui/gui/pspp-sheet-view.c b/src/ui/gui/pspp-sheet-view.c
index 9dbec5916b..38c609669c 100644
--- a/src/ui/gui/pspp-sheet-view.c
+++ b/src/ui/gui/pspp-sheet-view.c
@@ -6712,13 +6712,16 @@ pspp_sheet_view_header_focus (PsppSheetView      *tree_view,
 	      break;
 	    }
 	  column = tmp_list->data;
-	  if (column->button &&
-	      column->visible &&
+          if (column->visible &&
 	      pspp_sheet_view_column_can_focus (column))
-	    {
-              pspp_sheet_view_focus_column (tree_view, column,
-                                            clamp_column_visible);
-              return TRUE;
+            {
+              pspp_sheet_view_column_set_need_button (column, TRUE);
+              if (column->button)
+                {
+                  pspp_sheet_view_focus_column (tree_view, column,
+                                                clamp_column_visible);
+                  return TRUE;
+                }
 	    }
 	}
       return FALSE;