Cleaned up GUI, by objectifying the data editor. Removed a number of global variables.
[pspp-builds.git] / src / ui / gui / var-type-dialog.c
index d4262872e044eb6b61f9c0e2e55a893a99ce10b9..7433b93e4b0237d3a07cc9dd5bb3e1fb32a2f2cf 100644 (file)
@@ -1,7 +1,6 @@
 /* 
     PSPPIRE --- A Graphical User Interface for PSPP
     Copyright (C) 2005, 2006  Free Software Foundation
-    Written by John Darrington
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -32,7 +31,6 @@
 
 #include "var-type-dialog.h"
 
-#include "psppire-variable.h"
 #include "helper.h"
 
 #include <data/variable.h>
@@ -130,7 +128,7 @@ static void update_width_decimals(const struct var_type_dialog *dialog);
 static void
 set_local_width_decimals(struct var_type_dialog *dialog)
 {
-  dialog->fmt_l = * psppire_variable_get_write_spec(dialog->pv);
+  dialog->fmt_l = * var_get_write_format (dialog->pv);
 
   switch (dialog->active_button) 
     {
@@ -327,7 +325,7 @@ set_format_type_from_treeview(GtkTreeView *treeview, gpointer data)
 
 /* Create the structure from the XML definitions */
 struct var_type_dialog *
-var_type_dialog_create(GladeXML *xml)
+var_type_dialog_create (GladeXML *xml)
 {
   gint i;
   struct var_type_dialog *dialog = g_malloc(sizeof(struct var_type_dialog));
@@ -665,7 +663,7 @@ var_type_dialog_set_state(struct var_type_dialog *dialog)
   g_assert(dialog->pv);
 
   /* Populate width and decimals */
-  write_spec = psppire_variable_get_write_spec(dialog->pv);
+  write_spec = var_get_write_format (dialog->pv);
 
   g_string_printf(str, "%d", write_spec->d);
 
@@ -820,12 +818,10 @@ on_var_type_ok_clicked(GtkWidget *w, gpointer data)
        break;
       }
 
-    if ( result == true ) 
+    if ( result == true )
       {
-       psppire_variable_set_type(dialog->pv, new_type);
-       psppire_variable_set_width(dialog->pv, new_width);
-       psppire_variable_set_write_spec(dialog->pv, spec);
-       psppire_variable_set_print_spec(dialog->pv, spec);
+       var_set_width (dialog->pv, new_width);
+       var_set_both_formats (dialog->pv, &spec);
       }
 
   }