diff options
| author | Jan Djärv | 2004-11-02 08:21:16 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-11-02 08:21:16 +0000 |
| commit | f9d64bb358607b8bb771c5d61eccaea2859d3e5f (patch) | |
| tree | c94b0355ad29207ff09e565c5b613901380ac14c /src/w32fns.c | |
| parent | 46bfc73bed2e2b6b3cdfff43f82c6705fb89355c (diff) | |
| download | emacs-f9d64bb358607b8bb771c5d61eccaea2859d3e5f.tar.gz emacs-f9d64bb358607b8bb771c5d61eccaea2859d3e5f.zip | |
* 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.
Diffstat (limited to 'src/w32fns.c')
| -rw-r--r-- | src/w32fns.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 38faa7c3199..41bd6a9b9f9 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -7742,23 +7742,24 @@ file_dialog_callback (hwnd, msg, wParam, lParam) | |||
| 7742 | return 0; | 7742 | return 0; |
| 7743 | } | 7743 | } |
| 7744 | 7744 | ||
| 7745 | DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, | 7745 | DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, |
| 7746 | doc: /* Read file name, prompting with PROMPT in directory DIR. | 7746 | doc: /* Read file name, prompting with PROMPT in directory DIR. |
| 7747 | Use a file selection dialog. | 7747 | Use a file selection dialog. |
| 7748 | Select DEFAULT-FILENAME in the dialog's file selection box, if | 7748 | Select DEFAULT-FILENAME in the dialog's file selection box, if |
| 7749 | specified. Ensure that file exists if MUSTMATCH is non-nil. */) | 7749 | specified. Ensure that file exists if MUSTMATCH is non-nil. |
| 7750 | (prompt, dir, default_filename, mustmatch) | 7750 | If ONLY-DIR-P is non-nil, the user can only select directories. */) |
| 7751 | Lisp_Object prompt, dir, default_filename, mustmatch; | 7751 | (prompt, dir, default_filename, mustmatch, only_dir_p) |
| 7752 | Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; | ||
| 7752 | { | 7753 | { |
| 7753 | struct frame *f = SELECTED_FRAME (); | 7754 | struct frame *f = SELECTED_FRAME (); |
| 7754 | Lisp_Object file = Qnil; | 7755 | Lisp_Object file = Qnil; |
| 7755 | int count = SPECPDL_INDEX (); | 7756 | int count = SPECPDL_INDEX (); |
| 7756 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 7757 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 7757 | char filename[MAX_PATH + 1]; | 7758 | char filename[MAX_PATH + 1]; |
| 7758 | char init_dir[MAX_PATH + 1]; | 7759 | char init_dir[MAX_PATH + 1]; |
| 7759 | int default_filter_index = 1; /* 1: All Files, 2: Directories only */ | 7760 | int default_filter_index = 1; /* 1: All Files, 2: Directories only */ |
| 7760 | 7761 | ||
| 7761 | GCPRO5 (prompt, dir, default_filename, mustmatch, file); | 7762 | GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); |
| 7762 | CHECK_STRING (prompt); | 7763 | CHECK_STRING (prompt); |
| 7763 | CHECK_STRING (dir); | 7764 | CHECK_STRING (dir); |
| 7764 | 7765 | ||
| @@ -7806,10 +7807,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) | |||
| 7806 | file_details.lpstrInitialDir = init_dir; | 7807 | file_details.lpstrInitialDir = init_dir; |
| 7807 | file_details.lpstrTitle = SDATA (prompt); | 7808 | file_details.lpstrTitle = SDATA (prompt); |
| 7808 | 7809 | ||
| 7809 | /* If prompt starts with Dired, default to directories only. */ | 7810 | if (! NILP (only_dir_p)) |
| 7810 | /* A bit hacky, but there doesn't seem to be a better way to | ||
| 7811 | DTRT for dired. */ | ||
| 7812 | if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0) | ||
| 7813 | default_filter_index = 2; | 7811 | default_filter_index = 2; |
| 7814 | 7812 | ||
| 7815 | file_details.nFilterIndex = default_filter_index; | 7813 | file_details.nFilterIndex = default_filter_index; |