1 |
|
/* |
2 |
|
* prefs_editor_gtk.cpp - Preferences editor, Unix implementation using GTK+ |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2005 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2008 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
420 |
|
char str[512]; |
421 |
|
sprintf(str, |
422 |
|
PROGRAM_NAME "\nVersion %d.%d\n\n" |
423 |
< |
"Copyright (C) 1997-2005 Christian Bauer et al.\n" |
423 |
> |
"Copyright (C) 1997-2008 Christian Bauer et al.\n" |
424 |
|
"E-mail: cb@cebix.net\n" |
425 |
|
#ifdef SHEEPSHAVER |
426 |
|
"http://sheepshaver.cebix.net/\n\n" |
1402 |
|
PrefsReplaceString("etherguid", guid); |
1403 |
|
} |
1404 |
|
|
1405 |
+ |
// Ethernet option for Basilisk II driver selected |
1406 |
+ |
static void mn_ether_tap(GtkWidget *, const char *guid) |
1407 |
+ |
{ |
1408 |
+ |
PrefsReplaceString("ether", "tap"); |
1409 |
+ |
PrefsReplaceString("etherguid", guid); |
1410 |
+ |
} |
1411 |
+ |
|
1412 |
|
// Create ethernet interfaces menu |
1413 |
|
static int create_ether_menu(GtkWidget *menu) |
1414 |
|
{ |
1417 |
|
const char *ether = PrefsFindString("ether"); |
1418 |
|
const char *etherguid = PrefsFindString("etherguid"); |
1419 |
|
|
1420 |
+ |
// No Ethernet |
1421 |
|
add_menu_item(menu, STR_NONE_LAB, (GtkSignalFunc)mn_ether_none); |
1422 |
|
if (ether == NULL) |
1423 |
|
active = n_items; |
1424 |
|
n_items++; |
1425 |
|
|
1426 |
+ |
// Basilisk II Router |
1427 |
|
add_menu_item(menu, "Basilisk II Router", (GtkSignalFunc)mn_ether_router); |
1428 |
|
if (ether && strcmp(ether, "router") == 0) |
1429 |
|
active = n_items; |
1430 |
|
n_items++; |
1431 |
|
|
1432 |
< |
add_menu_item(menu, "Basilisk II Slirp", (GtkSignalFunc)mn_ether_router); |
1432 |
> |
// Basilisk II Slirp |
1433 |
> |
add_menu_item(menu, "Basilisk II Slirp", (GtkSignalFunc)mn_ether_slirp); |
1434 |
|
if (ether && strcmp(ether, "slirp") == 0) |
1435 |
|
active = n_items; |
1436 |
|
n_items++; |
1437 |
|
|
1438 |
+ |
// Basilisk II Ethernet Adapter |
1439 |
|
PacketOpenAdapter("", 0); |
1440 |
|
{ |
1441 |
|
ULONG sz; |
1467 |
|
} |
1468 |
|
PacketCloseAdapter(NULL); |
1469 |
|
|
1470 |
+ |
// TAP-Win32 |
1471 |
+ |
const char *tap_devices; |
1472 |
+ |
if ((tap_devices = ether_tap_devices()) != NULL) { |
1473 |
+ |
const char *guid = tap_devices; |
1474 |
+ |
while (*guid) { |
1475 |
+ |
const char *name = ether_guid_to_name(guid); |
1476 |
+ |
if (name && (name = g_locale_to_utf8(name, -1, NULL, NULL, NULL))) { |
1477 |
+ |
add_menu_item(menu, name, (GtkSignalFunc)mn_ether_tap, strdup(guid)); |
1478 |
+ |
if (etherguid && strcmp(guid, etherguid) == 0 && |
1479 |
+ |
ether && strcmp(ether, "tap") == 0) |
1480 |
+ |
active = n_items; |
1481 |
+ |
n_items++; |
1482 |
+ |
} |
1483 |
+ |
guid += strlen(guid) + 1; |
1484 |
+ |
} |
1485 |
+ |
free((char *)tap_devices); |
1486 |
+ |
} |
1487 |
+ |
|
1488 |
|
return active; |
1489 |
|
} |
1490 |
|
|
1610 |
|
STR_RAMSIZE_128MB_LAB, |
1611 |
|
STR_RAMSIZE_256MB_LAB, |
1612 |
|
STR_RAMSIZE_512MB_LAB, |
1584 |
– |
#ifndef SHEEPSHAVER |
1613 |
|
STR_RAMSIZE_1024MB_LAB, |
1586 |
– |
#endif |
1614 |
|
0 |
1615 |
|
}; |
1616 |
< |
char default_ramsize[10]; |
1616 |
> |
char default_ramsize[16]; |
1617 |
|
sprintf(default_ramsize, "%d", PrefsFindInt32("ramsize") >> 20); |
1618 |
|
w_ramsize = table_make_combobox(table, 0, STR_RAMSIZE_CTRL, default_ramsize, options); |
1619 |
|
|
1731 |
|
gtk_init(&argc, &argv); |
1732 |
|
|
1733 |
|
// Read preferences |
1734 |
< |
PrefsInit(argc, argv); |
1734 |
> |
PrefsInit(NULL, argc, argv); |
1735 |
|
|
1736 |
|
// Migrate preferences |
1737 |
|
PrefsMigrate(); |