28 |
|
#include <net/if.h> |
29 |
|
#include <net/if_arp.h> |
30 |
|
|
31 |
+ |
#ifdef HAVE_GNOMEUI |
32 |
+ |
#include <gnome.h> |
33 |
+ |
#endif |
34 |
+ |
|
35 |
|
#include "user_strings.h" |
36 |
|
#include "version.h" |
37 |
|
#include "cdrom.h" |
154 |
|
return menu; |
155 |
|
} |
156 |
|
|
157 |
< |
static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_item) |
157 |
> |
static GtkWidget *make_file_entry(GtkWidget *top, int label_id, const char *prefs_item, bool only_dirs = false) |
158 |
|
{ |
159 |
|
GtkWidget *box, *label, *entry; |
160 |
|
|
166 |
|
gtk_widget_show(label); |
167 |
|
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
168 |
|
|
165 |
– |
entry = gtk_entry_new(); |
166 |
– |
gtk_widget_show(entry); |
169 |
|
const char *str = PrefsFindString(prefs_item); |
170 |
|
if (str == NULL) |
171 |
|
str = ""; |
172 |
+ |
|
173 |
+ |
#ifdef HAVE_GNOMEUI |
174 |
+ |
entry = gnome_file_entry_new(NULL, GetString(label_id)); |
175 |
+ |
if (only_dirs) |
176 |
+ |
gnome_file_entry_set_directory(GNOME_FILE_ENTRY(entry), true); |
177 |
+ |
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(entry))), str); |
178 |
+ |
#else |
179 |
+ |
entry = gtk_entry_new(); |
180 |
|
gtk_entry_set_text(GTK_ENTRY(entry), str); |
181 |
+ |
#endif |
182 |
+ |
gtk_widget_show(entry); |
183 |
|
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); |
184 |
|
return entry; |
185 |
|
} |
186 |
|
|
187 |
+ |
static char *get_file_entry_path(GtkWidget *entry) |
188 |
+ |
{ |
189 |
+ |
#ifdef HAVE_GNOMEUI |
190 |
+ |
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false); |
191 |
+ |
#else |
192 |
+ |
return gtk_entry_get_text(GTK_ENTRY(entry)); |
193 |
+ |
#endif |
194 |
+ |
} |
195 |
+ |
|
196 |
|
static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func) |
197 |
|
{ |
198 |
|
GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id)); |
246 |
|
// "About" selected |
247 |
|
static void mn_about(...) |
248 |
|
{ |
249 |
< |
GtkWidget *dialog, *label, *button; |
249 |
> |
GtkWidget *dialog; |
250 |
> |
|
251 |
> |
#ifdef HAVE_GNOMEUI |
252 |
> |
|
253 |
> |
char version[32]; |
254 |
> |
sprintf(version, "Version %d.%d", VERSION_MAJOR, VERSION_MINOR); |
255 |
> |
const char *authors[] = { |
256 |
> |
"Christian Bauer", |
257 |
> |
"Orlando Bassotto", |
258 |
> |
"Gwenolé Beauchesne", |
259 |
> |
"Marc Chabanas", |
260 |
> |
"Marc Hellwig", |
261 |
> |
"Biill Huey", |
262 |
> |
"Brian J. Johnson", |
263 |
> |
"Jürgen Lachmann", |
264 |
> |
"Samuel Lander", |
265 |
> |
"David Lawrence", |
266 |
> |
"Lauri Pesonen", |
267 |
> |
"Bernd Schmidt", |
268 |
> |
"and others", |
269 |
> |
NULL |
270 |
> |
}; |
271 |
> |
dialog = gnome_about_new( |
272 |
> |
"Basilisk II", |
273 |
> |
version, |
274 |
> |
"Copyright (C) 1997-2002 Christian Bauer", |
275 |
> |
authors, |
276 |
> |
"Basilisk II comes with ABSOLUTELY NO WARRANTY." |
277 |
> |
"This is free software, and you are welcome to redistribute it" |
278 |
> |
"under the terms of the GNU General Public License.", |
279 |
> |
NULL |
280 |
> |
); |
281 |
> |
gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(win)); |
282 |
> |
|
283 |
> |
#else |
284 |
> |
|
285 |
> |
GtkWidget *label, *button; |
286 |
|
|
287 |
|
char str[512]; |
288 |
|
sprintf(str, |
289 |
|
"Basilisk II\nVersion %d.%d\n\n" |
290 |
< |
"Copyright (C) 1997-2001 Christian Bauer et al.\n" |
290 |
> |
"Copyright (C) 1997-2002 Christian Bauer et al.\n" |
291 |
|
"E-mail: Christian.Bauer@uni-mainz.de\n" |
292 |
|
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
293 |
|
"Basilisk II comes with ABSOLUTELY NO\n" |
313 |
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); |
314 |
|
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
315 |
|
gtk_widget_grab_default(button); |
316 |
+ |
|
317 |
+ |
#endif |
318 |
+ |
|
319 |
|
gtk_widget_show(dialog); |
320 |
|
} |
321 |
|
|
491 |
|
PrefsAddString("disk", str); |
492 |
|
} |
493 |
|
|
494 |
< |
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs))); |
494 |
> |
PrefsReplaceString("extfs", get_file_entry_path(w_extfs)); |
495 |
|
} |
496 |
|
|
497 |
|
// Create "Volumes" pane |
512 |
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); |
513 |
|
char *str; |
514 |
|
int32 index = 0; |
515 |
< |
while ((str = (char *)PrefsFindString("disk", index++)) != NULL) |
515 |
> |
while ((str = const_cast<char *>(PrefsFindString("disk", index++))) != NULL) |
516 |
|
gtk_clist_append(GTK_CLIST(volume_list), &str); |
517 |
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list); |
518 |
|
gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); |
527 |
|
make_button_box(box, 0, buttons); |
528 |
|
make_separator(box); |
529 |
|
|
530 |
< |
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs"); |
530 |
> |
w_extfs = make_file_entry(box, STR_EXTFS_CTRL, "extfs", true); |
531 |
|
|
532 |
|
static const opt_desc options[] = { |
533 |
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, |
557 |
|
for (int id=0; id<7; id++) { |
558 |
|
char prefs_name[32]; |
559 |
|
sprintf(prefs_name, "scsi%d", id); |
560 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_scsi[id])); |
560 |
> |
const char *str = get_file_entry_path(w_scsi[id]); |
561 |
|
if (str && strlen(str)) |
562 |
|
PrefsReplaceString(prefs_name, str); |
563 |
|
else |
575 |
|
for (int id=0; id<7; id++) { |
576 |
|
char prefs_name[32]; |
577 |
|
sprintf(prefs_name, "scsi%d", id); |
578 |
< |
w_scsi[id] = make_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
578 |
> |
w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
579 |
|
} |
580 |
|
} |
581 |
|
|
705 |
|
return; |
706 |
|
} |
707 |
|
PrefsReplaceString("screen", pref); |
708 |
+ |
|
709 |
+ |
#ifdef ENABLE_FBDEV_DGA |
710 |
+ |
str = get_file_entry_path(w_fbdevice_file); |
711 |
+ |
if (str && strlen(str)) |
712 |
+ |
PrefsReplaceString("fbdevicefile", str); |
713 |
+ |
else |
714 |
+ |
PrefsRemoveItem("fbdevicefile"); |
715 |
+ |
#endif |
716 |
|
} |
717 |
|
|
718 |
|
// Create "Graphics/Sound" pane |
828 |
|
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name); |
829 |
|
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
830 |
|
|
831 |
< |
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
831 |
> |
w_fbdevice_file = make_file_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
832 |
|
#endif |
833 |
|
|
834 |
|
make_separator(box); |
866 |
|
// Read settings from widgets and set preferences |
867 |
|
static void read_input_settings(void) |
868 |
|
{ |
869 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file)); |
869 |
> |
const char *str = get_file_entry_path(w_keycode_file); |
870 |
|
if (str && strlen(str)) |
871 |
|
PrefsReplaceString("keycodefile", str); |
872 |
|
else |
884 |
|
box = make_pane(top, STR_INPUT_PANE_TITLE); |
885 |
|
|
886 |
|
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
887 |
< |
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
887 |
> |
w_keycode_file = make_file_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
888 |
|
|
889 |
|
make_separator(box); |
890 |
|
|
1140 |
|
{ |
1141 |
|
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20); |
1142 |
|
|
1143 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_rom_file)); |
1143 |
> |
const char *str = get_file_entry_path(w_rom_file); |
1144 |
|
if (str && strlen(str)) |
1145 |
|
PrefsReplaceString("rom", str); |
1146 |
|
else |
1225 |
|
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1226 |
|
#endif |
1227 |
|
|
1228 |
< |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1228 |
> |
w_rom_file = make_file_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1229 |
|
} |
1230 |
|
|
1231 |
|
|