changeset 57940:a3fa0e63dd67

* gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if it doesn't start with /.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 04 Nov 2004 14:18:22 +0000
parents 35cb9a370d9e
children 68ea73fe257b
files src/ChangeLog src/gtkutil.c
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Nov 04 10:23:45 2004 +0000
+++ b/src/ChangeLog	Thu Nov 04 14:18:22 2004 +0000
@@ -1,3 +1,8 @@
+2004-11-04  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if
+	it doesn't start with /.
+
 2004-11-04  Kenichi Handa  <handa@m17n.org>
 
 	* fontset.c (fontset_pattern_regexp): If '*' is preceded by '\',
--- a/src/gtkutil.c	Thu Nov 04 10:23:45 2004 +0000
+++ b/src/gtkutil.c	Thu Nov 04 14:18:22 2004 +0000
@@ -1178,8 +1178,24 @@
 
 
   if (default_filename)
-    gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
-                                   default_filename);
+    {
+      Lisp_Object file;
+      struct gcpro gcpro1;
+      GCPRO1 (file);
+
+      /* File chooser does not understand ~/... in the file name.  It must be
+         an absolute name starting with /.  */
+      if (default_filename[0] != '/')
+        {
+          file = Fexpand_file_name (build_string (default_filename), Qnil);
+          default_filename = SDATA (file);
+        }
+
+      gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
+                                     default_filename);
+
+      UNGCPRO;
+    }
 
   gtk_widget_show (filewin);