X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fspreadsheet-test.c;h=b70227008331377db9dd626fbd5582bbf4164cdd;hb=269c66ac0f1112af5da100c4374ca78248fd3109;hp=90a10375ec460dbfd04a76c2a5a5091a508d341e;hpb=f1ecefd655dac8dd69c389bbcc3c354991801c68;p=pspp diff --git a/src/ui/gui/spreadsheet-test.c b/src/ui/gui/spreadsheet-test.c index 90a10375ec..b702270083 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" @@ -28,7 +29,10 @@ #include "data/spreadsheet-reader.h" #include "data/casereader.h" #include "data/case.h" +#include "data/settings.h" #include "libpspp/message.h" +#include "libpspp/i18n.h" + #include "gl/xalloc.h" @@ -52,7 +56,8 @@ on_clicked (GtkButton *button, struct xxx *stuff) opts.sheet_index = -1; opts.cell_range = spreadsheet_get_sheet_range (stuff->sp, x); - opts.sheet_name = spreadsheet_get_sheet_name (stuff->sp, x); + opts.sheet_name = CONST_CAST (char *, + spreadsheet_get_sheet_name (stuff->sp, x)); opts.read_names = TRUE; opts.asw = -1; @@ -74,11 +79,11 @@ 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); - strncpy (ss, value_str (val, width), width); + memcpy (ss, value_str (val, width), width); printf ("%s ", ss); free (ss); @@ -109,6 +114,9 @@ main (int argc, char *argv[] ) GtkWidget *button; struct xxx stuff; + i18n_init (); + settings_init (); + gtk_init (&argc, &argv); if ( argc < 2) @@ -132,8 +140,8 @@ 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); @@ -184,7 +192,7 @@ main (int argc, char *argv[] ) gtk_main (); - spreadsheet_destroy (stuff.sp); + spreadsheet_unref (stuff.sp); return 0; }