changeset 58817:65f1b18b7f66

* gtkutil.c (xg_get_file_with_chooser): Handle local files only. Set current folder in file chooser if default_filename is a directory.
author Jan Djärv <jan.h.d@swipnet.se>
date Tue, 07 Dec 2004 08:09:10 +0000
parents b392b0c22a16
children f8cddae7d959
files src/ChangeLog src/gtkutil.c
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Dec 07 05:09:11 2004 +0000
+++ b/src/ChangeLog	Tue Dec 07 08:09:10 2004 +0000
@@ -1,3 +1,9 @@
+2004-12-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_get_file_with_chooser): Handle local files only.
+	Set current folder in file chooser if default_filename is a
+	directory.
+
 2004-12-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* regex.c (GET_UNSIGNED_NUMBER): Signal an error when reaching the end.
--- a/src/gtkutil.c	Tue Dec 07 05:09:11 2004 +0000
+++ b/src/gtkutil.c	Tue Dec 07 08:09:10 2004 +0000
@@ -1200,6 +1200,7 @@
                                           GTK_STOCK_OPEN : GTK_STOCK_OK),
                                          GTK_RESPONSE_OK,
                                          NULL);
+  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
 
   if (default_filename)
     {
@@ -1207,16 +1208,20 @@
       struct gcpro gcpro1;
       GCPRO1 (file);
 
+      file = build_string (default_filename);
+
       /* 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);
+        file = Fexpand_file_name (file, Qnil);
+
+      default_filename = SDATA (file);
+      if (Ffile_directory_p (file))
+        gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin),
+                                             default_filename);
+      else
+        gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
+                                       default_filename);
 
       UNGCPRO;
     }