X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Fui%2Fgui%2Fvar-type-dialog.c;h=ea3d2e098a23c5eb464fea1ab596e6c09e4460cc;hb=c43efc75c86dd48cd67f23a4d3b5132964b331b8;hp=fb1977a5ab211a1f3c33bf2241bc02642cea14fd;hpb=49ad45764ab062f60a205dd84d0c3b600f051727;p=pspp diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index fb1977a5ab..ea3d2e098a 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005, 2006, 2010, 2011 Free Software Foundation + Copyright (C) 2005, 2006, 2010, 2011, 2012 Free Software Foundation 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 @@ -21,18 +21,15 @@ #include #include - #include #include -#include "var-type-dialog.h" - -#include "helper.h" - -#include -#include -#include - +#include "data/data-out.h" +#include "data/settings.h" +#include "data/variable.h" +#include "libpspp/message.h" +#include "ui/gui/builder-wrapper.h" +#include "ui/gui/var-type-dialog.h" struct tgs { @@ -262,12 +259,12 @@ preview_custom (GtkWidget *w, gpointer data) union value v; v.f = 1234.56; - sample_text = value_to_text (v, dialog->vs->dictionary, dialog->fmt_l); + sample_text = g_strchug (data_out (&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->vs->dictionary, dialog->fmt_l); + sample_text = g_strchug (data_out (&v, NULL, &dialog->fmt_l)); gtk_label_set_text (GTK_LABEL (dialog->label_nsample), sample_text); g_free (sample_text); } @@ -320,15 +317,13 @@ set_format_type_from_treeview (GtkTreeView *treeview, gpointer data) /* Create the structure */ struct var_type_dialog * -var_type_dialog_create (GtkWindow *toplevel, PsppireVarStore *vs) +var_type_dialog_create (GtkWindow *toplevel) { gint i; struct var_type_dialog *dialog = g_malloc (sizeof (struct var_type_dialog)); GtkBuilder *xml = builder_new ("var-sheet-dialogs.ui"); - dialog->vs = vs; - dialog->window = get_widget_assert (xml,"var_type_dialog"); dialog->active_button = -1; @@ -812,14 +807,16 @@ on_var_type_ok_clicked (GtkWidget *w, gpointer data) break; case BUTTON_DATE: case BUTTON_CUSTOM: - g_assert (fmt_check_output (&dialog->fmt_l)); - result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec)); + if (! fmt_check_output (&dialog->fmt_l)) + g_critical ("Invalid variable format"); + else + result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec)); break; case BUTTON_DOLLAR: result = make_output_format_try (&spec, FMT_DOLLAR, width, decimals); break; default: - g_print ("Unknown variable type: %d\n", dialog->active_button) ; + g_critical ("Unknown variable type: %d", dialog->active_button) ; result = false; break; }