pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src/ui/gui data-editor.c data-editor.h win...


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui/gui data-editor.c data-editor.h win...
Date: Thu, 25 Jan 2007 08:18:57 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/01/25 08:18:57

Modified files:
        src/ui/gui     : data-editor.c data-editor.h window-manager.c 
                         window-manager.h 

Log message:
        Fixed buglet in file open action.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.h?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/window-manager.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/window-manager.h?cvsroot=pspp&r1=1.3&r2=1.4

Patches:
Index: data-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- data-editor.c       24 Jan 2007 08:30:22 -0000      1.13
+++ data-editor.c       25 Jan 2007 08:18:57 -0000      1.14
@@ -828,7 +828,7 @@
 
 static void data_save_as_dialog (GtkAction *, struct data_editor *de);
 static void new_file (GtkAction *, struct editor_window *de);
-static void open_data_dialog (GtkAction *, struct editor_window *de);
+static void open_data_dialog (GtkAction *, struct data_editor *de);
 static void data_save (GtkAction *action, struct data_editor *e);
 
 
@@ -1033,11 +1033,13 @@
 /* Callback for the data_open action.
    Prompts for a filename and opens it */
 static void
-open_data_dialog (GtkAction *action, struct editor_window *de)
+open_data_dialog (GtkAction *action, struct data_editor *de)
 {
+  struct editor_window *e = (struct editor_window *) de;
+
   GtkWidget *dialog =
     gtk_file_chooser_dialog_new (_("Open"),
-                                GTK_WINDOW (de->window),
+                                GTK_WINDOW (e->window),
                                 GTK_FILE_CHOOSER_ACTION_OPEN,
                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@@ -1065,16 +1067,15 @@
     case GTK_RESPONSE_ACCEPT:
       {
        struct getl_interface *sss;
-       gchar *file_name =
+       g_free (de->file_name);
+       de->file_name =
          gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 
-       sss = create_syntax_string_source ("GET FILE='%s'.", file_name);
+       sss = create_syntax_string_source ("GET FILE='%s'.", de->file_name);
 
        execute_syntax (sss);
 
-       window_set_name_from_filename (de, file_name);
-
-       g_free (file_name);
+       window_set_name_from_filename (e, de->file_name);
       }
       break;
     default:

Index: data-editor.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- data-editor.h       24 Jan 2007 08:30:22 -0000      1.4
+++ data-editor.h       25 Jan 2007 08:18:57 -0000      1.5
@@ -39,6 +39,10 @@
   GladeXML *xml;
 
   gboolean save_as_portable;
+
+  /* Name of the file this data is associated with (ie, was loaded from or
+     has been  saved to), in "filename encoding",  or NULL, if it's not
+     associated with any file */
   gchar *file_name;
 };
 

Index: window-manager.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/window-manager.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- window-manager.c    24 Jan 2007 08:30:22 -0000      1.6
+++ window-manager.c    25 Jan 2007 08:18:57 -0000      1.7
@@ -123,11 +123,12 @@
   gchar *title ;
   g_free (e->name);
 
+  e->name = NULL;
 
   if ( name )
     {
       e->name = g_strdup (name);
-      return ;
+      return;
     }
 
   switch (e->type )
@@ -150,6 +151,8 @@
 }
 
 
+/* Set the name of this window based on FILENAME.
+   FILENAME is in "filename encoding" */
 void
 window_set_name_from_filename (struct editor_window *e,
                               const gchar *filename)

Index: window-manager.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/window-manager.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- window-manager.h    24 Jan 2007 08:30:22 -0000      1.3
+++ window-manager.h    25 Jan 2007 08:18:57 -0000      1.4
@@ -13,7 +13,7 @@
 struct editor_window
  {
   GtkWindow *window;      /* The top level window of the editor */
-  gchar *name;            /* The name of this editor */
+  gchar *name;            /* The name of this editor (UTF-8) */
   enum window_type type;
  } ;
 
@@ -22,6 +22,8 @@
 
 const gchar * window_name (const struct editor_window *);
 
+/* Set the name of this window based on FILENAME.
+   FILENAME is in "filename encoding" */
 void window_set_name_from_filename (struct editor_window *e,
                                    const gchar *filename);
 




reply via email to

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