Mercurial > audlegacy
comparison Plugins/Input/flac/configure.c @ 303:57d01c5bd39f trunk
[svn] Convert to configdb usage.
author | chainsaw |
---|---|
date | Sat, 17 Dec 2005 08:42:26 -0800 |
parents | 08e4eb900f21 |
children | 632e797d9509 |
comparison
equal
deleted
inserted
replaced
302:baee45e12cd6 | 303:57d01c5bd39f |
---|---|
25 #include <string.h> | 25 #include <string.h> |
26 #include <glib.h> | 26 #include <glib.h> |
27 #include <gtk/gtk.h> | 27 #include <gtk/gtk.h> |
28 #include <math.h> | 28 #include <math.h> |
29 | 29 |
30 #include <libaudacious/configfile.h> | 30 #include <libaudacious/configdb.h> |
31 #include <libaudacious/dirbrowser.h> | 31 #include <libaudacious/dirbrowser.h> |
32 #include <libaudacious/titlestring.h> | 32 #include <libaudacious/titlestring.h> |
33 #include <libaudacious/util.h> | 33 #include <libaudacious/util.h> |
34 #include <audacious/plugin.h> | 34 #include <audacious/plugin.h> |
35 | 35 |
125 static void flac_configurewin_ok(GtkWidget * widget, gpointer data); | 125 static void flac_configurewin_ok(GtkWidget * widget, gpointer data); |
126 static void configure_destroy(GtkWidget * w, gpointer data); | 126 static void configure_destroy(GtkWidget * w, gpointer data); |
127 | 127 |
128 static void flac_configurewin_ok(GtkWidget * widget, gpointer data) | 128 static void flac_configurewin_ok(GtkWidget * widget, gpointer data) |
129 { | 129 { |
130 ConfigFile *cfg; | 130 ConfigDb *db; |
131 gchar *filename; | |
132 | 131 |
133 (void)widget, (void)data; /* unused arguments */ | 132 (void)widget, (void)data; /* unused arguments */ |
134 g_free(flac_cfg.title.tag_format); | 133 g_free(flac_cfg.title.tag_format); |
135 flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry))); | 134 flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry))); |
136 flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry)); | 135 flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry)); |
137 | 136 |
138 filename = g_strconcat(g_get_home_dir(), "/.audacious/config", NULL); | 137 db = bmp_cfg_db_open(); |
139 cfg = xmms_cfg_open_file(filename); | |
140 if (!cfg) | |
141 cfg = xmms_cfg_new(); | |
142 /* title */ | 138 /* title */ |
143 xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override); | 139 bmp_cfg_db_set_bool(db, "flac", "title.tag_override", flac_cfg.title.tag_override); |
144 xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format); | 140 bmp_cfg_db_set_string(db, "flac", "title.tag_format", flac_cfg.title.tag_format); |
145 xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set); | 141 bmp_cfg_db_set_bool(db, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set); |
146 xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set); | 142 bmp_cfg_db_set_string(db, "flac", "title.user_char_set", flac_cfg.title.user_char_set); |
147 /* output */ | 143 /* output */ |
148 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable); | 144 bmp_cfg_db_set_bool(db, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable); |
149 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode); | 145 bmp_cfg_db_set_bool(db, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode); |
150 xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp); | 146 bmp_cfg_db_set_int(db, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp); |
151 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit); | 147 bmp_cfg_db_set_bool(db, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit); |
152 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16); | 148 bmp_cfg_db_set_bool(db, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16); |
153 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither); | 149 bmp_cfg_db_set_bool(db, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither); |
154 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping); | 150 bmp_cfg_db_set_int(db, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping); |
155 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out); | 151 bmp_cfg_db_set_int(db, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out); |
156 /* streaming */ | 152 /* streaming */ |
157 flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; | 153 flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; |
158 flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; | 154 flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; |
159 | 155 |
160 flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); | 156 flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); |
185 #ifdef FLAC_ICECAST | 181 #ifdef FLAC_ICECAST |
186 flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title)); | 182 flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title)); |
187 flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); | 183 flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); |
188 #endif | 184 #endif |
189 | 185 |
190 xmms_cfg_write_int(cfg, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size); | 186 bmp_cfg_db_set_int(db, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size); |
191 xmms_cfg_write_int(cfg, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer); | 187 bmp_cfg_db_set_int(db, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer); |
192 xmms_cfg_write_boolean(cfg, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy); | 188 bmp_cfg_db_set_bool(db, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy); |
193 xmms_cfg_write_string(cfg, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host); | 189 bmp_cfg_db_set_string(db, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host); |
194 xmms_cfg_write_int(cfg, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port); | 190 bmp_cfg_db_set_int(db, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port); |
195 xmms_cfg_write_boolean(cfg, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth); | 191 bmp_cfg_db_set_bool(db, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth); |
196 if(flac_cfg.stream.proxy_user) | 192 if(flac_cfg.stream.proxy_user) |
197 xmms_cfg_write_string(cfg, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user); | 193 bmp_cfg_db_set_string(db, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user); |
198 else | 194 else |
199 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_user"); | 195 bmp_cfg_db_unset_key(db, "flac", "stream.proxy_user"); |
200 if(flac_cfg.stream.proxy_pass) | 196 if(flac_cfg.stream.proxy_pass) |
201 xmms_cfg_write_string(cfg, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass); | 197 bmp_cfg_db_set_string(db, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass); |
202 else | 198 else |
203 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_pass"); | 199 bmp_cfg_db_unset_key(db, "flac", "stream.proxy_pass"); |
204 xmms_cfg_write_boolean(cfg, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream); | 200 bmp_cfg_db_set_bool(db, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream); |
205 xmms_cfg_write_string(cfg, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path); | 201 bmp_cfg_db_set_string(db, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path); |
206 #ifdef FLAC_ICECAST | 202 #ifdef FLAC_ICECAST |
207 xmms_cfg_write_boolean(cfg, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming); | 203 bmp_cfg_db_set_bool(db, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming); |
208 xmms_cfg_write_boolean(cfg, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel); | 204 bmp_cfg_db_set_bool(db, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel); |
209 #endif | 205 #endif |
210 | 206 |
211 xmms_cfg_write_file(cfg, filename); | 207 bmp_cfg_db_close(db); |
212 xmms_cfg_free(cfg); | |
213 g_free(filename); | |
214 gtk_widget_destroy(flac_configurewin); | 208 gtk_widget_destroy(flac_configurewin); |
215 } | 209 } |
216 | 210 |
217 static void configure_destroy(GtkWidget *widget, gpointer data) | 211 static void configure_destroy(GtkWidget *widget, gpointer data) |
218 { | 212 { |