4 GKeyFile
*config
= g_key_file_new();
5 if (g_key_file_load_from_file(config
, CONFIGFILE
, G_KEY_FILE_NONE
, NULL
)) {
7 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemBeforeHum")), g_key_file_get_boolean(config
, "before", "hum", NULL
));
8 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemBeforeVoice")), g_key_file_get_boolean(config
, "before", "voice", NULL
));
9 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemExampleHum")), g_key_file_get_boolean(config
, "example", "hum", NULL
));
10 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemExampleVoice")), g_key_file_get_boolean(config
, "example", "voice", NULL
));
12 upperRegister
= g_key_file_get_double(config
, "voice", "upperregister", NULL
);
14 if (upperRegister
<= 0.0) upperRegister
= 200.0;
16 switch ((int)upperRegister
) {
18 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "menuitemVoice_Male_Low")), TRUE
);
21 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "menuitemVoice_Male")), TRUE
);
24 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "menuitemVoice_Female")), TRUE
);
27 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "menuitemVoice_Child")), TRUE
);
31 if ((last
= g_key_file_get_string(config
, "wordlist", "last", NULL
)) == NULL
|| (g_access(last
, F_OK
) != 0)) {
32 gchar
*currentDir
= g_get_current_dir();
34 last
= g_build_filename(currentDir
, TESTFILE
, NULL
);
41 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(glade_xml_get_widget(xml
, "filechooserdialogWordlist")), last
);
44 g_key_file_free(config
);
49 GKeyFile
*config
= g_key_file_new();
50 g_key_file_load_from_file(config
, CONFIGFILE
, G_KEY_FILE_KEEP_COMMENTS
|G_KEY_FILE_KEEP_TRANSLATIONS
, NULL
);
51 g_key_file_set_boolean(config
, "before", "hum", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemBeforeHum"))));
52 g_key_file_set_boolean(config
, "before", "voice", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemBeforeVoice"))));
53 g_key_file_set_boolean(config
, "example", "hum", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemExampleHum"))));
54 g_key_file_set_boolean(config
, "example", "voice", gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(glade_xml_get_widget(xml
, "checkmenuitemExampleVoice"))));
55 g_key_file_set_string(config
, "wordlist", "last", file
);
57 g_key_file_set_double(config
, "voice", "upperregister", upperRegister
);
59 output
= g_string_new(g_key_file_to_data(config
, NULL
, NULL
));
60 g_file_set_contents(CONFIGFILE
, output
->str
, output
->len
, NULL
);
62 g_string_free(output
, TRUE
);
63 g_key_file_free(config
);