X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fspreadsheet-test.c;h=da63c0ff4a1210aebdf95188cfdb9ac005731118;hb=fb224459eed00514cbc36ecbc311c644f8b22def;hp=bec577821a68076fc20831580b00ed1bf3739677;hpb=371896cd4ff9fbf7da9dbc8bec8968093a8d40d3;p=pspp diff --git a/src/ui/gui/spreadsheet-test.c b/src/ui/gui/spreadsheet-test.c index bec577821a..da63c0ff4a 100644 --- a/src/ui/gui/spreadsheet-test.c +++ b/src/ui/gui/spreadsheet-test.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2013 Free Software Foundation + Copyright (C) 2013, 2014 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 @@ -19,6 +19,7 @@ #include +#include #include #include "psppire-spreadsheet-model.h" @@ -68,7 +69,7 @@ on_clicked (GtkButton *button, struct xxx *stuff) proto = casereader_get_proto (reader); nvals = caseproto_get_n_widths (proto); - + for (; (c = casereader_read (reader)) != NULL; case_unref (c)) { int i; @@ -78,12 +79,12 @@ on_clicked (GtkButton *button, struct xxx *stuff) const int width = caseproto_get_width (proto, i); const union value *val = case_data_idx (c, i); if (0 == width) - printf ("%g ", val->f); + printf ("%.*g ", DBL_DIG + 1, val->f); else { char *ss = xzalloc (width + 1); memcpy (ss, value_str (val, width), width); - + printf ("%s ", ss); free (ss); } @@ -94,7 +95,7 @@ on_clicked (GtkButton *button, struct xxx *stuff) casereader_destroy (reader); } -static void +static void print_msg (const struct msg *m, void *aux UNUSED) { fprintf (stderr, "%s\n", m->text); @@ -117,7 +118,7 @@ main (int argc, char *argv[] ) settings_init (); gtk_init (&argc, &argv); - + if ( argc < 2) g_error ("Usage: prog file\n"); @@ -130,7 +131,7 @@ main (int argc, char *argv[] ) if (stuff.sp == NULL) stuff.sp = ods_probe (argv[1], false); - + if (stuff.sp == NULL) { g_error ("%s is neither a gnumeric nor a ods file\n", argv[1]); @@ -139,14 +140,14 @@ main (int argc, char *argv[] ) tm = psppire_spreadsheet_model_new (stuff.sp); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - hbox = gtk_hbox_new (FALSE, 5); - vbox = gtk_vbox_new (FALSE, 5); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); button = gtk_button_new_with_label ("Test reader"); g_signal_connect (button, "clicked", G_CALLBACK (on_clicked), &stuff); - + gtk_container_set_border_width (GTK_CONTAINER (window), 10); - + stuff.combo_box = gtk_combo_box_new(); { @@ -191,7 +192,7 @@ main (int argc, char *argv[] ) gtk_main (); - spreadsheet_destroy (stuff.sp); + spreadsheet_unref (stuff.sp); return 0; }