]> git.eshelyaron.com Git - emacs.git/commitdiff
* gtkutil.c (xg_get_file_with_chooser): Handle local files only.
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 7 Dec 2004 08:09:10 +0000 (08:09 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 7 Dec 2004 08:09:10 +0000 (08:09 +0000)
Set current folder in file chooser if default_filename is a
directory.

src/ChangeLog
src/gtkutil.c

index 17dc673c681b971de4ebd32223941c7b0ef6f10b..2aaac0d9f723e6d0ac5f1dcb14c8fc909be296b0 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-07  Jan Dj\e,Ad\e(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.
index 759877f39502a626fcfe0dabe3ca97bf9affee24..0983724f95f4801c39b67ad269466ddf92e6bb70 100644 (file)
@@ -1200,6 +1200,7 @@ xg_get_file_with_chooser (f, prompt, default_filename,
                                           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 @@ xg_get_file_with_chooser (f, prompt, default_filename,
       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);
-        }
+        file = Fexpand_file_name (file, Qnil);
 
-      gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
-                                     default_filename);
+      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;
     }