Merge commit 'HEAD'; commit 'master/master'
[pspp-builds.git] / src / ui / gui / psppire-syntax-window.c
index 56a39b8526ccc4bb0fc9a994a75e3ce4279c7755..4241949e6215b7af82a14509c9ee9857c449b5eb 100644 (file)
 #include <libpspp/message.h>
 #include <stdlib.h>
 
-
 #include "psppire-syntax-window.h"
 
-#include "data-editor.h"
+#include "psppire-data-window.h"
+#include "psppire-window-register.h"
 #include "about.h"
 #include "psppire-syntax-window.h"
 #include "syntax-editor-source.h"
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
-
-
 static void psppire_syntax_window_base_finalize (PsppireSyntaxWindowClass *, gpointer);
 static void psppire_syntax_window_base_init     (PsppireSyntaxWindowClass *class);
 static void psppire_syntax_window_class_init    (PsppireSyntaxWindowClass *class);
 static void psppire_syntax_window_init          (PsppireSyntaxWindow      *syntax_editor);
 
-
 GType
 psppire_syntax_window_get_type (void)
 {
@@ -73,26 +70,20 @@ psppire_syntax_window_get_type (void)
   return psppire_syntax_window_type;
 }
 
+static GObjectClass *parent_class ;
 
 static void
 psppire_syntax_window_finalize (GObject *object)
 {
-  g_debug ("%s %p", __FUNCTION__, object);
-
-  GObjectClass *class = G_OBJECT_GET_CLASS (object);
-
-  GObjectClass *parent_class = g_type_class_peek_parent (class);
-
-
   if (G_OBJECT_CLASS (parent_class)->finalize)
     (*G_OBJECT_CLASS (parent_class)->finalize) (object);
-
 }
 
 
 static void
 psppire_syntax_window_class_init (PsppireSyntaxWindowClass *class)
 {
+  parent_class = g_type_class_peek_parent (class);
 }
 
 
@@ -114,10 +105,12 @@ psppire_syntax_window_base_finalize (PsppireSyntaxWindowClass *class,
 
 
 static void
-editor_execute_syntax (const PsppireSyntaxWindow *se, GtkTextIter start,
-               GtkTextIter stop)
+editor_execute_syntax (const PsppireSyntaxWindow *sw, GtkTextIter start,
+                      GtkTextIter stop)
 {
-  execute_syntax (create_syntax_editor_source (se->buffer, start, stop));
+  PsppireWindow *win = PSPPIRE_WINDOW (sw);
+  const gchar *name = psppire_window_get_filename (win);
+  execute_syntax (create_syntax_editor_source (sw->buffer, start, stop, name));
 }
 
 
@@ -478,6 +471,7 @@ open_syntax_window (GtkMenuItem *menuitem, gpointer parent)
 }
 
 
+
 extern struct source_stream *the_source_stream ;
 
 static void
@@ -499,13 +493,10 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window)
   gtk_container_add (GTK_CONTAINER (window), box);
 
   g_object_ref (menubar);
-  gtk_widget_unparent (menubar);
 
   g_object_ref (sw);
-  gtk_widget_unparent (sw);
 
   g_object_ref (sb);
-  gtk_widget_unparent (sb);
 
 
   gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
@@ -524,11 +515,12 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window)
                    G_CALLBACK (open_syntax_window),
                    window);
 
-
+#if 0
   g_signal_connect (get_widget_assert (xml,"file_new_data"),
                    "activate",
-                   G_CALLBACK (new_data_window),
+                   G_CALLBACK (create_data_window),
                    window);
+#endif
 
   g_signal_connect (get_widget_assert (xml,"help_about"),
                    "activate",
@@ -578,8 +570,9 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window)
 
   g_signal_connect (get_widget_assert (xml,"windows_minimise_all"),
                    "activate",
-                   G_CALLBACK (psppire_window_minimise_all),
-                   NULL);
+                   G_CALLBACK (psppire_window_minimise_all), NULL);
+
+  PSPPIRE_WINDOW (window)->menu = GTK_MENU_SHELL (get_widget_assert (xml,"windows_menu"));
 
   g_object_unref (xml);