1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "language/lexer/lexer.h"
23 #include "libpspp/encoding-guesser.h"
24 #include "libpspp/i18n.h"
25 #include "libpspp/message.h"
26 #include "ui/gui/executor.h"
27 #include "ui/gui/help-menu.h"
28 #include "ui/gui/helper.h"
29 #include "ui/gui/psppire-data-window.h"
30 #include "ui/gui/psppire-encoding-selector.h"
31 #include "ui/gui/psppire-syntax-window.h"
32 #include "ui/gui/psppire-syntax-window.h"
33 #include "ui/gui/psppire-window-register.h"
34 #include "ui/gui/psppire.h"
35 #include "ui/gui/psppire.h"
37 #include "gl/localcharset.h"
38 #include "gl/xalloc.h"
39 #include "gl/xvasprintf.h"
42 #define _(msgid) gettext (msgid)
43 #define N_(msgid) msgid
45 static void psppire_syntax_window_base_finalize (PsppireSyntaxWindowClass *, gpointer);
46 static void psppire_syntax_window_base_init (PsppireSyntaxWindowClass *class);
47 static void psppire_syntax_window_class_init (PsppireSyntaxWindowClass *class);
48 static void psppire_syntax_window_init (PsppireSyntaxWindow *syntax_editor);
51 static void psppire_syntax_window_iface_init (PsppireWindowIface *iface);
62 psppire_syntax_window_set_property (GObject *object,
67 PsppireSyntaxWindow *window = PSPPIRE_SYNTAX_WINDOW (object);
72 g_free (window->encoding);
73 window->encoding = g_value_dup_string (value);
76 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
83 psppire_syntax_window_get_property (GObject *object,
88 PsppireSyntaxWindow *window = PSPPIRE_SYNTAX_WINDOW (object);
93 g_value_set_string (value, window->encoding);
96 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
102 psppire_syntax_window_get_type (void)
104 static GType psppire_syntax_window_type = 0;
106 if (!psppire_syntax_window_type)
108 static const GTypeInfo psppire_syntax_window_info =
110 sizeof (PsppireSyntaxWindowClass),
111 (GBaseInitFunc) psppire_syntax_window_base_init,
112 (GBaseFinalizeFunc) psppire_syntax_window_base_finalize,
113 (GClassInitFunc)psppire_syntax_window_class_init,
114 (GClassFinalizeFunc) NULL,
116 sizeof (PsppireSyntaxWindow),
118 (GInstanceInitFunc) psppire_syntax_window_init,
121 static const GInterfaceInfo window_interface_info =
123 (GInterfaceInitFunc) psppire_syntax_window_iface_init,
128 psppire_syntax_window_type =
129 g_type_register_static (PSPPIRE_TYPE_WINDOW, "PsppireSyntaxWindow",
130 &psppire_syntax_window_info, 0);
132 g_type_add_interface_static (psppire_syntax_window_type,
133 PSPPIRE_TYPE_WINDOW_MODEL,
134 &window_interface_info);
137 return psppire_syntax_window_type;
140 static GObjectClass *parent_class ;
143 psppire_syntax_window_finalize (GObject *object)
145 if (G_OBJECT_CLASS (parent_class)->finalize)
146 (*G_OBJECT_CLASS (parent_class)->finalize) (object);
151 psppire_syntax_window_dispose (GObject *obj)
153 PsppireSyntaxWindow *sw = (PsppireSyntaxWindow *)obj;
155 GtkClipboard *clip_selection;
156 GtkClipboard *clip_primary;
158 if (sw->dispose_has_run)
161 g_free (sw->encoding);
164 clip_selection = gtk_widget_get_clipboard (GTK_WIDGET (sw), GDK_SELECTION_CLIPBOARD);
165 clip_primary = gtk_widget_get_clipboard (GTK_WIDGET (sw), GDK_SELECTION_PRIMARY);
167 g_signal_handler_disconnect (clip_primary, sw->sel_handler);
169 g_signal_handler_disconnect (clip_selection, sw->ps_handler);
171 /* Make sure dispose does not run twice. */
172 sw->dispose_has_run = TRUE;
174 /* Chain up to the parent class */
175 G_OBJECT_CLASS (parent_class)->dispose (obj);
181 psppire_syntax_window_class_init (PsppireSyntaxWindowClass *class)
183 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
185 GParamSpec *encoding_spec =
186 null_if_empty_param ("encoding",
187 "Character encoding",
188 "IANA character encoding in this syntax file",
190 G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
192 parent_class = g_type_class_peek_parent (class);
194 gobject_class->set_property = psppire_syntax_window_set_property;
195 gobject_class->get_property = psppire_syntax_window_get_property;
196 gobject_class->dispose = psppire_syntax_window_dispose;
198 g_object_class_install_property (gobject_class,
205 psppire_syntax_window_base_init (PsppireSyntaxWindowClass *class)
207 GObjectClass *object_class = G_OBJECT_CLASS (class);
209 object_class->finalize = psppire_syntax_window_finalize;
215 psppire_syntax_window_base_finalize (PsppireSyntaxWindowClass *class,
222 editor_execute_syntax (const PsppireSyntaxWindow *sw, GtkTextIter start,
225 PsppireWindow *win = PSPPIRE_WINDOW (sw);
226 struct lex_reader *reader;
229 text = gtk_text_buffer_get_text (sw->buffer, &start, &stop, FALSE);
230 reader = lex_reader_for_string (text);
233 lex_reader_set_file_name (reader, psppire_window_get_filename (win));
235 execute_syntax (psppire_default_data_window (), reader);
238 /* Delete the currently selected text */
240 on_edit_delete (PsppireSyntaxWindow *sw)
242 GtkTextIter begin, end;
244 if ( gtk_text_buffer_get_selection_bounds (sw->buffer, &begin, &end) )
245 gtk_text_buffer_delete (sw->buffer, &begin, &end);
251 /* The syntax editor's clipboard deals only with text */
259 selection_changed (PsppireSyntaxWindow *sw)
261 gboolean sel = gtk_text_buffer_get_has_selection (sw->buffer);
263 gtk_action_set_sensitive (sw->edit_copy, sel);
264 gtk_action_set_sensitive (sw->edit_cut, sel);
265 gtk_action_set_sensitive (sw->edit_delete, sel);
268 /* The callback which runs when something request clipboard data */
270 clipboard_get_cb (GtkClipboard *clipboard,
271 GtkSelectionData *selection_data,
275 PsppireSyntaxWindow *sw = data;
276 g_assert (info == SELECT_FMT_TEXT);
278 gtk_selection_data_set (selection_data, selection_data->target,
280 (const guchar *) sw->cliptext, strlen (sw->cliptext));
285 clipboard_clear_cb (GtkClipboard *clipboard,
288 PsppireSyntaxWindow *sw = data;
289 g_free (sw->cliptext);
294 static const GtkTargetEntry targets[] = {
295 { "UTF8_STRING", 0, SELECT_FMT_TEXT },
296 { "STRING", 0, SELECT_FMT_TEXT },
297 { "TEXT", 0, SELECT_FMT_TEXT },
298 { "COMPOUND_TEXT", 0, SELECT_FMT_TEXT },
299 { "text/plain;charset=utf-8", 0, SELECT_FMT_TEXT },
300 { "text/plain", 0, SELECT_FMT_TEXT },
305 Store a clip containing the currently selected text.
306 Returns true iff something was set.
307 As a side effect, begin and end will be set to indicate
308 the limits of the selected text.
311 set_clip (PsppireSyntaxWindow *sw, GtkTextIter *begin, GtkTextIter *end)
313 GtkClipboard *clipboard ;
315 if ( ! gtk_text_buffer_get_selection_bounds (sw->buffer, begin, end) )
318 g_free (sw->cliptext);
319 sw->cliptext = gtk_text_buffer_get_text (sw->buffer, begin, end, FALSE);
322 gtk_widget_get_clipboard (GTK_WIDGET (sw), GDK_SELECTION_CLIPBOARD);
324 if (!gtk_clipboard_set_with_owner (clipboard, targets,
325 G_N_ELEMENTS (targets),
326 clipboard_get_cb, clipboard_clear_cb,
328 clipboard_clear_cb (clipboard, sw);
334 on_edit_cut (PsppireSyntaxWindow *sw)
336 GtkTextIter begin, end;
338 if ( set_clip (sw, &begin, &end))
339 gtk_text_buffer_delete (sw->buffer, &begin, &end);
343 on_edit_copy (PsppireSyntaxWindow *sw)
345 GtkTextIter begin, end;
347 set_clip (sw, &begin, &end);
351 /* A callback for when the clipboard contents have been received */
353 contents_received_callback (GtkClipboard *clipboard,
354 GtkSelectionData *sd,
358 PsppireSyntaxWindow *syntax_window = data;
360 if ( sd->length < 0 )
363 if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE))
366 c = (gchar *) sd->data;
368 gtk_text_buffer_insert_at_cursor (syntax_window->buffer,
375 on_edit_paste (PsppireSyntaxWindow *sw)
377 GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (sw));
378 GtkClipboard *clipboard =
379 gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
381 gtk_clipboard_request_contents (clipboard,
382 gdk_atom_intern ("UTF8_STRING", TRUE),
383 contents_received_callback,
388 /* Check to see if CLIP holds a target which we know how to paste,
389 and set the sensitivity of the Paste action accordingly.
392 set_paste_sensitivity (GtkClipboard *clip, GdkEventOwnerChange *event, gpointer data)
395 gboolean compatible_target = FALSE;
396 PsppireSyntaxWindow *sw = PSPPIRE_SYNTAX_WINDOW (data);
398 for (i = 0 ; i < sizeof (targets) / sizeof (targets[0]) ; ++i)
400 GdkAtom atom = gdk_atom_intern (targets[i].target, TRUE);
401 if ( gtk_clipboard_wait_is_target_available (clip, atom))
403 compatible_target = TRUE;
408 gtk_action_set_sensitive (sw->edit_paste, compatible_target);
414 /* Parse and execute all the text in the buffer */
416 on_run_all (GtkMenuItem *menuitem, gpointer user_data)
418 GtkTextIter begin, end;
419 PsppireSyntaxWindow *se = PSPPIRE_SYNTAX_WINDOW (user_data);
421 gtk_text_buffer_get_iter_at_offset (se->buffer, &begin, 0);
422 gtk_text_buffer_get_iter_at_offset (se->buffer, &end, -1);
424 editor_execute_syntax (se, begin, end);
427 /* Parse and execute the currently selected text */
429 on_run_selection (GtkMenuItem *menuitem, gpointer user_data)
431 GtkTextIter begin, end;
432 PsppireSyntaxWindow *se = PSPPIRE_SYNTAX_WINDOW (user_data);
434 if ( gtk_text_buffer_get_selection_bounds (se->buffer, &begin, &end) )
435 editor_execute_syntax (se, begin, end);
439 /* Parse and execute the from the current line, to the end of the
442 on_run_to_end (GtkMenuItem *menuitem, gpointer user_data)
444 GtkTextIter begin, end;
448 PsppireSyntaxWindow *se = PSPPIRE_SYNTAX_WINDOW (user_data);
450 /* Get the current line */
451 gtk_text_buffer_get_iter_at_mark (se->buffer,
453 gtk_text_buffer_get_insert (se->buffer)
456 line = gtk_text_iter_get_line (&here) ;
458 /* Now set begin and end to the start of this line, and end of buffer
460 gtk_text_buffer_get_iter_at_line (se->buffer, &begin, line);
461 gtk_text_buffer_get_iter_at_line (se->buffer, &end, -1);
463 editor_execute_syntax (se, begin, end);
468 /* Parse and execute the current line */
470 on_run_current_line (GtkMenuItem *menuitem, gpointer user_data)
472 GtkTextIter begin, end;
476 PsppireSyntaxWindow *se = PSPPIRE_SYNTAX_WINDOW (user_data);
478 /* Get the current line */
479 gtk_text_buffer_get_iter_at_mark (se->buffer,
481 gtk_text_buffer_get_insert (se->buffer)
484 line = gtk_text_iter_get_line (&here) ;
486 /* Now set begin and end to the start of this line, and start of
487 following line respectively */
488 gtk_text_buffer_get_iter_at_line (se->buffer, &begin, line);
489 gtk_text_buffer_get_iter_at_line (se->buffer, &end, line + 1);
491 editor_execute_syntax (se, begin, end);
496 /* Append ".sps" to FILENAME if necessary.
497 The returned result must be freed when no longer required.
500 append_suffix (const gchar *filename)
502 if ( ! g_str_has_suffix (filename, ".sps" ) &&
503 ! g_str_has_suffix (filename, ".SPS" ) )
505 return g_strdup_printf ("%s.sps", filename);
508 return xstrdup (filename);
512 Save BUFFER to the file called FILENAME.
513 FILENAME must be encoded in Glib filename encoding.
514 If successful, clears the buffer's modified flag.
517 save_editor_to_file (PsppireSyntaxWindow *se,
518 const gchar *filename,
521 GtkTextBuffer *buffer = se->buffer;
522 struct substring text_locale;
524 GtkTextIter start, stop;
530 suffixedname = append_suffix (filename);
532 gtk_text_buffer_get_iter_at_line (buffer, &start, 0);
533 gtk_text_buffer_get_iter_at_offset (buffer, &stop, -1);
535 text = gtk_text_buffer_get_text (buffer, &start, &stop, FALSE);
537 text_locale = recode_substring_pool (se->encoding, "UTF-8", ss_cstr (text),
540 result = g_file_set_contents (suffixedname, ss_data (text_locale),
541 ss_length (text_locale), err);
543 ss_dealloc (&text_locale);
544 g_free (suffixedname);
548 char *fn = g_filename_display_name (filename);
549 gchar *msg = g_strdup_printf (_("Saved file `%s'"), fn);
551 gtk_statusbar_push (GTK_STATUSBAR (se->sb), se->text_context, msg);
552 gtk_text_buffer_set_modified (buffer, FALSE);
560 /* PsppireWindow 'pick_Filename' callback. */
562 syntax_pick_filename (PsppireWindow *window)
564 PsppireSyntaxWindow *se = PSPPIRE_SYNTAX_WINDOW (window);
565 const char *default_encoding;
566 GtkFileFilter *filter;
570 gtk_file_chooser_dialog_new (_("Save Syntax"),
572 GTK_FILE_CHOOSER_ACTION_SAVE,
573 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
577 filter = gtk_file_filter_new ();
578 gtk_file_filter_set_name (filter, _("Syntax Files (*.sps) "));
579 gtk_file_filter_add_pattern (filter, "*.sps");
580 gtk_file_filter_add_pattern (filter, "*.SPS");
581 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
583 filter = gtk_file_filter_new ();
584 gtk_file_filter_set_name (filter, _("All Files"));
585 gtk_file_filter_add_pattern (filter, "*");
586 gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
588 gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
591 default_encoding = se->encoding != NULL ? se->encoding : locale_charset ();
592 gtk_file_chooser_set_extra_widget (
593 GTK_FILE_CHOOSER (dialog),
594 psppire_encoding_selector_new (default_encoding, false));
596 response = gtk_dialog_run (GTK_DIALOG (dialog));
598 if ( response == GTK_RESPONSE_ACCEPT )
603 filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog) );
604 psppire_window_set_filename (window, filename);
607 encoding = psppire_encoding_selector_get_encoding (
608 gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
609 if (encoding != NULL)
611 g_free (se->encoding);
612 se->encoding = encoding;
616 gtk_widget_destroy (dialog);
620 /* PsppireWindow 'save' callback. */
622 syntax_save (PsppireWindow *se)
624 const gchar *filename = psppire_window_get_filename (se);
626 save_editor_to_file (PSPPIRE_SYNTAX_WINDOW (se), filename, &err);
629 msg (ME, "%s", err->message);
635 /* Callback for the File->Quit menuitem */
637 on_quit (GtkMenuItem *menuitem, gpointer user_data)
646 create_syntax_window (void)
648 GtkWidget *w = psppire_syntax_window_new (NULL);
653 open_syntax_window (const char *file_name, const gchar *encoding)
655 GtkWidget *se = psppire_syntax_window_new (encoding);
657 if ( psppire_window_load (PSPPIRE_WINDOW (se), file_name) )
658 gtk_widget_show (se);
660 gtk_widget_destroy (se);
664 on_text_changed (GtkTextBuffer *buffer, PsppireSyntaxWindow *window)
666 gtk_statusbar_pop (GTK_STATUSBAR (window->sb), window->text_context);
670 on_modified_changed (GtkTextBuffer *buffer, PsppireWindow *window)
672 if (gtk_text_buffer_get_modified (buffer))
673 psppire_window_set_unsaved (window);
677 psppire_syntax_window_init (PsppireSyntaxWindow *window)
679 GtkBuilder *xml = builder_new ("syntax-editor.ui");
680 GtkWidget *box = gtk_vbox_new (FALSE, 0);
682 GtkWidget *menubar = get_widget_assert (xml, "menubar");
683 GtkWidget *sw = get_widget_assert (xml, "scrolledwindow8");
686 GtkWidget *text_view = get_widget_assert (xml, "syntax_text_view");
688 GtkClipboard *clip_selection = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
689 GtkClipboard *clip_primary = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_PRIMARY);
691 window->encoding = NULL;
693 window->cliptext = NULL;
694 window->dispose_has_run = FALSE;
696 window->edit_delete = get_action_assert (xml, "edit_delete");
697 window->edit_copy = get_action_assert (xml, "edit_copy");
698 window->edit_cut = get_action_assert (xml, "edit_cut");
699 window->edit_paste = get_action_assert (xml, "edit_paste");
701 window->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
703 window->sb = get_widget_assert (xml, "statusbar2");
704 window->text_context = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->sb), "Text Context");
706 g_signal_connect (window->buffer, "changed",
707 G_CALLBACK (on_text_changed), window);
709 g_signal_connect (window->buffer, "modified-changed",
710 G_CALLBACK (on_modified_changed), window);
712 window->sel_handler = g_signal_connect_swapped (clip_primary, "owner-change",
713 G_CALLBACK (selection_changed), window);
715 window->ps_handler = g_signal_connect (clip_selection, "owner-change",
716 G_CALLBACK (set_paste_sensitivity), window);
720 gtk_container_add (GTK_CONTAINER (window), box);
722 g_object_ref (menubar);
726 g_object_ref (window->sb);
728 gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0);
729 gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0);
730 gtk_box_pack_start (GTK_BOX (box), window->sb, FALSE, TRUE, 0);
732 gtk_widget_show_all (box);
734 g_signal_connect_swapped (get_action_assert (xml,"file_new_syntax"), "activate", G_CALLBACK (create_syntax_window), NULL);
736 g_signal_connect (get_action_assert (xml,"file_new_data"),
738 G_CALLBACK (create_data_window),
741 g_signal_connect_swapped (get_action_assert (xml, "file_open"),
743 G_CALLBACK (psppire_window_open),
746 g_signal_connect_swapped (get_action_assert (xml, "file_save"),
748 G_CALLBACK (psppire_window_save),
751 g_signal_connect_swapped (get_action_assert (xml, "file_save_as"),
753 G_CALLBACK (psppire_window_save_as),
756 g_signal_connect (get_action_assert (xml,"file_quit"),
758 G_CALLBACK (on_quit),
761 g_signal_connect_swapped (window->edit_delete,
763 G_CALLBACK (on_edit_delete),
766 g_signal_connect_swapped (window->edit_copy,
768 G_CALLBACK (on_edit_copy),
771 g_signal_connect_swapped (window->edit_cut,
773 G_CALLBACK (on_edit_cut),
776 g_signal_connect_swapped (window->edit_paste,
778 G_CALLBACK (on_edit_paste),
781 g_signal_connect (get_action_assert (xml,"run_all"),
783 G_CALLBACK (on_run_all),
786 g_signal_connect (get_action_assert (xml,"run_selection"),
788 G_CALLBACK (on_run_selection),
791 g_signal_connect (get_action_assert (xml,"run_current_line"),
793 G_CALLBACK (on_run_current_line),
796 g_signal_connect (get_action_assert (xml,"run_to_end"),
798 G_CALLBACK (on_run_to_end),
801 g_signal_connect (get_action_assert (xml,"windows_minimise_all"),
803 G_CALLBACK (psppire_window_minimise_all), NULL);
807 GtkUIManager *uim = GTK_UI_MANAGER (get_object_assert (xml, "uimanager1", GTK_TYPE_UI_MANAGER));
809 merge_help_menu (uim);
811 PSPPIRE_WINDOW (window)->menu =
812 GTK_MENU_SHELL (gtk_ui_manager_get_widget (uim,"/ui/menubar/windows/windows_minimise_all")->parent);
815 g_object_unref (xml);
823 psppire_syntax_window_new (const char *encoding)
825 return GTK_WIDGET (g_object_new (psppire_syntax_window_get_type (),
826 "description", _("Syntax Editor"),
827 "encoding", encoding,
832 error_dialog (GtkWindow *w, const gchar *filename, GError *err)
834 gchar *fn = g_filename_display_basename (filename);
837 gtk_message_dialog_new (w,
838 GTK_DIALOG_DESTROY_WITH_PARENT,
841 _("Cannot load syntax file `%s'"),
846 g_object_set (dialog, "icon-name", "psppicon", NULL);
848 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
851 gtk_dialog_run (GTK_DIALOG (dialog));
853 gtk_widget_destroy (dialog);
857 Loads the buffer from the file called FILENAME
860 syntax_load (PsppireWindow *window, const gchar *filename)
863 gchar *text_locale = NULL;
864 gchar *text_utf8 = NULL;
865 gsize len_locale = -1;
868 PsppireSyntaxWindow *sw = PSPPIRE_SYNTAX_WINDOW (window);
872 /* FIXME: What if it's a very big file ? */
873 if ( ! g_file_get_contents (filename, &text_locale, &len_locale, &err) )
875 error_dialog (GTK_WINDOW (window), filename, err);
876 g_clear_error (&err);
880 /* Determine the file's encoding and update sw->encoding. (The ordering is
881 important here because encoding_guess_whole_file() often returns its
882 argument instead of a copy of it.) */
883 encoding = g_strdup (encoding_guess_whole_file (sw->encoding, text_locale,
885 g_free (sw->encoding);
886 sw->encoding = encoding;
888 text_utf8 = recode_substring_pool ("UTF-8", encoding,
889 ss_buffer (text_locale, len_locale),
893 gtk_text_buffer_get_iter_at_line (sw->buffer, &iter, 0);
895 gtk_text_buffer_insert (sw->buffer, &iter, text_utf8, len_utf8);
897 gtk_text_buffer_set_modified (sw->buffer, FALSE);
901 mime_type = xasprintf ("text/x-spss-syntax; charset=%s", sw->encoding);
902 add_most_recent (filename, mime_type);
911 psppire_syntax_window_iface_init (PsppireWindowIface *iface)
913 iface->save = syntax_save;
914 iface->pick_filename = syntax_pick_filename;
915 iface->load = syntax_load;