From: John Darrington Date: Sun, 22 Feb 2009 07:36:40 +0000 (+0900) Subject: Prevent data sheet from traversing into an invalid column. X-Git-Tag: v0.6.2-pre1~17 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47aaa033c935d0427abd7cbb591a35450eb7db81;p=pspp-builds.git Prevent data sheet from traversing into an invalid column. Thanks to James R. Van Zandt for reporting this problem. --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 3a6152a5..916c8838 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -562,6 +562,19 @@ on_map (GtkWidget *w) g_signal_connect (clip, "owner-change", G_CALLBACK (on_owner_change), w); } +static gboolean +traverse_cell_callback (GtkSheet *sheet, + gint row, gint column, + gint *new_row, gint *new_column, + gpointer data) +{ + PsppireDataStore *data_store = PSPPIRE_DATA_STORE (data); + + if ( *new_column >= psppire_dict_get_var_cnt (data_store->dict)) + return FALSE; + + return TRUE; +} static void psppire_data_editor_init (PsppireDataEditor *de) @@ -670,6 +683,9 @@ psppire_data_editor_new (PsppireVarStore *var_store, "data-store", data_store, NULL); + g_signal_connect (PSPPIRE_DATA_EDITOR(widget)->data_sheet, "traverse", + G_CALLBACK (traverse_cell_callback), data_store); + return widget; }