Implemented the goto-case dialog
[pspp-builds.git] / src / ui / gui / psppire-case-file.c
index 156266339fdc8c6c48494f5eecc1dc00ec69f038..32b3cb401f4bf76f7183b6e9875e5291a28389df 100644 (file)
@@ -1,21 +1,18 @@
-/*
-    PSPPIRE --- A Graphical User Interface for PSPP
-    Copyright (C) 2006  Free Software Foundation
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2006  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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301, USA. */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
 #include <string.h>
@@ -28,6 +25,7 @@
 #include <data/case.h>
 #include <data/data-in.h>
 #include <data/datasheet.h>
+#include <data/casereader.h>
 #include <math/sort.h>
 #include <libpspp/misc.h>
 
@@ -93,7 +91,7 @@ psppire_case_file_class_init (PsppireCaseFileClass *class)
   object_class->finalize = psppire_case_file_finalize;
 
   signals [CASE_CHANGED] =
-    g_signal_new ("case_changed",
+    g_signal_new ("case-changed",
                  G_TYPE_FROM_CLASS (class),
                  G_SIGNAL_RUN_FIRST,
                  0,
@@ -105,7 +103,7 @@ psppire_case_file_class_init (PsppireCaseFileClass *class)
 
 
   signals [CASE_INSERTED] =
-    g_signal_new ("case_inserted",
+    g_signal_new ("case-inserted",
                  G_TYPE_FROM_CLASS (class),
                  G_SIGNAL_RUN_FIRST,
                  0,
@@ -117,7 +115,7 @@ psppire_case_file_class_init (PsppireCaseFileClass *class)
 
 
   signals [CASES_DELETED] =
-    g_signal_new ("cases_deleted",
+    g_signal_new ("cases-deleted",
                  G_TYPE_FROM_CLASS (class),
                  G_SIGNAL_RUN_FIRST,
                  0,
@@ -154,11 +152,11 @@ psppire_case_file_init (PsppireCaseFile *cf)
  * Creates a new #PsppireCaseFile.
  */
 PsppireCaseFile*
-psppire_case_file_new (struct casereader *reader)
+psppire_case_file_new (const struct casereader *reader)
 {
   PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL);
 
-  cf->datasheet = datasheet_create (reader);
+  cf->datasheet = datasheet_create (casereader_clone (reader));
   cf->accessible = TRUE;
 
   return cf;
@@ -225,7 +223,7 @@ psppire_case_file_append_case (PsppireCaseFile *cf,
 }
 
 
-inline gint
+inline casenumber
 psppire_case_file_get_case_count (const PsppireCaseFile *cf)
 {
   g_return_val_if_fail (cf, FALSE);
@@ -320,7 +318,7 @@ psppire_case_file_data_in (PsppireCaseFile *cf, gint casenum, gint idx,
   if (ok)
     g_signal_emit (cf, signals [CASE_CHANGED], 0, casenum);
 
-  freesa (value);
+  freea (value);
 
   return TRUE;
 }