+ return g_object_new (PSPPIRE_TYPE_VARIABLE_SHEET, NULL);
+}
+
+static void
+move_variable (PsppireVariableSheet *sheet, gint from, gint to, gpointer ud)
+{
+ PsppireDict *dict = NULL;
+ g_object_get (sheet, "data-model", &dict, NULL);
+
+ if (dict == NULL)
+ return;
+
+ struct variable *var = psppire_dict_get_variable (dict, from);
+
+ if (var == NULL)
+ return;
+ gint new_pos = to;
+ /* The index refers to the final position, so if the source
+ is less than the destination, then we must subtract 1, to
+ account for the position vacated by the source */
+ if (from < to)
+ new_pos--;
+ dict_reorder_var (dict->dict, var, new_pos);
+}
+
+
+static gboolean
+is_printable_key (gint keyval)
+{
+ switch (keyval)
+ {
+ case GDK_KEY_Return:
+ case GDK_KEY_ISO_Left_Tab:
+ case GDK_KEY_Tab:
+ return FALSE;
+ break;
+ }
+
+ return (0 != gdk_keyval_to_unicode (keyval));
+}
+
+struct dispatch
+{
+ PsppireVariableSheet *sheet;
+ void (*payload) (PsppireVariableSheet *);
+};
+
+
+static gboolean
+on_key_press (GtkWidget *w, GdkEventKey *e, gpointer user_data)
+{
+ const struct dispatch *d = user_data;
+ if (is_printable_key (e->keyval))
+ {
+ d->payload (d->sheet);
+ return TRUE;
+ }