From 90f2e16b151bc42305f352ab3bfcb25429125179 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Fri, 23 Dec 2005 11:34:13 +0000 Subject: [PATCH] * xfns.c (Fx_uses_old_gtk_dialog): New function. * gtkutil.c (xg_uses_old_file_dialog): New function. (xg_get_file_name): Use xg_uses_old_file_dialog. * gtkutil.h: Declare xg_uses_old_file_dialog. --- src/ChangeLog | 9 +++++++++ src/gtkutil.c | 24 ++++++++++++++++++++++-- src/gtkutil.h | 2 ++ src/xfns.c | 22 +++++++++++++++++++++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 39af44aeae0..5e5fa3d62c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-12-23 Jan Dj,Ad(Brv + + * xfns.c (Fx_uses_old_gtk_dialog): New function. + + * gtkutil.c (xg_uses_old_file_dialog): New function. + (xg_get_file_name): Use xg_uses_old_file_dialog. + + * gtkutil.h: Declare xg_uses_old_file_dialog. + 2005-12-22 Richard M. Stallman * xmenu.c (xmenu_show): Call inhibit_garbage_collection. diff --git a/src/gtkutil.c b/src/gtkutil.c index 54cb43b8398..9da3c5bf457 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1155,6 +1155,27 @@ create_dialog (wv, select_cb, deactivate_cb) /*********************************************************************** File dialog functions ***********************************************************************/ +/* Return non-zero if the old file selection dialog is being used. + Return zero if not. */ + +int +xg_uses_old_file_dialog () +{ +#ifdef HAVE_GTK_FILE_BOTH + extern int x_use_old_gtk_file_dialog; + return x_use_old_gtk_file_dialog; +#else /* ! HAVE_GTK_FILE_BOTH */ + +#ifdef HAVE_GTK_FILE_SELECTION_NEW + return 1; +#else + return 0; +#endif + +#endif /* ! HAVE_GTK_FILE_BOTH */ +} + + /* Function that is called when the file dialog pops down. W is the dialog widget, RESPONSE is the response code. USER_DATA is what we passed in to g_signal_connect (pointer to int). */ @@ -1343,7 +1364,6 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) char *fn = 0; int filesel_done = 0; xg_get_file_func func; - extern int x_use_old_gtk_file_dialog; #if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) /* I really don't know why this is needed, but without this the GLIBC add on @@ -1354,7 +1374,7 @@ xg_get_file_name (f, prompt, default_filename, mustmatch_p, only_dir_p) #ifdef HAVE_GTK_FILE_BOTH - if (x_use_old_gtk_file_dialog) + if (xg_uses_old_file_dialog ()) w = xg_get_file_with_selection (f, prompt, default_filename, mustmatch_p, only_dir_p, &func); else diff --git a/src/gtkutil.h b/src/gtkutil.h index aea4ee9e7cf..6b9fd179ec5 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -132,6 +132,8 @@ extern int use_old_gtk_file_dialog; extern widget_value *malloc_widget_value P_ ((void)); extern void free_widget_value P_ ((widget_value *)); +extern int xg_uses_old_file_dialog P_ ((void)); + extern char *xg_get_file_name P_ ((FRAME_PTR f, char *prompt, char *default_filename, diff --git a/src/xfns.c b/src/xfns.c index 52cb99d9ad3..8cea134c1ff 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5236,8 +5236,27 @@ Value is t if tooltip was open, nil otherwise. */) File selection dialog ***********************************************************************/ -#ifdef USE_MOTIF +DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, + Sx_uses_old_gtk_dialog, + 0, 0, 0, + doc: /* Return t if the old Gtk+ file selection dialog is used. */) + () +{ +#ifdef USE_GTK + extern int use_dialog_box; + extern int use_file_dialog; + if (use_dialog_box + && use_file_dialog + && have_menus_p () + && xg_uses_old_file_dialog ()) + return Qt; +#endif + return Qnil; +} + + +#ifdef USE_MOTIF /* Callback for "OK" and "Cancel" on file selection dialog. */ static void @@ -5857,6 +5876,7 @@ variable `use-file-dialog'. */); last_show_tip_args = Qnil; staticpro (&last_show_tip_args); + defsubr (&Sx_uses_old_gtk_dialog); #if defined (USE_MOTIF) || defined (USE_GTK) defsubr (&Sx_file_dialog); #endif -- 2.39.5