33 |
|
|
34 |
preferencestype preferences; |
preferencestype preferences; |
35 |
extern gchar *xlogdir; |
extern gchar *xlogdir; |
36 |
#define PREFERENCES_VERSION 3 |
#define PREFERENCES_VERSION 4 |
37 |
gboolean newprefsfile = FALSE; |
gboolean newprefsfile = FALSE; |
38 |
|
|
39 |
static void make_default_preferences (void) |
static void make_default_preferences (void) |
103 |
preferences.saveasadif = 0; |
preferences.saveasadif = 0; |
104 |
preferences.saveastsv = g_strdup ("1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0"); |
preferences.saveastsv = g_strdup ("1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0"); |
105 |
preferences.handlebarpos = 300; |
preferences.handlebarpos = 300; |
106 |
|
preferences.cwf1 = g_strdup ("^"); |
107 |
|
preferences.cwf2 = g_strdup ("^"); |
108 |
|
preferences.cwf3 = g_strdup ("^"); |
109 |
|
preferences.cwf4 = g_strdup ("^"); |
110 |
|
preferences.cwf5 = g_strdup ("^"); |
111 |
|
preferences.cwf6 = g_strdup ("^"); |
112 |
|
preferences.cwf7 = g_strdup ("^"); |
113 |
|
preferences.cwf8 = g_strdup ("^"); |
114 |
|
preferences.cwf9 = g_strdup ("^"); |
115 |
|
preferences.cwf10 = g_strdup ("^"); |
116 |
|
preferences.cwspeed = 24; |
117 |
} |
} |
118 |
|
|
119 |
void |
void |
483 |
preferences.handlebarpos = atoi (key); |
preferences.handlebarpos = atoi (key); |
484 |
free (key); |
free (key); |
485 |
} |
} |
486 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf1"))) |
487 |
|
{ |
488 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
489 |
|
preferences.cwf1 = g_strdup (key); |
490 |
|
free (key); |
491 |
|
} |
492 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf2"))) |
493 |
|
{ |
494 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
495 |
|
preferences.cwf2 = g_strdup (key); |
496 |
|
free (key); |
497 |
|
} |
498 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf3"))) |
499 |
|
{ |
500 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
501 |
|
preferences.cwf3 = g_strdup (key); |
502 |
|
free (key); |
503 |
|
} |
504 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf4"))) |
505 |
|
{ |
506 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
507 |
|
preferences.cwf4 = g_strdup (key); |
508 |
|
free (key); |
509 |
|
} |
510 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf5"))) |
511 |
|
{ |
512 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
513 |
|
preferences.cwf5 = g_strdup (key); |
514 |
|
free (key); |
515 |
|
} |
516 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf6"))) |
517 |
|
{ |
518 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
519 |
|
preferences.cwf6 = g_strdup (key); |
520 |
|
free (key); |
521 |
|
} |
522 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf7"))) |
523 |
|
{ |
524 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
525 |
|
preferences.cwf7 = g_strdup (key); |
526 |
|
free (key); |
527 |
|
} |
528 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf8"))) |
529 |
|
{ |
530 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
531 |
|
preferences.cwf8 = g_strdup (key); |
532 |
|
free (key); |
533 |
|
} |
534 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf9"))) |
535 |
|
{ |
536 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
537 |
|
preferences.cwf9 = g_strdup (key); |
538 |
|
free (key); |
539 |
|
} |
540 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwf10"))) |
541 |
|
{ |
542 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
543 |
|
preferences.cwf10 = g_strdup (key); |
544 |
|
free (key); |
545 |
|
} |
546 |
|
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"cwspeed"))) |
547 |
|
{ |
548 |
|
key = xmlNodeListGetString (p, cur->xmlChildrenNode, 1); |
549 |
|
preferences.cwspeed = atoi (key); |
550 |
|
free (key); |
551 |
|
} |
552 |
cur = cur->next; |
cur = cur->next; |
553 |
} |
} |
554 |
return; |
return; |
921 |
xmlNodeSetContent (node, key); |
xmlNodeSetContent (node, key); |
922 |
g_free (key); |
g_free (key); |
923 |
} |
} |
924 |
|
else if (!strcmp (node->name, "cwf1")) |
925 |
|
{ |
926 |
|
key = g_strdup_printf ("%s", preferences.cwf1); |
927 |
|
xmlNodeSetContent (node, key); |
928 |
|
g_free (key); |
929 |
|
} |
930 |
|
else if (!strcmp (node->name, "cwf2")) |
931 |
|
{ |
932 |
|
key = g_strdup_printf ("%s", preferences.cwf2); |
933 |
|
xmlNodeSetContent (node, key); |
934 |
|
g_free (key); |
935 |
|
} |
936 |
|
else if (!strcmp (node->name, "cwf3")) |
937 |
|
{ |
938 |
|
key = g_strdup_printf ("%s", preferences.cwf3); |
939 |
|
xmlNodeSetContent (node, key); |
940 |
|
g_free (key); |
941 |
|
} |
942 |
|
else if (!strcmp (node->name, "cwf4")) |
943 |
|
{ |
944 |
|
key = g_strdup_printf ("%s", preferences.cwf4); |
945 |
|
xmlNodeSetContent (node, key); |
946 |
|
g_free (key); |
947 |
|
} |
948 |
|
else if (!strcmp (node->name, "cwf5")) |
949 |
|
{ |
950 |
|
key = g_strdup_printf ("%s", preferences.cwf5); |
951 |
|
xmlNodeSetContent (node, key); |
952 |
|
g_free (key); |
953 |
|
} |
954 |
|
else if (!strcmp (node->name, "cwf6")) |
955 |
|
{ |
956 |
|
key = g_strdup_printf ("%s", preferences.cwf6); |
957 |
|
xmlNodeSetContent (node, key); |
958 |
|
g_free (key); |
959 |
|
} |
960 |
|
else if (!strcmp (node->name, "cwf7")) |
961 |
|
{ |
962 |
|
key = g_strdup_printf ("%s", preferences.cwf7); |
963 |
|
xmlNodeSetContent (node, key); |
964 |
|
g_free (key); |
965 |
|
} |
966 |
|
else if (!strcmp (node->name, "cwf8")) |
967 |
|
{ |
968 |
|
key = g_strdup_printf ("%s", preferences.cwf8); |
969 |
|
xmlNodeSetContent (node, key); |
970 |
|
g_free (key); |
971 |
|
} |
972 |
|
else if (!strcmp (node->name, "cwf9")) |
973 |
|
{ |
974 |
|
key = g_strdup_printf ("%s", preferences.cwf9); |
975 |
|
xmlNodeSetContent (node, key); |
976 |
|
g_free (key); |
977 |
|
} |
978 |
|
else if (!strcmp (node->name, "cwf10")) |
979 |
|
{ |
980 |
|
key = g_strdup_printf ("%s", preferences.cwf10); |
981 |
|
xmlNodeSetContent (node, key); |
982 |
|
g_free (key); |
983 |
|
} |
984 |
|
else if (!strcmp (node->name, "cwspeed")) |
985 |
|
{ |
986 |
|
key = g_strdup_printf ("%d", preferences.cwspeed); |
987 |
|
xmlNodeSetContent (node, key); |
988 |
|
g_free (key); |
989 |
|
} |
990 |
} |
} |
991 |
} |
} |
992 |
|
|
1117 |
xmlNewTextChild (cur, NULL, "saveastsv", key); |
xmlNewTextChild (cur, NULL, "saveastsv", key); |
1118 |
key = g_strdup_printf ("%d", preferences.handlebarpos); |
key = g_strdup_printf ("%d", preferences.handlebarpos); |
1119 |
xmlNewTextChild (cur, NULL, "handlebarpos", key); |
xmlNewTextChild (cur, NULL, "handlebarpos", key); |
1120 |
|
key = g_strdup_printf ("%s", preferences.cwf1); |
1121 |
|
xmlNewTextChild (cur, NULL, "cwf1", key); |
1122 |
|
key = g_strdup_printf ("%s", preferences.cwf2); |
1123 |
|
xmlNewTextChild (cur, NULL, "cwf2", key); |
1124 |
|
key = g_strdup_printf ("%s", preferences.cwf3); |
1125 |
|
xmlNewTextChild (cur, NULL, "cwf3", key); |
1126 |
|
key = g_strdup_printf ("%s", preferences.cwf4); |
1127 |
|
xmlNewTextChild (cur, NULL, "cwf4", key); |
1128 |
|
key = g_strdup_printf ("%s", preferences.cwf5); |
1129 |
|
xmlNewTextChild (cur, NULL, "cwf5", key); |
1130 |
|
key = g_strdup_printf ("%s", preferences.cwf6); |
1131 |
|
xmlNewTextChild (cur, NULL, "cwf6", key); |
1132 |
|
key = g_strdup_printf ("%s", preferences.cwf7); |
1133 |
|
xmlNewTextChild (cur, NULL, "cwf7", key); |
1134 |
|
key = g_strdup_printf ("%s", preferences.cwf8); |
1135 |
|
xmlNewTextChild (cur, NULL, "cwf8", key); |
1136 |
|
key = g_strdup_printf ("%s", preferences.cwf9); |
1137 |
|
xmlNewTextChild (cur, NULL, "cwf9", key); |
1138 |
|
key = g_strdup_printf ("%s", preferences.cwf10); |
1139 |
|
xmlNewTextChild (cur, NULL, "cwf10", key); |
1140 |
|
key = g_strdup_printf ("%d", preferences.cwspeed); |
1141 |
|
xmlNewTextChild (cur, NULL, "cwspeed", key); |
1142 |
g_free (key); |
g_free (key); |
1143 |
} |
} |
1144 |
|
|
1258 |
xmlNewTextChild (cur, NULL, "handlebarpos", key); |
xmlNewTextChild (cur, NULL, "handlebarpos", key); |
1259 |
g_free (key); |
g_free (key); |
1260 |
} |
} |
1261 |
|
if (!newprefsfile && (preferences.version < 4)) |
1262 |
|
{ |
1263 |
|
/* introduced in xlog version 1.2 */ |
1264 |
|
key = g_strdup_printf ("%s", preferences.cwf1); |
1265 |
|
xmlNewTextChild (cur, NULL, "cwf1", key); |
1266 |
|
key = g_strdup_printf ("%s", preferences.cwf2); |
1267 |
|
xmlNewTextChild (cur, NULL, "cwf2", key); |
1268 |
|
key = g_strdup_printf ("%s", preferences.cwf3); |
1269 |
|
xmlNewTextChild (cur, NULL, "cwf3", key); |
1270 |
|
key = g_strdup_printf ("%s", preferences.cwf4); |
1271 |
|
xmlNewTextChild (cur, NULL, "cwf4", key); |
1272 |
|
key = g_strdup_printf ("%s", preferences.cwf5); |
1273 |
|
xmlNewTextChild (cur, NULL, "cwf5", key); |
1274 |
|
key = g_strdup_printf ("%s", preferences.cwf6); |
1275 |
|
xmlNewTextChild (cur, NULL, "cwf6", key); |
1276 |
|
key = g_strdup_printf ("%s", preferences.cwf7); |
1277 |
|
xmlNewTextChild (cur, NULL, "cwf7", key); |
1278 |
|
key = g_strdup_printf ("%s", preferences.cwf8); |
1279 |
|
xmlNewTextChild (cur, NULL, "cwf8", key); |
1280 |
|
key = g_strdup_printf ("%s", preferences.cwf9); |
1281 |
|
xmlNewTextChild (cur, NULL, "cwf9", key); |
1282 |
|
key = g_strdup_printf ("%s", preferences.cwf10); |
1283 |
|
xmlNewTextChild (cur, NULL, "cwf10", key); |
1284 |
|
key = g_strdup_printf ("%d", preferences.cwspeed); |
1285 |
|
xmlNewTextChild (cur, NULL, "cwspeed", key); |
1286 |
|
g_free (key); |
1287 |
|
} |
1288 |
} |
} |
1289 |
cur = cur->next; |
cur = cur->next; |
1290 |
} |
} |