From: John Darrington Date: Fri, 21 Nov 2008 05:20:49 +0000 (+0900) Subject: Prevent traversing to cells for which there is no variable X-Git-Tag: v0.7.1~132 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc476dc25391d72bad99a307946aff0cae902a9a;p=pspp-builds.git Prevent traversing to cells for which there is no variable --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index a3a9334d..784a7319 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -136,6 +136,9 @@ on_data_column_clicked (PsppireDataEditor *de, gint col, gpointer data) } + + + /* Callback which occurs when the var sheet's row title button is double clicked */ static gboolean @@ -164,6 +167,23 @@ on_var_row_clicked (PsppireDataEditor *de, gint row, gpointer data) } +/* Moves the focus to a new cell. + Returns TRUE iff the move should be disallowed */ +static gboolean +traverse_cell_callback (GtkSheet *sheet, + gint row, gint column, + gint *new_row, gint *new_column, + gpointer data) +{ + PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data); + const PsppireDict *dict = de->data_store->dict; + + if ( *new_column >= psppire_dict_get_var_cnt (dict)) + return TRUE; + + return FALSE; +} + enum { @@ -604,6 +624,10 @@ init_sheet (PsppireDataEditor *de, int i, gtk_container_add (GTK_CONTAINER (de->sheet_bin[i]), de->data_sheet[i]); + + g_signal_connect (de->data_sheet[i], "traverse", + G_CALLBACK (traverse_cell_callback), de); + gtk_widget_show (de->sheet_bin[i]); }