annotate src/xs_config.c @ 64:d3bb914e3af3

Fixes for sidplay2 stuff
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 29 Jun 2003 01:17:01 +0000
parents 05220299c6e8
children bf7b647b3239
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Configuration dialog
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
6 Written by Matti "ccr" Hamalainen <ccr@tnsp.org>
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 This program is free software; you can redistribute it and/or modify
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 the Free Software Foundation; either version 2 of the License, or
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 (at your option) any later version.
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 GNU General Public License for more details.
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 along with this program; if not, write to the Free Software
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
22 #include "xs_config.h"
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
23 #include <xmms/configfile.h>
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
24 #include <stdio.h>
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
25 #include "xs_glade.h"
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
26 #include "xs_interface.h"
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
27 #include "xs_support.h"
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 /*
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
30 * Global widgets
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
32 static GtkWidget *xs_configwin = NULL,
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
33 *xs_sldb_fileselector = NULL,
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
34 *xs_stil_fileselector = NULL;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
35
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
36 #define LUW(x...) lookup_widget(xs_configwin, ## x)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 * Configuration specific stuff
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
42 t_xs_cfg_item xs_cfgtable[] = {
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
43 {CTYPE_INT, &xs_cfg.fmtBitsPerSample, "fmtBitsPerSample"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
44 {CTYPE_INT, &xs_cfg.fmtChannels, "fmtChannels"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
45 {CTYPE_INT, &xs_cfg.fmtFrequency, "fmtFrequency"},
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
46
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
47 {CTYPE_BOOL, &xs_cfg.mos8580, "mos8580"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
48 {CTYPE_BOOL, &xs_cfg.emulateFilters, "emulateFilters"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
49 {CTYPE_FLOAT, &xs_cfg.filterFs, "filterFs"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
50 {CTYPE_FLOAT, &xs_cfg.filterFm, "filterFm"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
51 {CTYPE_FLOAT, &xs_cfg.filterFt, "filterFt"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
52 {CTYPE_INT, &xs_cfg.memoryMode, "memoryMode"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
53 {CTYPE_INT, &xs_cfg.clockSpeed, "clockSpeed"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
54 {CTYPE_BOOL, &xs_cfg.forceSpeed, "forceSpeed"},
64
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
55 {CTYPE_INT, &xs_cfg.optimiseLevel, "optimiseLevel"},
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
56 {CTYPE_BOOL, &xs_cfg.oversampleEnable, "oversampleEnable"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
57 {CTYPE_INT, &xs_cfg.oversampleFactor, "oversampleFactor"},
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
58
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
59 {CTYPE_BOOL, &xs_cfg.playMaxTimeEnable, "playMaxTimeEnable"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
60 {CTYPE_INT, &xs_cfg.playMaxTime, "playMaxTime"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
61 {CTYPE_BOOL, &xs_cfg.songlenDBEnable, "songlenDBEnable"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
62 {CTYPE_STR, &xs_cfg.songlenDBPath, "songlenDBPath"},
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
63
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
64 {CTYPE_BOOL, &xs_cfg.stilDBEnable, "stilDBEnable"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
65 {CTYPE_STR, &xs_cfg.stilDBPath, "stilDBPath"},
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
66
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
67 {CTYPE_BOOL, &xs_cfg.detectMagic, "detectMagic"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
68 {CTYPE_BOOL, &xs_cfg.alwaysRaise, "alwaysRaise"},
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
69
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
70 {CTYPE_BOOL, &xs_cfg.titleOverride, "titleOverride"},
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
71 {CTYPE_STR, &xs_cfg.titleFormat, "titleFormat"}
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
72 };
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
73
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
74 const gint xs_cfgtable_max = (sizeof(xs_cfgtable) / sizeof(t_xs_cfg_item));
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
75
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
76
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
77 t_xs_wid_item xs_widtable[] = {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
78 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_16bit", &xs_cfg.fmtBitsPerSample, XS_RES_16BIT },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
79 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_8bit", &xs_cfg.fmtBitsPerSample, XS_RES_8BIT },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
80
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
81 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_mono", &xs_cfg.fmtChannels, XS_CHN_MONO },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
82 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_stereo", &xs_cfg.fmtChannels, XS_CHN_STEREO },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
83 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_autopan", &xs_cfg.fmtChannels, XS_CHN_AUTOPAN },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
84
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
85 { WTYPE_SPIN, CTYPE_INT, "cfg_samplerate", &xs_cfg.fmtFrequency, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
86
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
87 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_mos8580", &xs_cfg.mos8580, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
88 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_filters", &xs_cfg.emulateFilters, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
89
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
90 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fs", &xs_cfg.filterFs, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
91 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fm", &xs_cfg.filterFm, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
92 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_ft", &xs_cfg.filterFt, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
93
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
94 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_real", &xs_cfg.memoryMode, XS_MPU_REAL },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
95 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_banksw", &xs_cfg.memoryMode, XS_MPU_BANK_SWITCHING },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
96 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_transrom", &xs_cfg.memoryMode, XS_MPU_TRANSPARENT_ROM },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
97 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_playsid", &xs_cfg.memoryMode, XS_MPU_PLAYSID_ENVIRONMENT },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
98
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
99 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_ntsc", &xs_cfg.clockSpeed, XS_CLOCK_NTSC },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
100 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_pal", &xs_cfg.clockSpeed, XS_CLOCK_PAL },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
101 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_clock_force", &xs_cfg.forceSpeed, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
102
64
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
103 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sidplay2_opt", &xs_cfg.optimiseLevel, 0 },
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
104
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
105 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_usemaxtime", &xs_cfg.playMaxTimeEnable, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
106 { WTYPE_SPIN, CTYPE_INT, "cfg_sld_maxtime", &xs_cfg.playMaxTime, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
107 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_enable", &xs_cfg.songlenDBEnable, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
108 { WTYPE_TEXT, CTYPE_STR, "cfg_sld_dbpath", &xs_cfg.songlenDBPath, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
109
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
110 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_stil_enable", &xs_cfg.stilDBEnable, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
111 { WTYPE_TEXT, CTYPE_STR, "cfg_stil_dbpath", &xs_cfg.stilDBPath, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
112
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
113 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_detectmagic", &xs_cfg.detectMagic, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
114 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_alwaysraise", &xs_cfg.alwaysRaise, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
115
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
116 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_ftitle_override", &xs_cfg.titleOverride, 0 },
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
117 { WTYPE_TEXT, CTYPE_STR, "cfg_ftitle_format", &xs_cfg.titleFormat, 0 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
118 };
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
119
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
120 const gint xs_widtable_max = (sizeof(xs_widtable) / sizeof(t_xs_wid_item));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
123 /*
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
124 * Reset the filter settings
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
125 */
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
126 void xs_reset_filters(void)
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
127 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
128 /* Reset filter values */
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
129 /*
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
130 xs_cfg.filterFs = SIDEMU_DEFAULTFILTERFS;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
131 xs_cfg.filterFm = SIDEMU_DEFAULTFILTERFM;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
132 xs_cfg.filterFt = SIDEMU_DEFAULTFILTERFT;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
133 */
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
134 }
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
135
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 * Get the configuration (from file or default)
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
140 void xs_read_configuration(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
142 gchar *cfgFilename, *tmpStr;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
143 ConfigFile *cfgFile;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
144 gint i;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
145
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
146 XSDEBUG("initializing configuration ...\n");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
147
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
148 /* Pre-initialize configuration structure */
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
149 xs_cfg.fmtBitsPerSample = XS_RES_16BIT;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
150 xs_cfg.fmtChannels = XS_CHN_MONO;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
151 xs_cfg.fmtFrequency = 44100;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
152
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
153 xs_cfg.mos8580 = FALSE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
154 xs_cfg.emulateFilters = TRUE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
155 xs_reset_filters();
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
156
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
157 #ifdef HAVE_SIDPLAY2
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
158 xs_cfg.memoryMode = XS_MPU_REAL;
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
159 #else
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
160 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING;
44
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
161 #endif
90cd38b28a72 Various fixes and transmogrifying for dual emulation engine environment
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
162
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
163 xs_cfg.clockSpeed = XS_CLOCK_PAL;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
164 xs_cfg.forceSpeed = FALSE;
64
d3bb914e3af3 Fixes for sidplay2 stuff
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
165 xs_cfg.optimiseLevel = FALSE;
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
166 xs_cfg.oversampleEnable = FALSE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
167 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
169 xs_cfg.playMaxTimeEnable = FALSE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
170 xs_cfg.playMaxTime = 150;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
171 xs_cfg.songlenDBEnable = FALSE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
172 xs_strcalloc(&xs_cfg.songlenDBPath, "~/C64Music/Songlengths.txt");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
173
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
174 xs_cfg.stilDBEnable = FALSE;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
175 xs_strcalloc(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
176
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
177 xs_cfg.detectMagic = FALSE;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
178 xs_cfg.alwaysRaise = TRUE;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
180 #ifdef HAVE_XMMSEXTRA
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
181 xs_cfg.titleOverride = FALSE;
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
182 #else
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
183 xs_cfg.titleOverride = TRUE;
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
184 #endif
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
185 xs_strcalloc(&xs_cfg.titleFormat, "%1 - %2 (%3)");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
186
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
187
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
188 /* Try to open the XMMS configuration file */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
189 XSDEBUG("loading from config-file ...\n");
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
190 #ifdef HAVE_NODEFAULTCFG
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
191 cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
192 cfgFile = xmms_cfg_open_file(cfgFilename);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
193 g_free(cfgFilename);
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
194 #else
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
195 cfgFile = xmms_cfg_open_default_file();
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
196 #endif
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
197
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
198 if (cfgFile == NULL)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
199 {
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
200 XSDEBUG("could not open configuration file, trying to write defaults...\n");
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
201 xs_write_configuration();
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
202 return;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
203 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
205 /* Read the new settings from XMMS configuration file */
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
206 for (i = 0; i < xs_cfgtable_max; i++)
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
207 {
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
208 switch (xs_cfgtable[i].valType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
209 case CTYPE_INT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
210 xmms_cfg_read_int(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, (gint *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
211 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
212
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
213 case CTYPE_BOOL:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
214 xmms_cfg_read_boolean(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, (gboolean *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
215 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
216
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
217 case CTYPE_FLOAT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
218 xmms_cfg_read_float(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, (gfloat *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
219 break;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
220
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
221 case CTYPE_STR:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
222 if (xmms_cfg_read_string(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, (gchar **) &tmpStr))
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
223 {
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
224 /* Read was successfull */
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
225 xs_strcalloc((gchar **) xs_cfgtable[i].valData, tmpStr);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
226 g_free(tmpStr);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
227 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
228 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
229
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
230 default:
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
231 XSERR("Internal: Unsupported setting type found while reading configuration file. Please report to author!\n");
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
232 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
233 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
234 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
235
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
236
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
237 /* Free the config file */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
238 xmms_cfg_free(cfgFile);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
239
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
240 XSDEBUG("OK\n");
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
243
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
244
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
245 /*
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
246 * Write the current configuration
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
247 */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
248 gint xs_write_configuration(void)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
249 {
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
250 gchar *cfgFilename;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
251 ConfigFile *cfgFile;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
252 gint i;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
253
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
254 XSDEBUG("writing configuration ...\n");
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
255
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
256 /*
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
257 * Try to open the XMMS configuration file
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
258 */
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
259 #ifdef HAVE_NODEFAULTCFG
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
260 cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
261 cfgFile = xmms_cfg_open_file(cfgFilename);
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
262 #else
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
263 cfgFile = xmms_cfg_open_default_file();
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
264 #endif
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
265
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
266 if (!cfgFile)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
267 cfgFile = xmms_cfg_new();
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
268
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
269
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
270 /* Write the new settings to XMMS configuration file */
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
271 for (i = 0; i < xs_cfgtable_max; i++)
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
272 {
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
273 switch (xs_cfgtable[i].valType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
274 case CTYPE_INT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
275 xmms_cfg_write_int(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, *(gint *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
276 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
277
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
278 case CTYPE_BOOL:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
279 xmms_cfg_write_boolean(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, *(gboolean *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
280 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
281
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
282 case CTYPE_FLOAT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
283 xmms_cfg_write_float(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, *(gfloat *) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
284 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
285
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
286 case CTYPE_STR:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
287 xmms_cfg_write_string(cfgFile, XS_CONFIG_IDENT, xs_cfgtable[i].valName, *(gchar **) xs_cfgtable[i].valData);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
288 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
289
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
290 default:
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
291 XSERR("Internal: Unsupported setting type found while writing configuration file. Please report to author!\n");
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
292 break;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
293 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
294 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
295
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
296 /* Flush the file */
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
297 #ifdef HAVE_NODEFAULTCFG
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
298 xmms_cfg_write_file(cfgFile, cfgFilename);
50
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
299 g_free(cfgFilename);
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
300 #else
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
301 xmms_cfg_write_default_file(cfgFile);
dae6d3c2268d Minor fixes, updated to support default XMMS configfile
Matti Hamalainen <ccr@tnsp.org>
parents: 45
diff changeset
302 #endif
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
303
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
304 /* Free the memory areas */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
305 xmms_cfg_free(cfgFile);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
306
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
307 return 0;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
308 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
309
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
310
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 * Configuration panel was canceled
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
314 void xs_cfg_cancel(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
316 gtk_widget_destroy(xs_configwin);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
317 xs_configwin = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 * Configuration was accepted (OK), save the settings
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
324 void xs_cfg_ok(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 {
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
326 gint i;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
327 gfloat tmpValue;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
328
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
329 XSDEBUG("get data from widgets to config...\n");
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
330
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
331 for (i = 0; i < xs_widtable_max; i++)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
332 {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
333 switch (xs_widtable[i].widType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
334 case WTYPE_BGROUP:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
335 /* Check if toggle-button is active */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
336 if (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
337 {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
338 /* Yes, set the constant value */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
339 *((gint *) xs_widtable[i].valData) = xs_widtable[i].valSet;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
340 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
341 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
342
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
343 case WTYPE_SPIN:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
344 case WTYPE_SCALE:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
345 /* Get the value */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
346 switch (xs_widtable[i].widType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
347 case WTYPE_SPIN:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
348 tmpValue = gtk_spin_button_get_adjustment(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
349 GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName)))->value;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
350 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
351
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
352 case WTYPE_SCALE:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
353 tmpValue = gtk_range_get_adjustment(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
354 GTK_RANGE(LUW(xs_widtable[i].widName)))->value;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
355 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
356
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
357 default:
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
358 tmpValue = -1;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
359 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
360
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
361 /* Set the value */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
362 switch (xs_widtable[i].valType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
363 case CTYPE_INT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
364 *((gint *) xs_widtable[i].valData) = (gint) tmpValue;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
365 break;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
367 case CTYPE_FLOAT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
368 *((gfloat *) xs_widtable[i].valData) = tmpValue;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
369 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
370 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
371 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
372
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
373 case WTYPE_BUTTON:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
374 /* Check if toggle-button is active */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
375 *((gboolean *) xs_widtable[i].valData) =
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
376 (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
377 break;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
378
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
379 case WTYPE_TEXT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
380 /* Get text from text-widget */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
381 xs_strcalloc((gchar **) xs_widtable[i].valData,
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
382 gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName)))
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
383 );
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
384 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
385 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
386 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
388 /* Write settings */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
389 xs_write_configuration();
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
391 /* NOTICE/FIXME FIX ME: if songlendb or stildb settings changed, we need to flush and reread them */
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
393 /* Close window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
394 gtk_widget_destroy(xs_configwin);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
395 xs_configwin = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400 * Reset filter settings to defaults
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
402 void xs_cfg_filter_reset(void)
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
403 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
404 xs_reset_filters();
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
405
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
406 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_fs"))), xs_cfg.filterFs);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
407 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_fm"))), xs_cfg.filterFm);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
408 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_ft"))), xs_cfg.filterFt);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
409 }
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
410
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
411
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
412 /*
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
413 * HVSC songlength-database file selector response-functions
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
414 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
415 void xs_cfg_sld_dbbrowse(GtkButton *button, gpointer user_data)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416 {
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
417 if (xs_sldb_fileselector != NULL)
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
418 {
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
419 gdk_window_raise(xs_sldb_fileselector->window);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
420 return;
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
421 }
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
422
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
423 xs_sldb_fileselector = create_xs_sldbfileselector();
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
424 gtk_widget_show(xs_sldb_fileselector);
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
425 }
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
426
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
427
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
428 void xs_cfg_sldb_fs_ok(void)
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
429 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
430 /* Selection was accepted! */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
431 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_sld_dbpath")),
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
432 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_sldb_fileselector)));
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
433
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
434 /* Close file selector window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
435 gtk_widget_destroy(xs_sldb_fileselector);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
436 xs_sldb_fileselector = NULL;
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
437 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
438
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
439
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
440 void xs_cfg_sldb_fs_cancel(void)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
441 {
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
442 /* Close file selector window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
443 gtk_widget_destroy(xs_sldb_fileselector);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
444 xs_sldb_fileselector = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449 * STIL-database file selector response-functions
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 */
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
451 void xs_cfg_stil_browse(GtkButton *button, gpointer user_data)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
452 {
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
453 if (xs_stil_fileselector != NULL)
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
454 {
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
455 gdk_window_raise(xs_stil_fileselector->window);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
456 return;
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
457 }
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
458
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
459 xs_stil_fileselector = create_xs_stilfileselector();
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
460 gtk_widget_show(xs_stil_fileselector);
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
461 }
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
462
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
463
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
464 void xs_cfg_stil_fs_ok(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
466 /* Selection was accepted! */
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
467 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_stil_dbpath")),
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
468 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_stil_fileselector)));
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
470 /* Close file selector window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
471 gtk_widget_destroy(xs_stil_fileselector);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
472 xs_stil_fileselector = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
476 void xs_cfg_stil_fs_cancel(void)
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 {
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
478 /* Close file selector window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
479 gtk_widget_destroy(xs_stil_fileselector);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
480 xs_stil_fileselector = NULL;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 /*
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 * Execute the configuration panel
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 */
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487 void xs_configure(void)
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 {
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
489 gint i;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
490 gfloat tmpValue;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
491
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
492 /* Check if the window already exists */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
493 if (xs_configwin != NULL)
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
494 {
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
495 gdk_window_raise(xs_configwin->window);
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
496 return;
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
499 /* Create the window */
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
500 xs_configwin = create_xs_configwin();
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
502 /* Based on selected emulation library, disable options */
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
503 #ifdef HAVE_SIDPLAY1
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
504 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay1")), TRUE);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
505 #else
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
506 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
507 #endif
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
508
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
509 #ifdef HAVE_SIDPLAY2
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
510 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay2")), TRUE);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
511 #else
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
512 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2"), FALSE);
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
513 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_opt"), FALSE);
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
514
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
515 gtk_widget_set_sensitive(LUW("cfg_emu_mem_real"), FALSE);
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
516
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
517 gtk_widget_set_sensitive(LUW("cfg_oversample_grp"), FALSE);
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
518 gtk_widget_set_sensitive(LUW("cfg_oversample"), FALSE);
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
519 gtk_widget_set_sensitive(LUW("cfg_oversample_factor"), FALSE);
42
Matti Hamalainen <ccr@tnsp.org>
parents: 40
diff changeset
520 #endif
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
522 #ifndef HAVE_XMMSEXTRA
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
523 gtk_widget_set_sensitive(LUW("cfg_ftitle_override"), FALSE);
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
524 xs_cfg.titleOverride = TRUE;
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
525 #endif
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
526
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
527
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
528 /* Set current data to widgets */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
529 for (i = 0; i < xs_widtable_max; i++)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
530 {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
531 switch (xs_widtable[i].widType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
532 case WTYPE_BGROUP:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
533 /* Check if current value matches the given one */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
534 gtk_toggle_button_set_active(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
535 GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)),
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
536 (*((gint *) xs_widtable[i].valData) == xs_widtable[i].valSet)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
537 );
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
538 break;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
539
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
540
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
541 case WTYPE_SPIN:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
542 case WTYPE_SCALE:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
543 /* Get the value */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
544 switch (xs_widtable[i].valType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
545 case CTYPE_INT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
546 tmpValue = (gfloat) *((gint *) xs_widtable[i].valData);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
547 break;
45
84214a409d19 Minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
548
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
549 case CTYPE_FLOAT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
550 tmpValue = *((gfloat *) xs_widtable[i].valData);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
551 break;
63
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
552
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
553 default:
05220299c6e8 Kuumaa paskaa
Matti Hamalainen <ccr@tnsp.org>
parents: 57
diff changeset
554 tmpValue = -1;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
555 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
556
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
557 /* Set the value */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
558 switch (xs_widtable[i].widType) {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
559 case WTYPE_SPIN:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
560 gtk_adjustment_set_value(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
561 gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName))),
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
562 tmpValue);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
563 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
564
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
565 case WTYPE_SCALE:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
566 gtk_adjustment_set_value(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
567 gtk_range_get_adjustment(GTK_RANGE(LUW(xs_widtable[i].widName))),
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
568 tmpValue);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
569 break;
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
570 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 break;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
572
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
573 case WTYPE_BUTTON:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
574 /* Set toggle-button */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
575 gtk_toggle_button_set_active(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
576 GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)),
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
577 *((gboolean *) xs_widtable[i].valData)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
578 );
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 break;
3
279b1e12df2b Updated to version 0.8-devel
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
580
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
581 case WTYPE_TEXT:
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
582 /* Set text to text-widget */
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
583 if (*(gchar **) xs_widtable[i].valData != NULL)
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
584 {
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
585 gtk_entry_set_text(
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
586 GTK_ENTRY(LUW(xs_widtable[i].widName)),
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
587 *(gchar **) xs_widtable[i].valData);
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
588 }
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 break;
57
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
590 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
591 }
85811bcd049e Improved, re-written configuration code and lots of minor fixes
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
592
40
1788f4ce6a44 Numerous changes towards 0.8
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
593 gtk_widget_show(xs_configwin);
1
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 }
183e7cbc1036 Initial revision
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595