From: Jan Djärv Date: Tue, 7 Dec 2004 08:09:10 +0000 (+0000) Subject: * gtkutil.c (xg_get_file_with_chooser): Handle local files only. X-Git-Tag: ttn-vms-21-2-B4~3395 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ded997c16032a6c658e345452d7e5ec275c0642e;p=emacs.git * gtkutil.c (xg_get_file_with_chooser): Handle local files only. Set current folder in file chooser if default_filename is a directory. --- diff --git a/src/ChangeLog b/src/ChangeLog index 17dc673c681..2aaac0d9f72 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2004-12-07 Jan Dj,Ad(Brv + + * 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 * regex.c (GET_UNSIGNED_NUMBER): Signal an error when reaching the end. diff --git a/src/gtkutil.c b/src/gtkutil.c index 759877f3950..0983724f95f 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -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; }