Mercurial > audlegacy
annotate src/audacious/configdb.c @ 4621:fb56923e8206
Updated pkg.m4.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 05 Jun 2008 16:04:18 +0300 |
parents | a6a2e84e2b2e |
children | 0ea6dd6bfb5a |
rev | line source |
---|---|
3112
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
1 /* This program is free software; you can redistribute it and/or modify |
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
2 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3112
diff
changeset
|
3 * the Free Software Foundation; under version 3 of the License. |
2313 | 4 * |
3112
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
5 * This program is distributed in the hope that it will be useful, |
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
8 * GNU General Public License for more details. |
2313 | 9 * |
3112
4c758281fe8f
Backed out changeset d226b83fa3298fc92f25f9519befcd754f44b0ef
William Pitcock <nenolod@atheme-project.org>
parents:
2865
diff
changeset
|
10 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3112
diff
changeset
|
11 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
12 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
13 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
14 * Audacious or using our public API to be a derived work. |
2313 | 15 */ |
16 | |
17 #ifdef HAVE_CONFIG_H | |
18 # include "config.h" | |
19 #endif | |
20 | |
21 #include "configdb.h" | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
22 #include <libmcs/mcs.h> |
2314
d5d95a459a19
[svn] - fix: E:configdb_rcfile.c(45) [bmp_cfg_db_open]:Autoconversion of integer to pointer is not allowed in C99
nenolod
parents:
2313
diff
changeset
|
23 #include <stdlib.h> |
2313 | 24 #include <string.h> |
2358 | 25 |
2313 | 26 |
27 #define RCFILE_DEFAULT_SECTION_NAME "audacious" | |
28 | |
2358 | 29 static gboolean mcs_initted = FALSE; |
2313 | 30 |
31 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
32 mcs_handle_t * |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3123
diff
changeset
|
33 cfg_db_open() |
2313 | 34 { |
2358 | 35 if (!mcs_initted) |
36 { | |
37 mcs_init(); | |
38 mcs_initted = TRUE; | |
2325
63c9a2724e73
[svn] - revert r3646 because it is not a user-friendly method of transitioning.
nenolod
parents:
2318
diff
changeset
|
39 } |
2313 | 40 |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
41 return mcs_new(RCFILE_DEFAULT_SECTION_NAME); |
2313 | 42 } |
43 | |
44 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
45 cfg_db_close(mcs_handle_t * db) |
2313 | 46 { |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
47 mcs_destroy(db); |
2313 | 48 } |
49 | |
50 gboolean | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
51 cfg_db_get_string(mcs_handle_t * db, |
2313 | 52 const gchar * section, |
53 const gchar * key, | |
54 gchar ** value) | |
55 { | |
56 if (!section) | |
57 section = RCFILE_DEFAULT_SECTION_NAME; | |
58 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
59 return mcs_get_string(db, section, key, value); |
2313 | 60 } |
61 | |
62 gboolean | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
63 cfg_db_get_int(mcs_handle_t * db, |
2313 | 64 const gchar * section, const gchar * key, gint * value) |
65 { | |
66 if (!section) | |
67 section = RCFILE_DEFAULT_SECTION_NAME; | |
68 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
69 return mcs_get_int(db, section, key, value); |
2313 | 70 } |
71 | |
72 gboolean | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
73 cfg_db_get_bool(mcs_handle_t * db, |
2313 | 74 const gchar * section, |
75 const gchar * key, | |
76 gboolean * value) | |
77 { | |
78 if (!section) | |
79 section = RCFILE_DEFAULT_SECTION_NAME; | |
80 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
81 return mcs_get_bool(db, section, key, value); |
2313 | 82 } |
83 | |
84 gboolean | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
85 cfg_db_get_float(mcs_handle_t * db, |
2313 | 86 const gchar * section, |
87 const gchar * key, | |
88 gfloat * value) | |
89 { | |
90 if (!section) | |
91 section = RCFILE_DEFAULT_SECTION_NAME; | |
92 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
93 return mcs_get_float(db, section, key, value); |
2313 | 94 } |
95 | |
96 gboolean | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
97 cfg_db_get_double(mcs_handle_t * db, |
2313 | 98 const gchar * section, |
99 const gchar * key, | |
100 gdouble * value) | |
101 { | |
102 if (!section) | |
103 section = RCFILE_DEFAULT_SECTION_NAME; | |
104 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
105 return mcs_get_double(db, section, key, value); |
2313 | 106 } |
107 | |
108 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
109 cfg_db_set_string(mcs_handle_t * db, |
2313 | 110 const gchar * section, |
111 const gchar * key, | |
2346
0b98ad8c8b17
[svn] removed xmms_create_dirbrowser, small config db fixes
mf0102
parents:
2326
diff
changeset
|
112 const gchar * value) |
2313 | 113 { |
114 if (!section) | |
115 section = RCFILE_DEFAULT_SECTION_NAME; | |
116 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
117 mcs_set_string(db, section, key, value); |
2313 | 118 } |
119 | |
120 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
121 cfg_db_set_int(mcs_handle_t * db, |
2313 | 122 const gchar * section, |
123 const gchar * key, | |
124 gint value) | |
125 { | |
126 if (!section) | |
127 section = RCFILE_DEFAULT_SECTION_NAME; | |
128 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
129 mcs_set_int(db, section, key, value); |
2313 | 130 } |
131 | |
132 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
133 cfg_db_set_bool(mcs_handle_t * db, |
2313 | 134 const gchar * section, |
135 const gchar * key, | |
136 gboolean value) | |
137 { | |
138 if (!section) | |
139 section = RCFILE_DEFAULT_SECTION_NAME; | |
140 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
141 mcs_set_bool(db, section, key, value); |
2313 | 142 } |
143 | |
144 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
145 cfg_db_set_float(mcs_handle_t * db, |
2313 | 146 const gchar * section, |
147 const gchar * key, | |
148 gfloat value) | |
149 { | |
150 if (!section) | |
151 section = RCFILE_DEFAULT_SECTION_NAME; | |
152 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
153 mcs_set_float(db, section, key, value); |
2313 | 154 } |
155 | |
156 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
157 cfg_db_set_double(mcs_handle_t * db, |
2313 | 158 const gchar * section, |
159 const gchar * key, | |
160 gdouble value) | |
161 { | |
162 if (!section) | |
163 section = RCFILE_DEFAULT_SECTION_NAME; | |
164 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
165 mcs_set_double(db, section, key, value); |
2313 | 166 } |
167 | |
168 void | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
169 cfg_db_unset_key(mcs_handle_t * db, |
2313 | 170 const gchar * section, |
171 const gchar * key) | |
172 { | |
173 g_return_if_fail(db != NULL); | |
174 g_return_if_fail(key != NULL); | |
175 | |
176 if (!section) | |
177 section = RCFILE_DEFAULT_SECTION_NAME; | |
178 | |
4433
a6a2e84e2b2e
Use mcs_handle_t directly instead of ConfigDb struct to remove the useless wrapper.
Matti Hamalainen <ccr@tnsp.org>
parents:
3686
diff
changeset
|
179 mcs_unset_key(db, section, key); |
2313 | 180 } |