pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui/gui ChangeLog data-editor.c helper....


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui/gui ChangeLog data-editor.c helper....
Date: Thu, 06 Sep 2007 07:43:02 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/09/06 07:43:02

Modified files:
        src/ui/gui     : ChangeLog data-editor.c helper.c helper.h 
                         syntax-editor.c 

Log message:
        Fixed buglet managing entries in the recent files lists.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.c?cvsroot=pspp&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/helper.c?cvsroot=pspp&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/helper.h?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor.c?cvsroot=pspp&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- ChangeLog   25 Aug 2007 10:04:03 -0000      1.83
+++ ChangeLog   6 Sep 2007 07:43:02 -0000       1.84
@@ -1,3 +1,13 @@
+2007-09-06  John Darrington <address@hidden>
+       
+       * helper.c helper.h (execute_syntax): changed return type to 
+       gboolean to indicated if all the syntax executed successfully or not.
+
+       * data-editor.c syntax-editor.c: Fixed update of recent file list
+       and window title,  on data_file_open.  They now only change, if
+       the file_open was  successfull. 
+
+
 2007-08-25  John Darrington <address@hidden>
 
        * psppire.c : Enable journal.

Index: data-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- data-editor.c       2 Sep 2007 02:10:28 -0000       1.48
+++ data-editor.c       6 Sep 2007 07:43:02 -0000       1.49
@@ -47,6 +47,7 @@
 #include "data-editor.h"
 #include "syntax-editor.h"
 #include <language/syntax-string-source.h>
+#include <language/command.h>
 #include <libpspp/syntax-gen.h>
 #include "window-manager.h"
 
@@ -160,6 +161,27 @@
 static void open_data_file (const gchar *, struct data_editor *);
 
 
+/* Puts FILE_NAME into the recent list.
+   If it's already in the list, it moves it to the top
+*/
+static void
+add_most_recent (const char *file_name)
+{
+#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);
+#endif
+}
+
+
 
 #if RECENT_LISTS_AVAILABLE
 
@@ -1492,14 +1514,17 @@
 
   sss = create_syntax_string_source ("GET FILE=%s.",
                                     ds_cstr (&filename));
-
-  execute_syntax (sss);
   ds_destroy (&filename);
 
+  if (execute_syntax (sss) )
+  {
   window_set_name_from_filename ((struct editor_window *) de, file_name);
+    add_most_recent (file_name);
+  }
 }
 
 
+
 /* Callback for the data_open action.
    Prompts for a filename and opens it */
 static void
@@ -1550,19 +1575,6 @@
          gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 
        open_data_file (de->file_name, de);
-
-#if RECENT_LISTS_AVAILABLE
-       {
-         GtkRecentManager *manager = gtk_recent_manager_get_default();
-         gchar *uri = g_filename_to_uri (de->file_name, NULL, NULL);
-
-         if ( ! gtk_recent_manager_add_item (manager, uri))
-           g_warning ("Could not add item %s to recent list\n",uri);
-
-         g_free (uri);
-       }
-#endif
-
       }
       break;
     default:

Index: helper.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/helper.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- helper.c    5 Sep 2007 06:23:03 -0000       1.26
+++ helper.c    6 Sep 2007 07:43:02 -0000       1.27
@@ -165,16 +165,17 @@
 extern struct source_stream *the_source_stream;
 extern PsppireDataStore *the_data_store;
 
-void
+gboolean
 execute_syntax (struct getl_interface *sss)
 {
   struct lexer *lexer;
+  gboolean retval = TRUE;
 
   struct casereader *reader = psppire_data_store_get_reader (the_data_store);
 
   proc_set_active_file_data (the_dataset, reader);
 
-  g_return_if_fail (proc_has_active_file (the_dataset));
+  g_return_val_if_fail (proc_has_active_file (the_dataset), FALSE);
 
   lexer = lex_create (the_source_stream);
 
@@ -182,9 +183,17 @@
 
   for (;;)
     {
-      int result = cmd_parse (lexer, the_dataset);
+      enum cmd_result result = cmd_parse (lexer, the_dataset);
+
+      if ( cmd_result_is_failure (result))
+       {
+         retval = FALSE;
+         if ( source_stream_current_error_mode (the_source_stream)
+              == ERRMODE_STOP )
+           break;
+       }
 
-      if (result == CMD_EOF || result == CMD_FINISH)
+      if ( result == CMD_EOF || result == CMD_FINISH)
        break;
     }
 
@@ -206,6 +215,8 @@
   som_flush ();
 
   reload_the_viewer ();
+
+  return retval;
 }
 
 

Index: helper.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/helper.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- helper.h    26 Jul 2007 02:02:23 -0000      1.16
+++ helper.h    6 Sep 2007 07:43:02 -0000       1.17
@@ -26,7 +26,6 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
-
 /*
    GtkRecentChooserMenu was added in 2.10.0
    but it didn't support GtkRecentFilters until
@@ -54,8 +53,7 @@
 void reference_manual (GtkMenuItem *, gpointer);
 
 struct getl_interface;
-void execute_syntax (struct getl_interface *sss);
-
+gboolean execute_syntax (struct getl_interface *sss);
 
 #define XML_NEW(FILE) \
    glade_xml_new (relocate(PKGDATADIR "/" FILE), NULL, NULL)

Index: syntax-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/syntax-editor.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- syntax-editor.c     7 Jul 2007 06:14:30 -0000       1.19
+++ syntax-editor.c     6 Sep 2007 07:43:02 -0000       1.20
@@ -490,8 +490,6 @@
   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);
 
@@ -535,18 +533,20 @@
       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
 
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]