X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-syntax-window.c;h=48e1ea44fe73d3873c4631d6e5b4bc06311e4636;hb=aca5e0c21bb5f2cc509ea1fb0ec5ba5be4faaf7d;hp=48a77fc03ec21a7fa3f9cfc4a3ddc6cceedb3c4f;hpb=b5c82cc9aabe7e641011130240ae1b2e84348e23;p=pspp diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 48a77fc03e..48e1ea44fe 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008, 2009 Free Software Foundation + Copyright (C) 2008, 2009, 2010 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 @@ -311,7 +311,7 @@ syntax_save_as (PsppireWindow *se) if ( ! save_editor_to_file (PSPPIRE_SYNTAX_WINDOW (se), filename, &err) ) { - msg ( ME, err->message ); + msg ( ME, "%s", err->message ); g_error_free (err); } @@ -336,7 +336,7 @@ syntax_save (PsppireWindow *se) save_editor_to_file (PSPPIRE_SYNTAX_WINDOW (se), filename, &err); if ( err ) { - msg (ME, err->message); + msg (ME, "%s", err->message); g_error_free (err); } } @@ -360,51 +360,17 @@ create_syntax_window (void) gtk_widget_show (w); } -/* Callback for the File->Open->Syntax menuitem */ void -open_syntax_window (GtkMenuItem *menuitem, gpointer parent) +open_syntax_window (const char *file_name) { - GtkFileFilter *filter; - gint response; - - GtkWidget *dialog = - gtk_file_chooser_dialog_new (_("Open Syntax"), - GTK_WINDOW (parent), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("Syntax Files (*.sps) ")); - gtk_file_filter_add_pattern (filter, "*.sps"); - gtk_file_filter_add_pattern (filter, "*.SPS"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + GtkWidget *se = psppire_syntax_window_new (); - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("All Files")); - gtk_file_filter_add_pattern (filter, "*"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - - if (response == GTK_RESPONSE_ACCEPT) - { - const char *file_name = gtk_file_chooser_get_filename - (GTK_FILE_CHOOSER (dialog)); - - GtkWidget *se = psppire_syntax_window_new (); - - if ( psppire_window_load (PSPPIRE_WINDOW (se), file_name) ) - gtk_widget_show (se); - else - gtk_widget_destroy (se); - } - - gtk_widget_destroy (dialog); + if ( psppire_window_load (PSPPIRE_WINDOW (se), file_name) ) + gtk_widget_show (se); + else + gtk_widget_destroy (se); } - static void on_text_changed (GtkTextBuffer *buffer, PsppireSyntaxWindow *window) { @@ -464,11 +430,6 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) G_CALLBACK (create_syntax_window), NULL); - g_signal_connect (get_action_assert (xml,"file_open_syntax"), - "activate", - G_CALLBACK (open_syntax_window), - window); - #if 0 g_signal_connect (get_action_assert (xml,"file_new_data"), "activate", @@ -570,7 +531,7 @@ error_dialog (GtkWindow *w, const gchar *filename, GError *err) g_object_set (dialog, "icon-name", "psppicon", NULL); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - err->message); + "%s", err->message); gtk_dialog_run (GTK_DIALOG (dialog)); @@ -580,7 +541,7 @@ error_dialog (GtkWindow *w, const gchar *filename, GError *err) /* Loads the buffer from the file called FILENAME */ -static gboolean +gboolean syntax_load (PsppireWindow *window, const gchar *filename) { GError *err = NULL;