Mercurial > emacs
comparison src/gtkutil.c @ 90054:f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709
Update from CVS: src/indent.c (Fvertical_motion): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 08 Dec 2004 05:02:30 +0000 |
parents | b637c617432f f8cddae7d959 |
children | 95879cc1ed20 |
comparison
equal
deleted
inserted
replaced
90053:fff5f1a61d92 | 90054:f2ebccfa87d4 |
---|---|
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 | 23 |
24 #ifdef USE_GTK | 24 #ifdef USE_GTK |
25 #include <string.h> | 25 #include <string.h> |
26 #include <signal.h> | |
26 #include <stdio.h> | 27 #include <stdio.h> |
27 #include "lisp.h" | 28 #include "lisp.h" |
28 #include "xterm.h" | 29 #include "xterm.h" |
29 #include "blockinput.h" | 30 #include "blockinput.h" |
31 #include "syssignal.h" | |
30 #include "window.h" | 32 #include "window.h" |
31 #include "atimer.h" | 33 #include "atimer.h" |
32 #include "gtkutil.h" | 34 #include "gtkutil.h" |
33 #include "termhooks.h" | 35 #include "termhooks.h" |
34 #include "keyboard.h" | 36 #include "keyboard.h" |
1120 | 1122 |
1121 | 1123 |
1122 /*********************************************************************** | 1124 /*********************************************************************** |
1123 File dialog functions | 1125 File dialog functions |
1124 ***********************************************************************/ | 1126 ***********************************************************************/ |
1125 #ifdef HAVE_GTK_FILE_BOTH | |
1126 int use_old_gtk_file_dialog; | |
1127 #endif | |
1128 | |
1129 /* Function that is called when the file dialog pops down. | 1127 /* Function that is called when the file dialog pops down. |
1130 W is the dialog widget, RESPONSE is the response code. | 1128 W is the dialog widget, RESPONSE is the response code. |
1131 USER_DATA is what we passed in to g_signal_connect (pointer to int). */ | 1129 USER_DATA is what we passed in to g_signal_connect (pointer to int). */ |
1132 | 1130 |
1133 static void | 1131 static void |
1202 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | 1200 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
1203 (mustmatch_p || only_dir_p ? | 1201 (mustmatch_p || only_dir_p ? |
1204 GTK_STOCK_OPEN : GTK_STOCK_OK), | 1202 GTK_STOCK_OPEN : GTK_STOCK_OK), |
1205 GTK_RESPONSE_OK, | 1203 GTK_RESPONSE_OK, |
1206 NULL); | 1204 NULL); |
1205 gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE); | |
1207 | 1206 |
1208 if (default_filename) | 1207 if (default_filename) |
1209 { | 1208 { |
1210 Lisp_Object file; | 1209 Lisp_Object file; |
1211 struct gcpro gcpro1; | 1210 struct gcpro gcpro1; |
1212 GCPRO1 (file); | 1211 GCPRO1 (file); |
1213 | 1212 |
1213 file = build_string (default_filename); | |
1214 | |
1214 /* File chooser does not understand ~/... in the file name. It must be | 1215 /* File chooser does not understand ~/... in the file name. It must be |
1215 an absolute name starting with /. */ | 1216 an absolute name starting with /. */ |
1216 if (default_filename[0] != '/') | 1217 if (default_filename[0] != '/') |
1217 { | 1218 file = Fexpand_file_name (file, Qnil); |
1218 file = Fexpand_file_name (build_string (default_filename), Qnil); | 1219 |
1219 default_filename = SDATA (file); | 1220 default_filename = SDATA (file); |
1220 } | 1221 if (Ffile_directory_p (file)) |
1221 | 1222 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin), |
1222 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), | 1223 default_filename); |
1223 default_filename); | 1224 else |
1225 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), | |
1226 default_filename); | |
1224 | 1227 |
1225 UNGCPRO; | 1228 UNGCPRO; |
1226 } | 1229 } |
1227 | 1230 |
1228 *func = xg_get_file_name_from_chooser; | 1231 *func = xg_get_file_name_from_chooser; |
1308 int count = SPECPDL_INDEX (); | 1311 int count = SPECPDL_INDEX (); |
1309 char *fn = 0; | 1312 char *fn = 0; |
1310 int filesel_done = 0; | 1313 int filesel_done = 0; |
1311 xg_get_file_func func; | 1314 xg_get_file_func func; |
1312 | 1315 |
1316 #if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) | |
1317 /* I really don't know why this is needed, but without this the GLIBC add on | |
1318 library linuxthreads hangs when the Gnome file chooser backend creates | |
1319 threads. */ | |
1320 sigblock (sigmask (__SIGRTMIN)); | |
1321 #endif /* HAVE_GTK_AND_PTHREAD */ | |
1322 | |
1313 #ifdef HAVE_GTK_FILE_BOTH | 1323 #ifdef HAVE_GTK_FILE_BOTH |
1314 if (use_old_gtk_file_dialog) | 1324 extern int x_use_old_gtk_file_dialog; |
1325 | |
1326 if (x_use_old_gtk_file_dialog) | |
1315 w = xg_get_file_with_selection (f, prompt, default_filename, | 1327 w = xg_get_file_with_selection (f, prompt, default_filename, |
1316 mustmatch_p, only_dir_p, &func); | 1328 mustmatch_p, only_dir_p, &func); |
1317 else | 1329 else |
1318 w = xg_get_file_with_chooser (f, prompt, default_filename, | 1330 w = xg_get_file_with_chooser (f, prompt, default_filename, |
1319 mustmatch_p, only_dir_p, &func); | 1331 mustmatch_p, only_dir_p, &func); |
1352 while (! filesel_done) | 1364 while (! filesel_done) |
1353 { | 1365 { |
1354 x_menu_wait_for_event (0); | 1366 x_menu_wait_for_event (0); |
1355 gtk_main_iteration (); | 1367 gtk_main_iteration (); |
1356 } | 1368 } |
1369 | |
1370 #if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) | |
1371 sigunblock (sigmask (__SIGRTMIN)); | |
1372 #endif | |
1357 | 1373 |
1358 if (filesel_done == GTK_RESPONSE_OK) | 1374 if (filesel_done == GTK_RESPONSE_OK) |
1359 fn = (*func) (w); | 1375 fn = (*func) (w); |
1360 | 1376 |
1361 unbind_to (count, Qnil); | 1377 unbind_to (count, Qnil); |