Whitespace changes only.
[pspp] / src / ui / gui / psppire.c
index 20f5130e81895d00bff35c5208ef781a8ea1d697..ea8250a6b9314092d7efa084fe83734f58cb7cf7 100644 (file)
@@ -17,7 +17,6 @@
 #include <config.h>
 
 
-#include <assert.h>
 #include <gsl/gsl_errno.h>
 #include <gtk/gtk.h>
 #include <libintl.h>
@@ -39,6 +38,7 @@
 #include "output/driver.h"
 #include "output/journal.h"
 #include "output/message-item.h"
+#include "output/spv/spv.h"
 
 #include "ui/gui/dict-display.h"
 #include "ui/gui/executor.h"
@@ -105,7 +105,7 @@ initialize (const struct init_source *is)
       bind_textdomain_codeset (PACKAGE, "UTF-8");
       break;
     case 8:
-      if ( ! gtk_parse_args (is->argc, is->argv) )
+      if (! gtk_parse_args (is->argc, is->argv))
        {
          perror ("Error parsing arguments");
          exit (1);
@@ -145,31 +145,7 @@ struct icon_size
   size_t n_sizes;  /* The number of items in the array below. */
   const GtkIconSize *usage; /* An array determining for what the icon set is used */
 };
-
-static const GtkIconSize menus[] = {GTK_ICON_SIZE_MENU};
-static const GtkIconSize large_toolbar[] = {GTK_ICON_SIZE_LARGE_TOOLBAR};
-static const GtkIconSize small_toolbar[] = {GTK_ICON_SIZE_SMALL_TOOLBAR};
-
-
-/* We currently have three icon sets viz: 16x16, 24x24 and 32x32
-   We use the 16x16 for menus, the 32x32 for the large_toolbars and 
-   the 24x24 for small_toolbars.
-
-   The order of this array is pertinent.  The icons in the sets occuring
-   earlier in the array will be used a the wildcard (default) icon size,
-   if such an icon exists.
-*/
-static const struct icon_size sizemap[] = 
-  {
-    {24,  sizeof (small_toolbar) / sizeof (GtkIconSize), small_toolbar},
-    {16,  sizeof (menus) / sizeof (GtkIconSize), menus},
-    {32,  sizeof (large_toolbar) / sizeof (GtkIconSize), large_toolbar}
-  };
-
-
-
 \f
-
 static void
 handle_msg (const struct msg *m_, void *lexer_)
 {
@@ -184,8 +160,11 @@ handle_msg (const struct msg *m_, void *lexer_)
       m.first_column = lex_get_first_column (lexer, 0);
       m.last_column = lex_get_last_column (lexer, 0);
     }
+  m.command_name = output_get_command_name ();
 
   message_item_submit (message_item_create (&m));
+
+  free (m.command_name);
 }
 
 void
@@ -199,13 +178,13 @@ GtkWindow *
 psppire_preload_file (const gchar *file)
 {
   const gchar *local_encoding = "UTF-8";
-  
+
   struct file_handle *fh = fh_create_file (NULL,
                                           file,
                                           local_encoding,
                                           fh_default_properties ());
   const char *filename = fh_get_file_name (fh);
-  
+
   int retval = any_reader_detect (fh, NULL);
 
   GtkWindow *w = NULL;
@@ -215,8 +194,15 @@ psppire_preload_file (const gchar *file)
     w = open_data_window (NULL, filename, NULL, NULL);
   else if (retval == 0)
     {
-      create_data_window ();
-      w = open_syntax_window (filename, NULL);
+      char *error = spv_detect (filename);
+      if (!error)
+        read_spv_file (filename);
+      else
+        {
+          free (error);
+          create_data_window ();
+          open_syntax_window (filename, NULL);
+        }
     }
 
   fh_unref (fh);