comparison src/gtkutil.c @ 90599:c358d0861b16

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 414-422) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 128-130) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-108
author Miles Bader <miles@gnu.org>
date Tue, 05 Sep 2006 02:54:22 +0000
parents a8190f7e546e 9db8c9a68f0f
children a1a25ac6c88a
comparison
equal deleted inserted replaced
90598:4a8681a3d827 90599:c358d0861b16
1324 G_CALLBACK (xg_toggle_notify_cb), wtoggle); 1324 G_CALLBACK (xg_toggle_notify_cb), wtoggle);
1325 1325
1326 message[0] = '\0'; 1326 message[0] = '\0';
1327 if (action != GTK_FILE_CHOOSER_ACTION_SAVE) 1327 if (action != GTK_FILE_CHOOSER_ACTION_SAVE)
1328 strcat (message, "\nType C-l to display a file name text entry box.\n"); 1328 strcat (message, "\nType C-l to display a file name text entry box.\n");
1329 strcat (message, "\nIf you don't like this file selector, customize " 1329 strcat (message, "\nIf you don't like this file selector, use the "
1330 "use-file-dialog\nto turn it off, or type C-x C-f to visit files."); 1330 "corresponding\nkey binding or customize "
1331 1331 "use-file-dialog to turn it off.");
1332
1332 wmessage = gtk_label_new (message); 1333 wmessage = gtk_label_new (message);
1333 gtk_widget_show (wmessage); 1334 gtk_widget_show (wmessage);
1334 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0); 1335 gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0);
1335 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0); 1336 gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0);
1336 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox); 1337 gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox);
1338 if (default_filename) 1339 if (default_filename)
1339 { 1340 {
1340 Lisp_Object file; 1341 Lisp_Object file;
1341 struct gcpro gcpro1; 1342 struct gcpro gcpro1;
1342 GCPRO1 (file); 1343 GCPRO1 (file);
1344 char *utf8_filename;
1343 1345
1344 file = build_string (default_filename); 1346 file = build_string (default_filename);
1345 1347
1346 /* File chooser does not understand ~/... in the file name. It must be 1348 /* File chooser does not understand ~/... in the file name. It must be
1347 an absolute name starting with /. */ 1349 an absolute name starting with /. */
1348 if (default_filename[0] != '/') 1350 if (default_filename[0] != '/')
1349 file = Fexpand_file_name (file, Qnil); 1351 file = Fexpand_file_name (file, Qnil);
1350 1352
1351 default_filename = SSDATA (file); 1353 utf8_filename = SSDATA (ENCODE_UTF_8 (file));
1352 if (Ffile_directory_p (file)) 1354 if (! NILP (Ffile_directory_p (file)))
1353 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin), 1355 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin),
1354 default_filename); 1356 utf8_filename);
1355 else 1357 else
1356 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), 1358 {
1357 default_filename); 1359 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
1360 utf8_filename);
1361 if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
1362 {
1363 char *cp = strrchr (utf8_filename, '/');
1364 if (cp) ++cp;
1365 else cp = utf8_filename;
1366 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filewin), cp);
1367 }
1368 }
1358 1369
1359 UNGCPRO; 1370 UNGCPRO;
1360 } 1371 }
1361 1372
1362 *func = xg_get_file_name_from_chooser; 1373 *func = xg_get_file_name_from_chooser;