annotate src/rootvis/config_backend.c @ 2179:2f6d5e1a22cd

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme.org>
date Tue, 20 Nov 2007 02:00:52 -0600
parents b8da6a0b0da2
children 7b284f323ad8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
1 #include <string.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
2 #include <audacious/configdb.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
3
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
4 #include <rootvis.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
5 #include <config.h>
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
6
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
7 extern void config_def_init(void);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
8 extern void config_frontend_init(void);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
9
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
10 void color_quad2arr(unsigned char* res, char* quad) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
11 if (sscanf(quad, "#%2hhx%2hhx%2hhx%2hhx", &res[0], &res[1], &res[2], &res[3]) != 4)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
12 fprintf(stderr, "Color value %s could not be recognized as #rrggbbaa, ranging from #00000000 to #FFFFFFFF\n", quad);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
13 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
14
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
15 char* color_arr2quad(unsigned char* src, char* quad) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
16 sprintf(quad, "#%2.2hhx%2.2hhx%2.2hhx%2.2hhx", src[0], src[1], src[2], src[3]);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
17 return quad;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
18 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
19
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
20 void cval_setdefault(struct config_value val)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
21 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
22 switch (val.type)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
23 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
24 case BOOLN:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
25 case INT:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
26 *val.vali.var = val.vali.def_value;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
27 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
28 case FLOAT:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
29 *val.valf.var = val.valf.def_value;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
30 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
31 case TEXT:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
32 strcpy(*val.valt.var, val.valt.def_value);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
33 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
34 case COLOR:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
35 color_quad2arr(val.valc.var, val.valc.def_value);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
36 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
37 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
38 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
39
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
40 void cval_writefile(struct config_value val, ConfigDb *fp, char* sect)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
41 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
42 switch (val.type)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
43 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
44 case BOOLN:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
45 case INT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
46 aud_cfg_db_set_int(fp, sect, val.name, *val.vali.var);
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
47 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
48 case FLOAT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
49 aud_cfg_db_set_float(fp, sect, val.name, *val.valf.var);
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
50 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
51 case TEXT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
52 aud_cfg_db_set_string(fp, sect, val.name, *val.valt.var);
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
53 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
54 case COLOR:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
55 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
56 char colortmp[10];
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
57 aud_cfg_db_set_string(fp, sect, val.name, color_arr2quad(val.valc.var, colortmp));
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
58 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
59 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
60 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
61 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
62
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
63 void cval_readfile(struct config_value val, ConfigDb *fp, char* sect)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
64 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
65 switch (val.type)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
66 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
67 case BOOLN:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
68 case INT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
69 if (!(aud_cfg_db_get_int(fp, sect, val.name, val.vali.var)))
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
70 cval_writefile(val, fp, sect);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
71 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
72 case FLOAT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
73 if (!(aud_cfg_db_get_float(fp, sect, val.name, val.valf.var)))
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
74 cval_writefile(val, fp, sect);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
75 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
76 case TEXT:
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
77 if (!(aud_cfg_db_get_string(fp, sect, val.name, val.valt.var)))
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
78 cval_writefile(val, fp, sect);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
79 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
80 case COLOR:
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
81 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
82 char* colortmp = NULL;
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
83 if (!(aud_cfg_db_get_string(fp, sect, val.name, &colortmp)))
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
84 cval_writefile(val, fp, sect);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
85 else color_quad2arr(val.valc.var, colortmp);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
86 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
87 break;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
88 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
89 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
90
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
91 // this parses ~/.xmms/config
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
92 // if a setting is not found, it is created to make it possible to edit the default settings
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
93 // after the configuration dialogue is finished, this won't be necessary any more
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
94 void config_read(int number) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
95 int i, j;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
96 ConfigDb *fp;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
97
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
98 fp = aud_cfg_db_open();
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
99
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
100 print_status("Reading configuration");
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
101
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
102 if (number == 2)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
103 for (i = 0; i < Cmain.count; ++i)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
104 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
105 cval_setdefault(Cmain.def[i]);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
106 cval_readfile(Cmain.def[i], fp, "rootvis");
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
107 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
108
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
109 for (j = 0; j < 2; ++j)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
110 if ((number == j)||(number == 2))
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
111 for (i = 0; i < Cchannel[j].count; ++i)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
112 {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
113 cval_setdefault(Cchannel[j].def[i]);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
114 cval_readfile(Cchannel[j].def[i], fp, (j == 0 ? "rootvis" : "rootvis2"));
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
115 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
116
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
117 aud_cfg_db_close(fp);
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
118 print_status("Configuration finished");
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
119 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
120
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
121 void config_write(int number) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
122 int i, j;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
123 ConfigDb *fp;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
124
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
125 print_status("Writing configuration");
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
126 fp = aud_cfg_db_open();
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
127
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
128 if (number == 2)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
129 for (i = 0; i < Cmain.count; ++i)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
130 cval_writefile(Cmain.def[i], fp, "rootvis");
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
131
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
132 for (j = 0; j < 2; ++j)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
133 if ((number == j)||(number == 2))
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
134 for (i = 0; i < Cchannel[j].count; ++i)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
135 cval_writefile(Cchannel[j].def[i], fp, (j == 0 ? "rootvis" : "rootvis2"));
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
136
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 900
diff changeset
137 aud_cfg_db_close(fp);
900
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
138 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
139
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
140 void config_revert(int number) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
141 /* as the configs aren't saved in a thread save way, we have to lock while we read them */
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
142 threads_lock();
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
143 config_read(number);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
144
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
145 // set the right change bits, according to wether we change channel 0, 1 or both (2)
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
146 if (number == 2) number = 15;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
147 else number = 3 + number*9;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
148 threads_unlock(number);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
149 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
150
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
151 void config_save(int number) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
152 threads_lock();
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
153 config_write(number);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
154 threads_unlock(0);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
155 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
156
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
157 void config_init(void) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
158 static int initialized = 0;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
159 if (initialized == 0) {
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
160 print_status("First initialization");
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
161
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
162 conf.geo[0].display = malloc(256);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
163 conf.geo[1].display = malloc(256);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
164
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
165 config_def_init();
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
166 config_frontend_init();
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
167
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
168 config_read(2);
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
169
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
170 initialized++;
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
171 }
d985f0dcdeb0 [svn] - add a starting point for xmms-rootvis port. giacomo will need to
nenolod
parents:
diff changeset
172 }