X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fsyntax-editor.c;h=35749fcd4a6f7e03cb511e5dbca871ce16e59190;hb=65190c89174ad703a008c89bfc70154dff12def0;hp=469ee4f6983b9940b3ae639d9f2df74a829f38a9;hpb=8f157150f5fe225224e407161fb7f899d34b8b18;p=pspp diff --git a/src/ui/gui/syntax-editor.c b/src/ui/gui/syntax-editor.c index 469ee4f698..35749fcd4a 100644 --- a/src/ui/gui/syntax-editor.c +++ b/src/ui/gui/syntax-editor.c @@ -1,21 +1,18 @@ -/* - PSPPIRE --- A Graphical User Interface for PSPP - Copyright (C) 2006 Free Software Foundation +/* PSPPIRE - a graphical user interface for PSPP. + Copyright (C) 2006 Free Software Foundation, Inc. - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include #include @@ -78,7 +75,7 @@ save_if_modified (struct syntax_editor *se) GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Save contents of syntax editor to %s?"), - e->name + e->name ); gtk_dialog_add_button (GTK_DIALOG (dialog), @@ -308,8 +305,7 @@ on_run_to_end (GtkMenuItem *menuitem, gpointer user_data) struct syntax_editor * new_syntax_editor (void) { - GladeXML *xml = - glade_xml_new (PKGDATADIR "/syntax-editor.glade", NULL, NULL); + GladeXML *xml = XML_NEW ("syntax-editor.glade"); GtkWidget *text_view; struct syntax_editor *se ; @@ -341,12 +337,6 @@ new_syntax_editor (void) G_CALLBACK (new_data_window), e->window); - g_signal_connect (get_widget_assert (xml,"file_open_data"), - "activate", - G_CALLBACK (open_data_window), - e->window); - - g_signal_connect (get_widget_assert (xml,"help_about"), "activate", G_CALLBACK (about_new), @@ -473,7 +463,7 @@ save_editor_to_file (struct syntax_editor *se, /* Loads the buffer from the file called FILENAME */ -static gboolean +gboolean load_editor_from_file (struct syntax_editor *se, const gchar *filename, GError **err) @@ -499,6 +489,7 @@ load_editor_from_file (struct syntax_editor *se, gtk_text_buffer_insert (buffer, &iter, text, -1); + window_set_name_from_filename ((struct editor_window *)se, filename); gtk_text_buffer_set_modified (buffer, FALSE); @@ -542,7 +533,22 @@ open_syntax_window (GtkMenuItem *menuitem, gpointer parent) struct syntax_editor *se = (struct syntax_editor *) window_create (WINDOW_SYNTAX, file_name); - load_editor_from_file (se, file_name, NULL); + if ( load_editor_from_file (se, file_name, NULL) ) +#if RECENT_LISTS_AVAILABLE + { + GtkRecentManager *manager = gtk_recent_manager_get_default(); + gchar *uri = g_filename_to_uri (file_name, NULL, NULL); + + gtk_recent_manager_remove_item (manager, uri, NULL); + if ( ! gtk_recent_manager_add_item (manager, uri)) + g_warning ("Could not add item %s to recent list\n",uri); + + g_free (uri); + } +#else + ; +#endif + } gtk_widget_destroy (dialog);