00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <gnome.h>
00022
00023 #include "interface.h"
00024 #include "interface_il.h"
00025 #include "audio.h"
00026 #include "morse.h"
00027
00028 #include "preferences.h"
00029
00030 void load_config_file(void)
00031 {
00032 char *s = NULL;
00033 static char tmp[AUDIO_DEVICE_NAME_LENGTH];
00034
00035 gnome_config_push_prefix ("/morse2txt/GUI/");
00036 main_gui.pane_position = gnome_config_get_int("pane_position=250");
00037 main_gui.toolbar_style = gnome_config_get_int("toolbar_style=2");
00038
00039 main_gui.width = gnome_config_get_int ("main_width=500");
00040 main_gui.height = gnome_config_get_int ("main_height=500");
00041
00042 gnome_config_pop_prefix ();
00043
00044 gnome_config_push_prefix ("/morse2txt/Morse/");
00045 morse_set_tone_packet_size(gnome_config_get_int ("tone_packet_size=64"));
00046 morse_set_fft_data_size(morse_get_tone_packet_size() / FFT_DATA_SIZE_DIVISOR);
00047 gnome_config_pop_prefix ();
00048
00049 gnome_config_push_prefix ("/morse2txt/AudioDevice/");
00050 morse_audio_device_type_id_set(gnome_config_get_int ("device_type_id=0"));
00051 s = gnome_config_get_string ("device=/dev/dsp");
00052 g_snprintf(tmp, AUDIO_DEVICE_NAME_LENGTH, "%s", s);
00053 audio_device_name_set(morse_audio_rec_dev_get(), tmp);
00054 morse_audio_sample_rate_set(gnome_config_get_int ("sample_frequency=16000"));
00055 gnome_config_pop_prefix ();
00056
00057 gnome_config_push_prefix ("/morse2txt/Filter/");
00058 morse_set_filter_bandwidth(gnome_config_get_int ("filter_bandwidth=1000"));
00059 morse_set_filter_taps(gnome_config_get_int ("filter_taps=32"));
00060
00061 gnome_config_pop_prefix ();
00062 }
00063
00064 void save_config_file(void)
00065 {
00066 char *tmp;
00067
00068 gnome_config_push_prefix ("/morse2txt/GUI/");
00069 gnome_config_set_int ("pane_position", main_gui.pane_position);
00070 gnome_config_set_int ("toolbar_style", main_gui.toolbar_style);
00071
00072 gnome_config_set_int ("main_x_location", main_gui.x);
00073 gnome_config_set_int ("main_y_location", main_gui.y);
00074 gnome_config_set_int ("main_width", main_gui.width);
00075 gnome_config_set_int ("main_height", main_gui.height);
00076
00077 gnome_config_pop_prefix ();
00078
00079 gnome_config_push_prefix ("/morse2txt/Morse/");
00080 gnome_config_set_int ("tone_packet_size", morse_get_tone_packet_size());
00081 gnome_config_pop_prefix ();
00082
00083 gnome_config_push_prefix ("/morse2txt/AudioDevice/");
00084 gnome_config_set_int ("device_type_id", morse_audio_device_type_id_get());
00085 gnome_config_set_int ("sample_frequency", morse_audio_sample_rate_get());
00086 audio_device_name_get(morse_audio_rec_dev_get(), &tmp);
00087 gnome_config_set_string ("device", tmp);
00088 gnome_config_pop_prefix ();
00089
00090 gnome_config_push_prefix ("/morse2txt/Filter/");
00091 gnome_config_set_int ("filter_bandwidth", morse_get_filter_bandwidth());
00092 gnome_config_set_int ("filter_taps", morse_get_filter_taps());
00093 gnome_config_pop_prefix ();
00094
00095 gnome_config_sync ();
00096 }
00097