Applied patch #5653, which adds callbacks to dataset whenever its dictionary or
[pspp-builds.git] / src / ui / gui / syntax-editor.c
index 35fd7a5e869aabc3b97a1e8f4caebde5e5846edf..a9564cb1a563fc959cee8f5c9dc80fe40d914f84 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "window-manager.h"
 
+#include <data/dictionary.h>
 #include <language/lexer/lexer.h>
 #include <language/command.h>
 #include <data/procedure.h>
@@ -110,7 +111,7 @@ save_if_modified (struct syntax_editor *se)
        return ;
     }
 
-  gtk_widget_destroy (e->window);
+  gtk_widget_destroy (GTK_WIDGET (e->window));
 }
 
 /* Callback for the File->SaveAs menuitem */
@@ -214,14 +215,16 @@ static void
 execute_syntax (const struct syntax_editor *se, GtkTextIter start,
                GtkTextIter stop)
 {
+  g_return_if_fail (proc_has_source (the_dataset));
+
   getl_append_source (the_source_stream,
                      create_syntax_editor_source (se, start, stop));
   for (;;)
     {
+      const struct dictionary *dict = dataset_dict (the_dataset);
       int result = cmd_parse (se->lexer, the_dataset,
-                             proc_has_source (the_dataset)
-                             ? CMD_STATE_DATA : CMD_STATE_INITIAL);
-
+                             dict_get_var_cnt (dict) > 0 ?
+                             CMD_STATE_DATA : CMD_STATE_INITIAL);
       if (result == CMD_EOF || result == CMD_FINISH)
        break;
     }
@@ -325,11 +328,13 @@ new_syntax_editor (void)
   struct syntax_editor *se ;
   struct editor_window *e;
 
+  connect_help (xml);
+
   se = g_malloc (sizeof (*se));
 
   e = (struct editor_window *)se;
 
-  e->window = get_widget_assert (xml, "syntax_editor");
+  e->window = GTK_WINDOW (get_widget_assert (xml, "syntax_editor"));
   text_view = get_widget_assert (xml, "syntax_text_view");
   se->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
   se->lexer = lex_create (the_source_stream);
@@ -360,6 +365,11 @@ new_syntax_editor (void)
                    G_CALLBACK (about_new),
                    e->window);
 
+  g_signal_connect (get_widget_assert (xml,"help_reference"),
+                   "activate",
+                   G_CALLBACK (reference_manual),
+                   NULL);
+
 
   g_signal_connect (get_widget_assert (xml, "file_save"),
                    "activate",
@@ -401,6 +411,13 @@ new_syntax_editor (void)
                    se);
 
 
+  g_signal_connect (get_widget_assert (xml,"windows_minimise_all"),
+                   "activate",
+                   G_CALLBACK (minimise_all_windows),
+                   NULL);
+
+
+
   g_object_unref (xml);
 
   g_signal_connect (e->window, "delete-event",