annotate libaudacious/configdb_gconf.c @ 2203:60bd49189fde trunk

[svn] - two realcolour modes for voiceprint vis: Fire and Ice - removed duplicate code from vis.c
author marvin
date Fri, 22 Dec 2006 20:10:22 -0800
parents c525c2b6a3d8
children
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
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
13 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
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 #define BMP_CONFIG_BASE_PATH "/apps/audacious"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 struct _ConfigDb {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 GConfClient *client;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 ConfigDb *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 bmp_cfg_db_open()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 ConfigDb *db;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31
1449
a69db3a15bf2 [svn] - experimental change to bmp_cfg_db_open() to ensure that g_type_init()
nenolod
parents: 1446
diff changeset
32 g_type_init();
a69db3a15bf2 [svn] - experimental change to bmp_cfg_db_open() to ensure that g_type_init()
nenolod
parents: 1446
diff changeset
33
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 db = g_new(ConfigDb, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 db->client = gconf_client_get_default();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 return db;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 bmp_cfg_db_close(ConfigDb * db)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 {
1446
7610ab1233a7 [svn] - be more paranoid about NULL pointers
nenolod
parents: 813
diff changeset
44 g_return_if_fail(db != NULL);
7610ab1233a7 [svn] - be more paranoid about NULL pointers
nenolod
parents: 813
diff changeset
45
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 g_object_unref(db->client);
813
c8cf439179b8 [svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents: 0
diff changeset
47 g_free(db);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 static gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 build_keypath(const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 if (section == NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 return g_strconcat(BMP_CONFIG_BASE_PATH, "/", key, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 return g_strconcat(BMP_CONFIG_BASE_PATH, "/", section, "/",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 key, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 bmp_cfg_db_get_value(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 GConfValue ** value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 g_return_val_if_fail(db != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 *value = gconf_client_get(db->client, path, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 return (*value != NULL) ? TRUE : FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 bmp_cfg_db_set_value(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 GConfValue * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 g_return_if_fail(db != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 g_return_if_fail(value != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 gconf_client_set(db->client, path, value, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 bmp_cfg_db_get_string(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 gchar ** value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 if (cval->type != GCONF_VALUE_STRING)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 *value = strdup(gconf_value_get_string(cval));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 bmp_cfg_db_get_int(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 gint * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 if (cval->type != GCONF_VALUE_INT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 *value = gconf_value_get_int(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 bmp_cfg_db_get_bool(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 gboolean * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 if (cval->type != GCONF_VALUE_BOOL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 *value = gconf_value_get_bool(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 bmp_cfg_db_get_float(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 gfloat * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 if (cval->type != GCONF_VALUE_FLOAT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 *value = gconf_value_get_float(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 bmp_cfg_db_get_double(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 gdouble * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 if (!bmp_cfg_db_get_value(db, section, key, &cval))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 if (cval->type != GCONF_VALUE_FLOAT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 *value = gconf_value_get_float(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 bmp_cfg_db_set_string(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 gchar * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196
1759
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
197 if (value == NULL) {
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
198 bmp_cfg_db_unset_key(db, section, key);
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
199 } else {
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
200 cval = gconf_value_new(GCONF_VALUE_STRING);
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
201 gconf_value_set_string(cval, value);
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
202 bmp_cfg_db_set_value(db, section, key, cval);
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
203 gconf_value_free(cval);
c525c2b6a3d8 [svn] Interpret set_string for a NULL value as a key unset action, as gconf will not store NULL values.
chainsaw
parents: 1757
diff changeset
204 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 bmp_cfg_db_set_int(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 gint value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 cval = gconf_value_new(GCONF_VALUE_INT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 gconf_value_set_int(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 bmp_cfg_db_set_bool(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 gboolean value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 cval = gconf_value_new(GCONF_VALUE_BOOL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 gconf_value_set_bool(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 bmp_cfg_db_set_float(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 gfloat value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 cval = gconf_value_new(GCONF_VALUE_FLOAT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 gconf_value_set_float(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 bmp_cfg_db_set_double(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 gdouble value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 GConfValue *cval;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 cval = gconf_value_new(GCONF_VALUE_FLOAT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 gconf_value_set_float(cval, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 bmp_cfg_db_set_value(db, section, key, cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 gconf_value_free(cval);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 bmp_cfg_db_unset_key(ConfigDb * db,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 g_return_if_fail(db != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 path = build_keypath(section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 gconf_client_unset(db->client, path, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 g_free(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 }