annotate libaudacious/configdb_gconf.c @ 160:faa50a5760ee trunk

[svn] Do not try to build LIRC when not enabled.
author chainsaw
date Sat, 12 Nov 2005 17:20:49 -0800
parents cb178e5ad177
children c8cf439179b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 #include "configdb.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 #include <gconf/gconf-client.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #define BMP_CONFIG_BASE_PATH "/apps/audacious"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 struct _ConfigDb {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 GConfClient *client;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 ConfigDb *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 bmp_cfg_db_open()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 ConfigDb *db;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 db = g_new(ConfigDb, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 db->client = gconf_client_get_default();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 return db;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 bmp_cfg_db_close(ConfigDb * db)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 g_object_unref(db->client);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 static gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 build_keypath(const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 if (section == NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 return g_strconcat(BMP_CONFIG_BASE_PATH, "/", key, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 return g_strconcat(BMP_CONFIG_BASE_PATH, "/", section, "/",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 key, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 bmp_cfg_db_get_value(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 GConfValue ** value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 g_return_val_if_fail(db != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 *value = gconf_client_get(db->client, path, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 return (*value != NULL) ? TRUE : FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 bmp_cfg_db_set_value(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 GConfValue * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 g_return_if_fail(db != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 g_return_if_fail(value != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 gconf_client_set(db->client, path, value, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 bmp_cfg_db_get_string(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 gchar ** value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 if (cval->type != GCONF_VALUE_STRING)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 *value = strdup(gconf_value_get_string(cval));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 bmp_cfg_db_get_int(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 gint * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 if (cval->type != GCONF_VALUE_INT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 *value = gconf_value_get_int(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 bmp_cfg_db_get_bool(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 gboolean * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 if (cval->type != GCONF_VALUE_BOOL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 *value = gconf_value_get_bool(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 bmp_cfg_db_get_float(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 gfloat * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 if (cval->type != GCONF_VALUE_FLOAT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 *value = gconf_value_get_float(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 bmp_cfg_db_get_double(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 gdouble * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 if (cval->type != GCONF_VALUE_FLOAT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 *value = gconf_value_get_float(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 bmp_cfg_db_set_string(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 gchar * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 cval = gconf_value_new(GCONF_VALUE_STRING);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 gconf_value_set_string(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 bmp_cfg_db_set_int(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 gint value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 cval = gconf_value_new(GCONF_VALUE_INT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 gconf_value_set_int(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 bmp_cfg_db_set_bool(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 gboolean value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 cval = gconf_value_new(GCONF_VALUE_BOOL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 gconf_value_set_bool(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 bmp_cfg_db_set_float(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 gfloat value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 cval = gconf_value_new(GCONF_VALUE_FLOAT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 gconf_value_set_float(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 bmp_cfg_db_set_double(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 gdouble value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 cval = gconf_value_new(GCONF_VALUE_FLOAT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 gconf_value_set_float(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 bmp_cfg_db_unset_key(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 g_return_if_fail(db != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 gconf_client_unset(db->client, path, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 }