Convert to utf8 in data_out function.
[pspp-builds.git] / src / ui / gui / var-type-dialog.c
index 8aad3ada888ab522b0eb1fa157e6c9a3b3e36b91..05ba5d3c9e748c61662bc8ee48914a521938490f 100644 (file)
@@ -21,7 +21,6 @@
 #include <config.h>
 
 #include <gtk/gtk.h>
-#include <glade/glade.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -263,12 +262,12 @@ preview_custom (GtkWidget *w, gpointer data)
       union value v;
       v.f = 1234.56;
 
-      sample_text = value_to_text (v, dialog->fmt_l);
+      sample_text = value_to_text (v, NULL, dialog->fmt_l);
       gtk_label_set_text (GTK_LABEL (dialog->label_psample), sample_text);
       g_free (sample_text);
 
       v.f = -v.f;
-      sample_text = value_to_text (v, dialog->fmt_l);
+      sample_text = value_to_text (v, NULL, dialog->fmt_l);
       gtk_label_set_text (GTK_LABEL (dialog->label_nsample), sample_text);
       g_free (sample_text);
     }
@@ -322,23 +321,24 @@ set_format_type_from_treeview (GtkTreeView *treeview, gpointer data)
 
 
 
-/* Create the structure from the XML definitions */
+/* Create the structure */
 struct var_type_dialog *
-var_type_dialog_create (GladeXML *xml)
+var_type_dialog_create (GtkWindow *toplevel)
 {
   gint i;
   struct var_type_dialog *dialog = g_malloc (sizeof (struct var_type_dialog));
 
-  g_assert (xml);
+  GtkBuilder *xml = builder_new ("var-sheet-dialogs.ui");
 
   dialog->window = get_widget_assert (xml,"var_type_dialog");
+  dialog->active_button = -1;
 
 
   g_signal_connect (dialog->window, "delete-event",
                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);
 
   gtk_window_set_transient_for (GTK_WINDOW (dialog->window),
-                              GTK_WINDOW (get_widget_assert (xml, "data_editor")));
+                               toplevel);
 
   dialog->radioButton[BUTTON_NUMERIC] =
     get_widget_assert (xml,"radiobutton1");
@@ -444,7 +444,7 @@ var_type_dialog_create (GladeXML *xml)
 
   g_object_unref (list_store);
 
-  g_signal_connect (GTK_OBJECT (dialog->date_format_treeview), "cursor-changed",
+  g_signal_connect (dialog->date_format_treeview, "cursor-changed",
                   GTK_SIGNAL_FUNC (set_format_from_treeview), dialog);
 
 
@@ -481,11 +481,11 @@ var_type_dialog_create (GladeXML *xml)
 
   g_object_unref (list_store);
 
-  g_signal_connect (GTK_OBJECT (dialog->dollar_treeview),
+  g_signal_connect (dialog->dollar_treeview,
                   "cursor-changed",
                   GTK_SIGNAL_FUNC (set_format_from_treeview), dialog);
 
-  g_signal_connect_swapped (GTK_OBJECT (dialog->dollar_treeview),
+  g_signal_connect_swapped (dialog->dollar_treeview,
                   "cursor-changed",
                   GTK_SIGNAL_FUNC (update_width_decimals), dialog);
 
@@ -525,22 +525,22 @@ var_type_dialog_create (GladeXML *xml)
   g_object_unref (list_store);
 
 
-  g_signal_connect (GTK_OBJECT (dialog->custom_treeview),
+  g_signal_connect (dialog->custom_treeview,
                   "cursor-changed",
                   GTK_SIGNAL_FUNC (set_format_type_from_treeview), dialog);
 
 
-  g_signal_connect (GTK_OBJECT (dialog->custom_treeview),
+  g_signal_connect (dialog->custom_treeview,
                   "cursor-changed",
                   GTK_SIGNAL_FUNC (preview_custom), dialog);
 
 
-  g_signal_connect (GTK_OBJECT (dialog->entry_width),
+  g_signal_connect (dialog->entry_width,
                   "changed",
                   GTK_SIGNAL_FUNC (preview_custom), dialog);
 
 
-  g_signal_connect (GTK_OBJECT (dialog->entry_decimals),
+  g_signal_connect (dialog->entry_decimals,
                   "changed",
                   GTK_SIGNAL_FUNC (preview_custom), dialog);
 
@@ -554,10 +554,10 @@ var_type_dialog_create (GladeXML *xml)
   g_signal_connect (get_widget_assert (xml, "var_type_cancel") , "clicked",
                    G_CALLBACK (hide_dialog),
                    dialog);
-
-
   }
 
+  g_object_unref (xml);
+
   return dialog;
 }