Mercurial > emacs
diff src/w32fns.c @ 57868:c955f6add62a
* fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Fx_file_dialog if only directories should be read.
* lisp.h: Fx_file_dialog takes 5 parameters.
* xfns.c (Fx_file_dialog): Both Motif and GTK version: Add
parameter only_dir_p.
In Motif version, don't put DEFAULT_FILENAME in filter part of the
dialog, just text field part. Do not add DEFAULT_FILENAME
to list of files if it isn't there.
In GTK version, pass only_dir_p parameter to xg_get_file_name.
* macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check
only_dir_p instead of comparing prompt to "Dired". When using
a save dialog, add option kNavDontConfirmReplacement, change title
to "Enter name", change text for save button to "Ok".
* w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check
only_dir_p instead of comparing prompt to "Dired".
* gtkutil.c (xg_get_file_with_chooser)
(xg_get_file_with_selection): New functions, only defined ifdef
HAVE_GTK_FILE_CHOOSER_DIALOG_NEW and HAVE_GTK_FILE_SELECTION_NEW
respectively.
(xg_get_file_name): Add parameter only_dir_p.
Call xg_get_file_with_chooser or xg_get_file_with_selection
depending on HAVE_GTK_FILE* and the value of use_old_gtk_file_dialog.
(xg_initialize): New DEFVAR_BOOL use_old_gtk_file_dialog.
* gtkutil.h (xg_get_file_name): Add parameter only_dir_p.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Tue, 02 Nov 2004 08:21:16 +0000 |
parents | 77c93cbb1721 |
children | 71ea49de0560 |
line wrap: on
line diff
--- a/src/w32fns.c Tue Nov 02 07:57:53 2004 +0000 +++ b/src/w32fns.c Tue Nov 02 08:21:16 2004 +0000 @@ -7742,23 +7742,24 @@ return 0; } -DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, +DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if -specified. Ensure that file exists if MUSTMATCH is non-nil. */) - (prompt, dir, default_filename, mustmatch) - Lisp_Object prompt, dir, default_filename, mustmatch; +specified. Ensure that file exists if MUSTMATCH is non-nil. +If ONLY-DIR-P is non-nil, the user can only select directories. */) + (prompt, dir, default_filename, mustmatch, only_dir_p) + Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; { struct frame *f = SELECTED_FRAME (); Lisp_Object file = Qnil; int count = SPECPDL_INDEX (); - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char filename[MAX_PATH + 1]; char init_dir[MAX_PATH + 1]; int default_filter_index = 1; /* 1: All Files, 2: Directories only */ - GCPRO5 (prompt, dir, default_filename, mustmatch, file); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); CHECK_STRING (prompt); CHECK_STRING (dir); @@ -7806,10 +7807,7 @@ file_details.lpstrInitialDir = init_dir; file_details.lpstrTitle = SDATA (prompt); - /* If prompt starts with Dired, default to directories only. */ - /* A bit hacky, but there doesn't seem to be a better way to - DTRT for dired. */ - if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0) + if (! NILP (only_dir_p)) default_filter_index = 2; file_details.nFilterIndex = default_filter_index;