Fix problem inserting variables at end of var sheet
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 24 Nov 2008 13:45:20 +0000 (22:45 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 24 Nov 2008 13:45:20 +0000 (22:45 +0900)
lib/gtksheet/psppire-axis.c
src/ui/gui/psppire-data-editor.c

index a3609afae6101fa925cb9705513dbd577c8763f4..c83c6b46e9b18d487d3a15d3b335f64dccee146f 100644 (file)
@@ -166,7 +166,10 @@ psppire_axis_insert (PsppireAxis *a, gint size, gint posn)
 {
   struct tower_node *new = pool_malloc (a->pool, sizeof *new);
 
-  struct tower_node *before = tower_get (&a->tower, posn);
+  struct tower_node *before = NULL;
+
+  if ( posn != tower_count (&a->tower))
+    before = tower_get (&a->tower, posn);
 
   tower_insert (&a->tower, size, new, before);
 }
index 2e1dee8954aa5a59dd7d3707d19c96fcecd04eb9..505cf4a11ebbc67c31bbfa50f71fac71a2737f61 100644 (file)
@@ -301,7 +301,6 @@ psppire_data_editor_set_property (GObject         *object,
       g_signal_connect (de->data_store->dict, "backend-changed",   G_CALLBACK (new_variables_callback), de);
       g_signal_connect (de->data_store->dict, "variable-inserted", G_CALLBACK (insert_variable_callback), de);
       g_signal_connect (de->data_store->dict, "variable-deleted",  G_CALLBACK (delete_variable_callback), de);
-      //      g_signal_connect (de->data_store->dict, "variable-changed",  G_CALLBACK (alter_variable_callback), de);
       g_signal_connect (de->data_store->dict, "variable-display-width-changed",  G_CALLBACK (rewidth_variable_callback), de);
       break;
     case PROP_VAR_STORE: