Mercurial > audlegacy
annotate Plugins/Input/sid/xs_config.c @ 553:82346a6312c2 trunk
[svn] make WMA plugin strings translatable
author | nenolod |
---|---|
date | Wed, 01 Feb 2006 13:09:00 -0800 |
parents | d0e9693d2115 |
children | f12d7e208b43 |
rev | line source |
---|---|
269 | 1 /* |
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) | |
3 | |
4 Configuration dialog | |
5 | |
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> | |
7 (C) Copyright 1999-2005 Tecnic Software productions (TNSP) | |
8 | |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with this program; if not, write to the Free Software | |
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 */ | |
23 #include "xs_config.h" | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
24 #include "libaudacious/configdb.h" |
269 | 25 #include <stdio.h> |
26 #include "xs_glade.h" | |
27 #include "xs_interface.h" | |
28 #include "xs_support.h" | |
29 | |
30 /* | |
31 * Global widgets | |
32 */ | |
33 static GtkWidget *xs_configwin = NULL, | |
34 *xs_sldb_fileselector = NULL, | |
35 *xs_stil_fileselector = NULL, | |
36 *xs_hvsc_pathselector = NULL; | |
37 | |
38 #define LUW(x) lookup_widget(xs_configwin, x) | |
39 | |
40 | |
41 /* | |
42 * Configuration specific stuff | |
43 */ | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
44 GStaticMutex xs_cfg_mutex = G_STATIC_MUTEX_INIT; |
269 | 45 struct t_xs_cfg xs_cfg; |
46 | |
47 t_xs_cfg_item xs_cfgtable[] = { | |
48 { CTYPE_INT, &xs_cfg.audioBitsPerSample, "audioBitsPerSample" }, | |
49 { CTYPE_INT, &xs_cfg.audioChannels, "audioChannels" }, | |
50 { CTYPE_INT, &xs_cfg.audioFrequency, "audioFrequency" }, | |
51 | |
52 { CTYPE_BOOL, &xs_cfg.mos8580, "mos8580" }, | |
53 { CTYPE_BOOL, &xs_cfg.forceModel, "forceModel" }, | |
54 { CTYPE_BOOL, &xs_cfg.emulateFilters, "emulateFilters" }, | |
55 { CTYPE_FLOAT, &xs_cfg.filterFs, "filterFs" }, | |
56 { CTYPE_FLOAT, &xs_cfg.filterFm, "filterFm" }, | |
57 { CTYPE_FLOAT, &xs_cfg.filterFt, "filterFt" }, | |
58 { CTYPE_INT, &xs_cfg.memoryMode, "memoryMode" }, | |
59 { CTYPE_INT, &xs_cfg.clockSpeed, "clockSpeed" }, | |
60 { CTYPE_BOOL, &xs_cfg.forceSpeed, "forceSpeed" }, | |
61 | |
62 { CTYPE_INT, &xs_cfg.playerEngine, "playerEngine" }, | |
63 | |
64 { CTYPE_INT, &xs_cfg.sid2Builder, "sid2Builder" }, | |
65 { CTYPE_INT, &xs_cfg.sid2OptLevel, "sid2OptLevel" }, | |
66 | |
67 { CTYPE_BOOL, &xs_cfg.oversampleEnable, "oversampleEnable" }, | |
68 { CTYPE_INT, &xs_cfg.oversampleFactor, "oversampleFactor" }, | |
69 | |
70 { CTYPE_BOOL, &xs_cfg.playMaxTimeEnable, "playMaxTimeEnable" }, | |
71 { CTYPE_BOOL, &xs_cfg.playMaxTimeUnknown, "playMaxTimeUnknown" }, | |
72 { CTYPE_INT, &xs_cfg.playMaxTime, "playMaxTime" }, | |
73 { CTYPE_BOOL, &xs_cfg.playMinTimeEnable, "playMinTimeEnable" }, | |
74 { CTYPE_INT, &xs_cfg.playMinTime, "playMinTime" }, | |
75 { CTYPE_BOOL, &xs_cfg.songlenDBEnable, "songlenDBEnable" }, | |
76 { CTYPE_STR, &xs_cfg.songlenDBPath, "songlenDBPath" }, | |
77 | |
78 { CTYPE_BOOL, &xs_cfg.stilDBEnable, "stilDBEnable" }, | |
79 { CTYPE_STR, &xs_cfg.stilDBPath, "stilDBPath" }, | |
80 { CTYPE_STR, &xs_cfg.hvscPath, "hvscPath" }, | |
81 | |
82 { CTYPE_INT, &xs_cfg.subsongControl, "subsongControl" }, | |
83 { CTYPE_BOOL, &xs_cfg.detectMagic, "detectMagic" }, | |
84 | |
85 { CTYPE_BOOL, &xs_cfg.titleOverride, "titleOverride" }, | |
86 { CTYPE_STR, &xs_cfg.titleFormat, "titleFormat" }, | |
87 | |
88 { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" }, | |
89 { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" }, | |
90 { CTYPE_INT, &xs_cfg.subAutoMinTime, "subAutoMinTime" }, | |
91 }; | |
92 | |
93 static const gint xs_cfgtable_max = (sizeof(xs_cfgtable) / sizeof(t_xs_cfg_item)); | |
94 | |
95 | |
96 t_xs_wid_item xs_widtable[] = { | |
97 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_16bit", &xs_cfg.audioBitsPerSample, XS_RES_16BIT }, | |
98 { WTYPE_BGROUP, CTYPE_INT, "cfg_res_8bit", &xs_cfg.audioBitsPerSample, XS_RES_8BIT }, | |
99 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_mono", &xs_cfg.audioChannels, XS_CHN_MONO }, | |
100 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_stereo", &xs_cfg.audioChannels, XS_CHN_STEREO }, | |
101 { WTYPE_BGROUP, CTYPE_INT, "cfg_chn_autopan", &xs_cfg.audioChannels, XS_CHN_AUTOPAN }, | |
102 { WTYPE_SPIN, CTYPE_INT, "cfg_samplerate", &xs_cfg.audioFrequency, 0 }, | |
103 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_oversample", &xs_cfg.oversampleEnable, 0 }, | |
104 { WTYPE_SPIN, CTYPE_INT, "cfg_oversample_factor",&xs_cfg.oversampleFactor, 0 }, | |
105 | |
106 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay1", &xs_cfg.playerEngine, XS_ENG_SIDPLAY1 }, | |
107 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2", &xs_cfg.playerEngine, XS_ENG_SIDPLAY2 }, | |
108 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_real", &xs_cfg.memoryMode, XS_MPU_REAL }, | |
109 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_banksw", &xs_cfg.memoryMode, XS_MPU_BANK_SWITCHING }, | |
110 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_transrom", &xs_cfg.memoryMode, XS_MPU_TRANSPARENT_ROM }, | |
111 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_mem_playsid", &xs_cfg.memoryMode, XS_MPU_PLAYSID_ENVIRONMENT }, | |
112 | |
113 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_mos8580", &xs_cfg.mos8580, 0 }, | |
114 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sid_force", &xs_cfg.forceModel, 0 }, | |
115 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_ntsc", &xs_cfg.clockSpeed, XS_CLOCK_NTSC }, | |
116 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_pal", &xs_cfg.clockSpeed, XS_CLOCK_PAL }, | |
117 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_clock_force", &xs_cfg.forceSpeed, 0 }, | |
118 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sidplay2_opt", &xs_cfg.sid2OptLevel, 0 }, | |
119 | |
120 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2_resid",&xs_cfg.sid2Builder, XS_BLD_RESID }, | |
121 { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2_hardsid",&xs_cfg.sid2Builder, XS_BLD_HARDSID }, | |
122 | |
123 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_filters", &xs_cfg.emulateFilters, 0 }, | |
124 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fs", &xs_cfg.filterFs, 0 }, | |
125 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fm", &xs_cfg.filterFm, 0 }, | |
126 { WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_ft", &xs_cfg.filterFt, 0 }, | |
127 | |
128 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_enable", &xs_cfg.playMaxTimeEnable, 0 }, | |
129 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_unknown", &xs_cfg.playMaxTimeUnknown, 0 }, | |
130 { WTYPE_SPIN, CTYPE_INT, "cfg_maxtime", &xs_cfg.playMaxTime, 0 }, | |
131 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_mintime_enable", &xs_cfg.playMinTimeEnable, 0 }, | |
132 { WTYPE_SPIN, CTYPE_INT, "cfg_mintime", &xs_cfg.playMinTime, 0 }, | |
133 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_enable", &xs_cfg.songlenDBEnable, 0 }, | |
134 { WTYPE_TEXT, CTYPE_STR, "cfg_sld_dbpath", &xs_cfg.songlenDBPath, 0 }, | |
135 | |
136 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_stil_enable", &xs_cfg.stilDBEnable, 0 }, | |
137 { WTYPE_TEXT, CTYPE_STR, "cfg_stil_dbpath", &xs_cfg.stilDBPath, 0 }, | |
138 { WTYPE_TEXT, CTYPE_STR, "cfg_hvsc_path", &xs_cfg.hvscPath, 0 }, | |
139 | |
140 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_none", &xs_cfg.subsongControl, XS_SSC_NONE }, | |
141 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_seek", &xs_cfg.subsongControl, XS_SSC_SEEK }, | |
142 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_popup", &xs_cfg.subsongControl, XS_SSC_POPUP }, | |
143 { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_patch", &xs_cfg.subsongControl, XS_SSC_PATCH }, | |
144 | |
145 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_detectmagic", &xs_cfg.detectMagic, 0 }, | |
146 | |
147 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_ftitle_override", &xs_cfg.titleOverride, 0 }, | |
148 { WTYPE_TEXT, CTYPE_STR, "cfg_ftitle_format", &xs_cfg.titleFormat, 0 }, | |
149 | |
150 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 }, | |
151 { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 }, | |
152 { WTYPE_SPIN, CTYPE_INT, "cfg_subauto_mintime", &xs_cfg.subAutoMinTime, 0 }, | |
153 }; | |
154 | |
155 static const gint xs_widtable_max = (sizeof(xs_widtable) / sizeof(t_xs_wid_item)); | |
156 | |
157 | |
158 /* | |
159 * Reset/initialize the configuration | |
160 */ | |
161 void xs_init_configuration(void) | |
162 { | |
163 /* Lock configuration mutex */ | |
164 XSDEBUG("initializing configuration ...\n"); | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
165 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 166 |
167 /* Initialize values with sensible defaults */ | |
168 xs_cfg.audioBitsPerSample = XS_RES_16BIT; | |
169 xs_cfg.audioChannels = XS_CHN_MONO; | |
170 xs_cfg.audioFrequency = 44100; | |
171 | |
172 xs_cfg.mos8580 = FALSE; | |
173 xs_cfg.forceModel = FALSE; | |
174 | |
175 xs_cfg.emulateFilters = TRUE; | |
176 xs_cfg.filterFs = XS_SIDPLAY1_FS; | |
177 xs_cfg.filterFm = XS_SIDPLAY1_FM; | |
178 xs_cfg.filterFt = XS_SIDPLAY1_FT; | |
179 | |
180 #ifdef HAVE_SIDPLAY2 | |
181 xs_cfg.playerEngine = XS_ENG_SIDPLAY2; | |
182 xs_cfg.memoryMode = XS_MPU_REAL; | |
183 #else | |
184 #ifdef HAVE_SIDPLAY1 | |
185 xs_cfg.playerEngine = XS_ENG_SIDPLAY1; | |
186 xs_cfg.memoryMode = XS_MPU_BANK_SWITCHING; | |
187 #else | |
188 #error This should not happen! No emulator engines configured in! | |
189 #endif | |
190 #endif | |
191 | |
192 xs_cfg.clockSpeed = XS_CLOCK_PAL; | |
193 xs_cfg.forceSpeed = FALSE; | |
194 | |
195 xs_cfg.sid2OptLevel = FALSE; | |
196 #ifdef HAVE_RESID_BUILDER | |
197 xs_cfg.sid2Builder = XS_BLD_RESID; | |
198 #else | |
199 #ifdef HAVE_HARDSID_BUILDER | |
200 xs_cfg.sid2Builder = XS_BLD_HARDSID; | |
201 #else | |
202 #ifdef HAVE_SIDPLAY2 | |
203 #error This should not happen! No supported SIDPlay2 builders configured in! | |
204 #endif | |
205 #endif | |
206 #endif | |
207 | |
208 xs_cfg.oversampleEnable = FALSE; | |
209 xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE; | |
210 | |
211 xs_cfg.playMaxTimeEnable = FALSE; | |
212 xs_cfg.playMaxTimeUnknown = FALSE; | |
213 xs_cfg.playMaxTime = 150; | |
214 | |
215 xs_cfg.playMinTimeEnable = FALSE; | |
216 xs_cfg.playMinTime = 15; | |
217 | |
218 xs_cfg.songlenDBEnable = FALSE; | |
219 xs_pstrcpy(&xs_cfg.songlenDBPath, "~/C64Music/Songlengths.txt"); | |
220 | |
221 xs_cfg.stilDBEnable = FALSE; | |
222 xs_pstrcpy(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt"); | |
223 xs_pstrcpy(&xs_cfg.hvscPath, "~/C64Music"); | |
224 | |
225 #ifdef HAVE_SONG_POSITION | |
226 xs_cfg.subsongControl = XS_SSC_PATCH; | |
227 #else | |
228 xs_cfg.subsongControl = XS_SSC_POPUP; | |
229 #endif | |
230 | |
231 xs_cfg.detectMagic = FALSE; | |
232 | |
233 #ifdef HAVE_XMMSEXTRA | |
234 xs_cfg.titleOverride = FALSE; | |
235 #else | |
236 xs_cfg.titleOverride = TRUE; | |
237 #endif | |
238 xs_pstrcpy(&xs_cfg.titleFormat, "%p - %t (%c) [%n/%N][%m]"); | |
239 | |
240 | |
241 xs_cfg.subAutoEnable = FALSE; | |
242 xs_cfg.subAutoMinOnly = TRUE; | |
243 xs_cfg.subAutoMinTime = 15; | |
244 | |
245 | |
246 /* Unlock the configuration */ | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
247 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 248 } |
249 | |
250 | |
251 /* | |
252 * Get the configuration (from file or default) | |
253 */ | |
254 void xs_read_configuration(void) | |
255 { | |
256 gchar *tmpStr; | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
257 ConfigDb *db; |
269 | 258 gint i; |
259 | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
260 /* Try to open the configuration database */ |
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
261 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 262 XSDEBUG("loading from config-file ...\n"); |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
263 db = bmp_cfg_db_open(); |
269 | 264 |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
265 /* Read the new settings from configuration database */ |
269 | 266 for (i = 0; i < xs_cfgtable_max; i++) { |
267 switch (xs_cfgtable[i].itemType) { | |
268 case CTYPE_INT: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
269 bmp_cfg_db_get_int(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 270 (gint *) xs_cfgtable[i].itemData); |
271 break; | |
272 | |
273 case CTYPE_BOOL: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
274 bmp_cfg_db_get_bool(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 275 (gboolean *) xs_cfgtable[i].itemData); |
276 break; | |
277 | |
278 case CTYPE_FLOAT: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
279 bmp_cfg_db_get_float(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 280 (gfloat *) xs_cfgtable[i].itemData); |
281 break; | |
282 | |
283 case CTYPE_STR: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
284 if (bmp_cfg_db_get_string |
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
285 (db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, (gchar **) & tmpStr)) { |
269 | 286 /* Read was successfull */ |
287 xs_pstrcpy((gchar **) xs_cfgtable[i].itemData, tmpStr); | |
288 g_free(tmpStr); | |
289 } | |
290 break; | |
291 | |
292 default: | |
293 XSERR | |
294 ("Internal: Unsupported setting type found while reading configuration file. Please report to author!\n"); | |
295 break; | |
296 } | |
297 } | |
298 | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
299 bmp_cfg_db_close(db); |
269 | 300 |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
301 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 302 XSDEBUG("OK\n"); |
303 } | |
304 | |
305 | |
306 | |
307 /* | |
308 * Write the current configuration | |
309 */ | |
310 gint xs_write_configuration(void) | |
311 { | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
312 ConfigDb *db; |
269 | 313 gint i; |
314 | |
315 XSDEBUG("writing configuration ...\n"); | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
316 g_static_mutex_lock(&xs_cfg_mutex); |
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
317 db = bmp_cfg_db_open(); |
269 | 318 |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
319 /* Write the new settings to configuration database */ |
269 | 320 for (i = 0; i < xs_cfgtable_max; i++) { |
321 switch (xs_cfgtable[i].itemType) { | |
322 case CTYPE_INT: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
323 bmp_cfg_db_set_int(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 324 *(gint *) xs_cfgtable[i].itemData); |
325 break; | |
326 | |
327 case CTYPE_BOOL: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
328 bmp_cfg_db_set_bool(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 329 *(gboolean *) xs_cfgtable[i].itemData); |
330 break; | |
331 | |
332 case CTYPE_FLOAT: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
333 bmp_cfg_db_set_float(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 334 *(gfloat *) xs_cfgtable[i].itemData); |
335 break; | |
336 | |
337 case CTYPE_STR: | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
338 bmp_cfg_db_set_string(db, XS_CONFIG_IDENT, xs_cfgtable[i].itemName, |
269 | 339 *(gchar **) xs_cfgtable[i].itemData); |
340 break; | |
341 | |
342 default: | |
343 XSERR | |
344 ("Internal: Unsupported setting type found while writing configuration file. Please report to author!\n"); | |
345 break; | |
346 } | |
347 } | |
348 | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
349 bmp_cfg_db_close(db); |
269 | 350 |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
351 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 352 |
353 return 0; | |
354 } | |
355 | |
356 | |
357 /* | |
358 * Configuration panel was canceled | |
359 */ | |
360 void xs_cfg_cancel(void) | |
361 { | |
362 gtk_widget_destroy(xs_configwin); | |
363 xs_configwin = NULL; | |
364 } | |
365 | |
366 | |
367 /* | |
368 * Configuration was accepted (OK), save the settings | |
369 */ | |
370 void xs_cfg_ok(void) | |
371 { | |
372 gint i; | |
373 gfloat tmpValue; | |
374 | |
375 XSDEBUG("get data from widgets to config...\n"); | |
376 | |
377 for (i = 0; i < xs_widtable_max; i++) { | |
378 switch (xs_widtable[i].widType) { | |
379 case WTYPE_BGROUP: | |
380 /* Check if toggle-button is active */ | |
381 if (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active) { | |
382 /* Yes, set the constant value */ | |
383 *((gint *) xs_widtable[i].itemData) = xs_widtable[i].itemSet; | |
384 } | |
385 break; | |
386 | |
387 case WTYPE_SPIN: | |
388 case WTYPE_SCALE: | |
389 /* Get the value */ | |
390 switch (xs_widtable[i].widType) { | |
391 case WTYPE_SPIN: | |
392 tmpValue = | |
393 gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName)))->value; | |
394 break; | |
395 | |
396 case WTYPE_SCALE: | |
397 tmpValue = gtk_range_get_adjustment(GTK_RANGE(LUW(xs_widtable[i].widName)))->value; | |
398 break; | |
399 | |
400 default: | |
401 tmpValue = -1; | |
402 } | |
403 | |
404 /* Set the value */ | |
405 switch (xs_widtable[i].itemType) { | |
406 case CTYPE_INT: | |
407 *((gint *) xs_widtable[i].itemData) = (gint) tmpValue; | |
408 break; | |
409 | |
410 case CTYPE_FLOAT: | |
411 *((gfloat *) xs_widtable[i].itemData) = tmpValue; | |
412 break; | |
413 } | |
414 break; | |
415 | |
416 case WTYPE_BUTTON: | |
417 /* Check if toggle-button is active */ | |
418 *((gboolean *) xs_widtable[i].itemData) = | |
419 (GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName))->active); | |
420 break; | |
421 | |
422 case WTYPE_TEXT: | |
423 /* Get text from text-widget */ | |
424 xs_pstrcpy((gchar **) xs_widtable[i].itemData, | |
425 gtk_entry_get_text(GTK_ENTRY(LUW(xs_widtable[i].widName))) | |
426 ); | |
427 break; | |
428 } | |
429 } | |
430 | |
431 /* Close window */ | |
432 gtk_widget_destroy(xs_configwin); | |
433 xs_configwin = NULL; | |
434 | |
435 /* Write settings */ | |
436 xs_write_configuration(); | |
437 | |
438 /* Re-initialize */ | |
439 xs_reinit(); | |
440 } | |
441 | |
442 | |
443 /* | |
444 * Reset filter settings to defaults | |
445 */ | |
446 void xs_cfg_filter_reset(GtkButton * button, gpointer user_data) | |
447 { | |
448 (void) button; | |
449 (void) user_data; | |
450 | |
451 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_fs"))), XS_SIDPLAY1_FS); | |
452 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_fm"))), XS_SIDPLAY1_FM); | |
453 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_emu_filt_ft"))), XS_SIDPLAY1_FT); | |
454 } | |
455 | |
456 | |
457 | |
458 | |
459 /* | |
460 * HVSC songlength-database file selector response-functions | |
461 */ | |
462 void xs_cfg_sld_dbbrowse(GtkButton * button, gpointer user_data) | |
463 { | |
464 (void) button; | |
465 (void) user_data; | |
466 | |
467 if (xs_sldb_fileselector != NULL) { | |
468 gdk_window_raise(xs_sldb_fileselector->window); | |
469 return; | |
470 } | |
471 | |
472 xs_sldb_fileselector = create_xs_sldbfileselector(); | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
473 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 474 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_sldb_fileselector), xs_cfg.songlenDBPath); |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
475 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 476 gtk_widget_show(xs_sldb_fileselector); |
477 } | |
478 | |
479 | |
480 void xs_cfg_sldb_fs_ok(void) | |
481 { | |
482 /* Selection was accepted! */ | |
483 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_sld_dbpath")), | |
484 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_sldb_fileselector))); | |
485 | |
486 /* Close file selector window */ | |
487 gtk_widget_destroy(xs_sldb_fileselector); | |
488 xs_sldb_fileselector = NULL; | |
489 } | |
490 | |
491 | |
492 void xs_cfg_sldb_fs_cancel(void) | |
493 { | |
494 /* Close file selector window */ | |
495 gtk_widget_destroy(xs_sldb_fileselector); | |
496 xs_sldb_fileselector = NULL; | |
497 } | |
498 | |
499 | |
500 /* | |
501 * STIL-database file selector response-functions | |
502 */ | |
503 void xs_cfg_stil_browse(GtkButton * button, gpointer user_data) | |
504 { | |
505 (void) button; | |
506 (void) user_data; | |
507 | |
508 if (xs_stil_fileselector != NULL) { | |
509 gdk_window_raise(xs_stil_fileselector->window); | |
510 return; | |
511 } | |
512 | |
513 xs_stil_fileselector = create_xs_stilfileselector(); | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
514 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 515 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_stil_fileselector), xs_cfg.stilDBPath); |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
516 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 517 gtk_widget_show(xs_stil_fileselector); |
518 } | |
519 | |
520 | |
521 void xs_cfg_stil_fs_ok(void) | |
522 { | |
523 /* Selection was accepted! */ | |
524 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_stil_dbpath")), | |
525 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_stil_fileselector))); | |
526 | |
527 /* Close file selector window */ | |
528 gtk_widget_destroy(xs_stil_fileselector); | |
529 xs_stil_fileselector = NULL; | |
530 } | |
531 | |
532 | |
533 void xs_cfg_stil_fs_cancel(void) | |
534 { | |
535 /* Close file selector window */ | |
536 gtk_widget_destroy(xs_stil_fileselector); | |
537 xs_stil_fileselector = NULL; | |
538 } | |
539 | |
540 | |
541 /* | |
542 * HVSC location selector response-functions | |
543 */ | |
544 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data) | |
545 { | |
546 (void) button; | |
547 (void) user_data; | |
548 | |
549 if (xs_hvsc_pathselector != NULL) { | |
550 gdk_window_raise(xs_hvsc_pathselector->window); | |
551 return; | |
552 } | |
553 | |
554 xs_hvsc_pathselector = create_xs_hvscpathselector(); | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
555 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 556 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_hvsc_pathselector), xs_cfg.hvscPath); |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
557 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 558 gtk_widget_show(xs_hvsc_pathselector); |
559 } | |
560 | |
561 | |
562 void xs_cfg_hvsc_fs_ok(void) | |
563 { | |
564 /* Selection was accepted! */ | |
565 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), | |
566 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_pathselector))); | |
567 | |
568 /* Close file selector window */ | |
569 gtk_widget_destroy(xs_hvsc_pathselector); | |
570 xs_hvsc_pathselector = NULL; | |
571 } | |
572 | |
573 | |
574 void xs_cfg_hvsc_fs_cancel(void) | |
575 { | |
576 /* Close file selector window */ | |
577 gtk_widget_destroy(xs_hvsc_pathselector); | |
578 xs_hvsc_pathselector = NULL; | |
579 } | |
580 | |
581 | |
582 /* | |
583 * Selection toggle handlers | |
584 */ | |
585 void xs_cfg_emu_filters_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
586 { | |
587 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
588 | |
589 (void) user_data; | |
590 | |
591 gtk_widget_set_sensitive(LUW("cfg_filters_notebook"), isActive); | |
592 } | |
593 | |
594 | |
595 void xs_cfg_ftitle_override_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
596 { | |
597 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
598 | |
599 (void) user_data; | |
600 | |
601 gtk_widget_set_sensitive(LUW("cfg_ftitle_format"), isActive); | |
602 gtk_widget_set_sensitive(LUW("cfg_ftitle_desc1"), isActive); | |
603 gtk_widget_set_sensitive(LUW("cfg_ftitle_desc2"), isActive); | |
604 } | |
605 | |
606 | |
607 void xs_cfg_emu_sidplay1_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
608 { | |
609 (void) togglebutton; | |
610 (void) user_data; | |
611 } | |
612 | |
613 | |
614 void xs_cfg_emu_sidplay2_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
615 { | |
616 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
617 | |
618 (void) user_data; | |
619 | |
620 gtk_widget_set_sensitive(LUW("cfg_emu_mem_real"), isActive); | |
621 | |
622 gtk_widget_set_sensitive(LUW("cfg_sidplay2_grp"), isActive); | |
623 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_opt"), isActive); | |
624 | |
625 gtk_widget_set_sensitive(LUW("cfg_chn_autopan"), !isActive); | |
626 | |
627 #ifdef HAVE_RESID_BUILDER | |
628 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_resid"), isActive); | |
629 #else | |
630 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_resid"), FALSE); | |
631 #endif | |
632 | |
633 #ifdef HAVE_HARDSID_BUILDER | |
634 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_hardsid"), isActive); | |
635 #else | |
636 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_hardsid"), FALSE); | |
637 #endif | |
638 } | |
639 | |
640 | |
641 void xs_cfg_oversample_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
642 { | |
643 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
644 | |
645 (void) user_data; | |
646 | |
647 gtk_widget_set_sensitive(LUW("cfg_oversample_factor"), isActive); | |
648 gtk_widget_set_sensitive(LUW("cfg_oversample_label1"), isActive); | |
649 gtk_widget_set_sensitive(LUW("cfg_oversample_label2"), isActive); | |
650 } | |
651 | |
652 | |
653 void xs_cfg_mintime_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
654 { | |
655 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
656 | |
657 (void) user_data; | |
658 | |
659 gtk_widget_set_sensitive(LUW("cfg_mintime"), isActive); | |
660 gtk_widget_set_sensitive(LUW("cfg_mintime_label1"), isActive); | |
661 gtk_widget_set_sensitive(LUW("cfg_mintime_label2"), isActive); | |
662 } | |
663 | |
664 | |
665 void xs_cfg_maxtime_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
666 { | |
667 gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_maxtime_enable"))->active; | |
668 | |
669 (void) togglebutton; | |
670 (void) user_data; | |
671 | |
672 gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive); | |
673 gtk_widget_set_sensitive(LUW("cfg_maxtime"), isActive); | |
674 gtk_widget_set_sensitive(LUW("cfg_maxtime_label1"), isActive); | |
675 gtk_widget_set_sensitive(LUW("cfg_maxtime_label2"), isActive); | |
676 } | |
677 | |
678 | |
679 void xs_cfg_sld_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
680 { | |
681 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
682 | |
683 (void) user_data; | |
684 | |
685 gtk_widget_set_sensitive(LUW("cfg_sld_dbpath"), isActive); | |
686 gtk_widget_set_sensitive(LUW("cfg_sld_dbbrowse"), isActive); | |
687 gtk_widget_set_sensitive(LUW("cfg_sld_label1"), isActive); | |
688 } | |
689 | |
690 | |
691 void xs_cfg_stil_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
692 { | |
693 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
694 | |
695 (void) user_data; | |
696 | |
697 gtk_widget_set_sensitive(LUW("cfg_stil_dbpath"), isActive); | |
698 gtk_widget_set_sensitive(LUW("cfg_stil_browse"), isActive); | |
699 gtk_widget_set_sensitive(LUW("cfg_stil_label1"), isActive); | |
700 | |
701 gtk_widget_set_sensitive(LUW("cfg_hvsc_path"), isActive); | |
702 gtk_widget_set_sensitive(LUW("cfg_hvsc_browse"), isActive); | |
703 gtk_widget_set_sensitive(LUW("cfg_hvsc_label1"), isActive); | |
704 } | |
705 | |
706 | |
707 void xs_cfg_subauto_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
708 { | |
709 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | |
710 | |
711 (void) user_data; | |
712 | |
713 gtk_widget_set_sensitive(LUW("cfg_subauto_min_only"), isActive); | |
714 gtk_widget_set_sensitive(LUW("cfg_subauto_mintime"), isActive); | |
715 } | |
716 | |
717 | |
718 void xs_cfg_subauto_min_only_toggled(GtkToggleButton * togglebutton, gpointer user_data) | |
719 { | |
720 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active && | |
721 GTK_TOGGLE_BUTTON(LUW("cfg_subauto_enable"))->active; | |
722 | |
723 (void) user_data; | |
724 | |
725 gtk_widget_set_sensitive(LUW("cfg_subauto_mintime"), isActive); | |
726 } | |
727 | |
728 | |
729 void xs_cfg_mintime_changed(GtkEditable * editable, gpointer user_data) | |
730 { | |
731 gint tmpValue; | |
732 GtkAdjustment *tmpAdj; | |
733 | |
734 (void) user_data; | |
735 | |
736 tmpAdj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_maxtime"))); | |
737 | |
738 tmpValue = (gint) gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(editable))->value; | |
739 | |
740 if (tmpValue > tmpAdj->value) | |
741 gtk_adjustment_set_value(tmpAdj, tmpValue); | |
742 } | |
743 | |
744 | |
745 void xs_cfg_maxtime_changed(GtkEditable * editable, gpointer user_data) | |
746 { | |
747 gint tmpValue; | |
748 GtkAdjustment *tmpAdj; | |
749 | |
750 (void) user_data; | |
751 | |
752 tmpAdj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_mintime"))); | |
753 | |
754 tmpValue = (gint) gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(editable))->value; | |
755 | |
756 if (tmpValue < tmpAdj->value) | |
757 gtk_adjustment_set_value(tmpAdj, tmpValue); | |
758 } | |
759 | |
760 | |
761 void xs_cfg_filter2_reset(GtkButton * button, gpointer user_data) | |
762 { | |
763 (void) button; (void) user_data; | |
764 } | |
765 | |
766 /* | |
767 * Execute the configuration panel | |
768 */ | |
769 void xs_configure(void) | |
770 { | |
771 gint i; | |
772 gfloat tmpValue; | |
773 | |
774 /* Check if the window already exists */ | |
775 if (xs_configwin != NULL) { | |
776 gdk_window_raise(xs_configwin->window); | |
777 return; | |
778 } | |
779 | |
780 /* Create the window */ | |
781 xs_configwin = create_xs_configwin(); | |
782 | |
783 /* Get lock on configuration */ | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
784 g_static_mutex_lock(&xs_cfg_mutex); |
269 | 785 |
786 /* Based on available optional parts, gray out options */ | |
787 #ifndef HAVE_SIDPLAY1 | |
788 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE); | |
789 gtk_widget_set_sensitive(LUW("cfg_box_sidplay1"), FALSE); | |
790 #endif | |
791 | |
792 #ifndef HAVE_SIDPLAY2 | |
793 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2"), FALSE); | |
794 gtk_widget_set_sensitive(LUW("cfg_box_sidplay2"), FALSE); | |
795 #endif | |
796 | |
797 #ifndef HAVE_XMMSEXTRA | |
798 gtk_widget_set_sensitive(LUW("cfg_ftitle_override"), FALSE); | |
799 xs_cfg.titleOverride = TRUE; | |
800 #endif | |
801 | |
802 #ifndef HAVE_SONG_POSITION | |
803 gtk_widget_set_sensitive(LUW("cfg_subctrl_patch"), FALSE); | |
804 #endif | |
805 | |
806 /* Update the widget sensitivities */ | |
807 xs_cfg_emu_filters_toggled((GtkToggleButton *) LUW("cfg_emu_filters"), NULL); | |
808 xs_cfg_ftitle_override_toggled((GtkToggleButton *) LUW("cfg_ftitle_override"), NULL); | |
809 xs_cfg_emu_sidplay1_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay1"), NULL); | |
810 xs_cfg_emu_sidplay2_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay2"), NULL); | |
811 xs_cfg_oversample_toggled((GtkToggleButton *) LUW("cfg_oversample"), NULL); | |
812 xs_cfg_mintime_enable_toggled((GtkToggleButton *) LUW("cfg_mintime_enable"), NULL); | |
813 xs_cfg_maxtime_enable_toggled((GtkToggleButton *) LUW("cfg_maxtime_enable"), NULL); | |
814 xs_cfg_sld_enable_toggled((GtkToggleButton *) LUW("cfg_sld_enable"), NULL); | |
815 xs_cfg_stil_enable_toggled((GtkToggleButton *) LUW("cfg_stil_enable"), NULL); | |
816 xs_cfg_subauto_enable_toggled((GtkToggleButton *) LUW("cfg_subauto_enable"), NULL); | |
817 xs_cfg_subauto_min_only_toggled((GtkToggleButton *) LUW("cfg_subauto_min_only"), NULL); | |
818 | |
819 | |
820 /* Set current data to widgets */ | |
821 for (i = 0; i < xs_widtable_max; i++) { | |
822 switch (xs_widtable[i].widType) { | |
823 case WTYPE_BGROUP: | |
824 /* Check if current value matches the given one */ | |
825 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)), | |
826 (*((gint *) xs_widtable[i].itemData) == xs_widtable[i].itemSet) | |
827 ); | |
828 break; | |
829 | |
830 | |
831 case WTYPE_SPIN: | |
832 case WTYPE_SCALE: | |
833 /* Get the value */ | |
834 switch (xs_widtable[i].itemType) { | |
835 case CTYPE_INT: | |
836 tmpValue = (gfloat) * ((gint *) xs_widtable[i].itemData); | |
837 break; | |
838 | |
839 case CTYPE_FLOAT: | |
840 tmpValue = *((gfloat *) xs_widtable[i].itemData); | |
841 break; | |
842 | |
843 default: | |
844 tmpValue = -1; | |
845 } | |
846 | |
847 /* Set the value */ | |
848 switch (xs_widtable[i].widType) { | |
849 case WTYPE_SPIN: | |
850 gtk_adjustment_set_value(gtk_spin_button_get_adjustment | |
851 (GTK_SPIN_BUTTON(LUW(xs_widtable[i].widName))), tmpValue); | |
852 break; | |
853 | |
854 case WTYPE_SCALE: | |
855 gtk_adjustment_set_value(gtk_range_get_adjustment | |
856 (GTK_RANGE(LUW(xs_widtable[i].widName))), tmpValue); | |
857 break; | |
858 } | |
859 break; | |
860 | |
861 case WTYPE_BUTTON: | |
862 /* Set toggle-button */ | |
863 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LUW(xs_widtable[i].widName)), | |
864 *((gboolean *) xs_widtable[i].itemData) | |
865 ); | |
866 break; | |
867 | |
868 case WTYPE_TEXT: | |
869 /* Set text to text-widget */ | |
870 if (*(gchar **) xs_widtable[i].itemData != NULL) { | |
871 gtk_entry_set_text(GTK_ENTRY(LUW(xs_widtable[i].widName)), | |
872 *(gchar **) xs_widtable[i].itemData); | |
873 } | |
874 break; | |
875 } | |
876 } | |
877 | |
878 /* Release the configuration */ | |
304
d0e9693d2115
[svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents:
269
diff
changeset
|
879 g_static_mutex_unlock(&xs_cfg_mutex); |
269 | 880 |
881 /* Show the widget */ | |
882 gtk_widget_show(xs_configwin); | |
883 } |