1 /* libxmms-flac - XMMS FLAC input plugin
2 * Copyright (C) 2002 Daisuke Shimamura
4 * Based on mpg123 plugin
5 * and prefs.c - 2000/05/06
6 * EasyTAG - Tag editor for MP3 and OGG files
7 * Copyright (C) 2000-2002 Jerome Couderc <j.couderc@ifrance.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <xmms/configfile.h>
32 #include <xmms/dirbrowser.h>
33 #include <xmms/titlestring.h>
34 #include <xmms/util.h>
35 #include <xmms/plugin.h>
37 #include "plugin_common/locale_hack.h"
39 #include "configure.h"
42 * Initialize Global Valueable
44 flac_config_t flac_cfg = {
47 FALSE, /* tag_override */
48 NULL, /* tag_format */
49 FALSE, /* convert_char_set */
50 NULL, /* file_char_set */
51 NULL /* user_char_set */
58 TRUE, /* album_mode */
60 FALSE /* hard_limit */
66 TRUE /* dither_24_to_16 */
71 1, /* noise_shaping */
79 static GtkWidget *flac_configurewin = NULL;
80 static GtkWidget *vbox, *notebook;
82 static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry, *title_desc;
83 static GtkWidget *convert_char_set, *fileCharacterSetEntry, *userCharacterSetEntry;
84 static GtkWidget *replaygain_enable, *replaygain_album_mode;
85 static GtkWidget *replaygain_preamp_hscale, *replaygain_preamp_label, *replaygain_hard_limit;
86 static GtkObject *replaygain_preamp;
87 static GtkWidget *resolution_normal_dither_24_to_16;
88 static GtkWidget *resolution_replaygain_dither;
89 static GtkWidget *resolution_replaygain_noise_shaping_frame;
90 static GtkWidget *resolution_replaygain_noise_shaping_radio_none;
91 static GtkWidget *resolution_replaygain_noise_shaping_radio_low;
92 static GtkWidget *resolution_replaygain_noise_shaping_radio_medium;
93 static GtkWidget *resolution_replaygain_noise_shaping_radio_high;
94 static GtkWidget *resolution_replaygain_bps_out_frame;
95 static GtkWidget *resolution_replaygain_bps_out_radio_16bps;
96 static GtkWidget *resolution_replaygain_bps_out_radio_24bps;
98 static gchar *gtk_entry_get_text_1 (GtkWidget *widget);
99 static void flac_configurewin_ok(GtkWidget * widget, gpointer data);
100 static void configure_destroy(GtkWidget * w, gpointer data);
102 static void flac_configurewin_ok(GtkWidget * widget, gpointer data)
107 (void)widget, (void)data; /* unused arguments */
108 g_free(flac_cfg.title.tag_format);
109 flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry)));
110 flac_cfg.title.file_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(fileCharacterSetEntry));
111 flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry));
113 filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
114 cfg = xmms_cfg_open_file(filename);
116 cfg = xmms_cfg_new();
118 xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override);
119 xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format);
120 xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set);
121 xmms_cfg_write_string(cfg, "flac", "title.file_char_set", flac_cfg.title.file_char_set);
122 xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set);
124 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable);
125 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode);
126 xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp);
127 xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit);
128 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16);
129 xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither);
130 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping);
131 xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out);
132 xmms_cfg_write_file(cfg, filename);
135 gtk_widget_destroy(flac_configurewin);
138 static void configure_destroy(GtkWidget *widget, gpointer data)
140 (void)widget, (void)data; /* unused arguments */
143 static void title_tag_override_cb(GtkWidget *widget, gpointer data)
145 (void)widget, (void)data; /* unused arguments */
146 flac_cfg.title.tag_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override));
148 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
149 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
153 static void convert_char_set_cb(GtkWidget *widget, gpointer data)
155 (void)widget, (void)data; /* unused arguments */
156 flac_cfg.title.convert_char_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(convert_char_set));
158 gtk_widget_set_sensitive(fileCharacterSetEntry, flac_cfg.title.convert_char_set);
159 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
162 static void replaygain_enable_cb(GtkWidget *widget, gpointer data)
164 (void)widget, (void)data; /* unused arguments */
165 flac_cfg.output.replaygain.enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_enable));
167 gtk_widget_set_sensitive(replaygain_album_mode, flac_cfg.output.replaygain.enable);
168 gtk_widget_set_sensitive(replaygain_preamp_hscale, flac_cfg.output.replaygain.enable);
169 gtk_widget_set_sensitive(replaygain_hard_limit, flac_cfg.output.replaygain.enable);
172 static void replaygain_album_mode_cb(GtkWidget *widget, gpointer data)
174 (void)widget, (void)data; /* unused arguments */
175 flac_cfg.output.replaygain.album_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_album_mode));
178 static void replaygain_hard_limit_cb(GtkWidget *widget, gpointer data)
180 (void)widget, (void)data; /* unused arguments */
181 flac_cfg.output.replaygain.hard_limit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit));
184 static void replaygain_preamp_cb(GtkWidget *widget, gpointer data)
186 GString *gstring = g_string_new("");
187 (void)widget, (void)data; /* unused arguments */
188 flac_cfg.output.replaygain.preamp = (int) floor(GTK_ADJUSTMENT(replaygain_preamp)->value + 0.5);
190 g_string_sprintf(gstring, "%i dB", flac_cfg.output.replaygain.preamp);
191 gtk_label_set_text(GTK_LABEL(replaygain_preamp_label), _(gstring->str));
194 static void resolution_normal_dither_24_to_16_cb(GtkWidget *widget, gpointer data)
196 (void)widget, (void)data; /* unused arguments */
197 flac_cfg.output.resolution.normal.dither_24_to_16 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16));
200 static void resolution_replaygain_dither_cb(GtkWidget *widget, gpointer data)
202 (void)widget, (void)data; /* unused arguments */
203 flac_cfg.output.resolution.replaygain.dither = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither));
205 gtk_widget_set_sensitive(resolution_replaygain_noise_shaping_frame, flac_cfg.output.resolution.replaygain.dither);
208 static void resolution_replaygain_noise_shaping_cb(GtkWidget *widget, gpointer data)
210 (void)widget, (void)data; /* unused arguments */
211 flac_cfg.output.resolution.replaygain.noise_shaping =
212 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none))? 0 :
213 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low))? 1 :
214 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium))? 2 :
215 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high))? 3 :
220 static void resolution_replaygain_bps_out_cb(GtkWidget *widget, gpointer data)
222 (void)widget, (void)data; /* unused arguments */
223 flac_cfg.output.resolution.replaygain.bps_out =
224 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps))? 16 :
225 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps))? 24 :
231 void FLAC_XMMS__configure(void)
233 GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
234 GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame;
235 GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox;
236 GtkWidget *resolution_replaygain_noise_shaping_vbox;
237 GtkWidget *resolution_replaygain_bps_out_vbox;
238 GtkWidget *label, *hbox;
239 GtkWidget *bbox, *ok, *cancel;
242 if (flac_configurewin != NULL) {
243 gdk_window_raise(flac_configurewin->window);
246 flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG);
247 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin);
248 gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin);
249 gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration"));
250 gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE);
251 gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10);
253 vbox = gtk_vbox_new(FALSE, 10);
254 gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox);
256 notebook = gtk_notebook_new();
257 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
261 title_frame = gtk_frame_new(_("Tag Handling"));
262 gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
264 title_tag_vbox = gtk_vbox_new(FALSE, 10);
265 gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
266 gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
268 /* Convert Char Set */
270 convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set"));
271 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set);
272 gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL);
273 gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0);
275 hbox = gtk_hbox_new(FALSE,4);
276 gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox);
277 label = gtk_label_new(_("Convert character set from :"));
278 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
279 fileCharacterSetEntry = gtk_combo_new();
280 gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0);
282 label = gtk_label_new (_("to :"));
283 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
284 userCharacterSetEntry = gtk_combo_new();
285 gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0);
287 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE);
288 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE);
289 gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE);
290 gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE);
292 list = Charset_Create_List();
293 gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),list);
294 gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list);
295 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.file_char_set));
296 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set));
297 gtk_widget_set_sensitive(fileCharacterSetEntry, flac_cfg.title.convert_char_set);
298 gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
300 /* Override Tagging Format */
302 title_tag_override = gtk_check_button_new_with_label(_("Override generic titles"));
303 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override);
304 gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL);
305 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0);
307 title_tag_box = gtk_hbox_new(FALSE, 5);
308 gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
309 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0);
311 title_tag_label = gtk_label_new(_("Title format:"));
312 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0);
314 title_tag_entry = gtk_entry_new();
315 gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format);
316 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0);
318 title_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
319 gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
320 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);
322 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title")));
324 /* Output config.. */
326 output_vbox = gtk_vbox_new(FALSE, 10);
327 gtk_container_border_width(GTK_CONTAINER(output_vbox), 5);
331 replaygain_frame = gtk_frame_new(_("ReplayGain"));
332 gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5);
333 gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0);
335 replaygain_vbox = gtk_vbox_new(FALSE, 10);
336 gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5);
337 gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox);
339 replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing"));
340 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable);
341 gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL);
342 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0);
344 replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode"));
345 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode);
346 gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL);
347 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0);
349 hbox = gtk_hbox_new(FALSE,3);
350 gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox);
351 label = gtk_label_new(_("Preamp:"));
352 gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
353 replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0);
354 gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL);
355 replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp));
356 gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE);
357 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0);
358 replaygain_preamp_label = gtk_label_new(_("0 dB"));
359 gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0);
360 gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp));
362 replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting"));
363 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit);
364 gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL);
365 gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0);
367 replaygain_enable_cb(replaygain_enable, NULL);
371 resolution_frame = gtk_frame_new(_("Resolution"));
372 gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5);
373 gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0);
375 resolution_hbox = gtk_hbox_new(FALSE, 10);
376 gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5);
377 gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox);
379 resolution_normal_frame = gtk_frame_new(_("Without ReplayGain"));
380 gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5);
381 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0);
383 resolution_normal_vbox = gtk_vbox_new(FALSE, 10);
384 gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5);
385 gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox);
387 resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps"));
388 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16);
389 gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL);
390 gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0);
392 resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain"));
393 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5);
394 gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0);
396 resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10);
397 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5);
398 gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox);
400 resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering"));
401 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither);
402 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL);
403 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0);
405 hbox = gtk_hbox_new(FALSE, 10);
406 gtk_container_border_width(GTK_CONTAINER(hbox), 5);
407 gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0);
409 resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping"));
410 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5);
411 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0);
413 resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new();
414 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5);
415 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox);
417 resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none"));
418 if(flac_cfg.output.resolution.replaygain.noise_shaping == 0)
419 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE);
420 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
421 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none);
423 resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low"));
424 if(flac_cfg.output.resolution.replaygain.noise_shaping == 1)
425 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE);
426 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
427 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low);
429 resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium"));
430 if(flac_cfg.output.resolution.replaygain.noise_shaping == 2)
431 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE);
432 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
433 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium);
435 resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high"));
436 if(flac_cfg.output.resolution.replaygain.noise_shaping == 3)
437 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE);
438 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
439 gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high);
441 resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to"));
442 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5);
443 gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0);
445 resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new();
446 gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0);
447 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox);
449 resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps"));
450 if(flac_cfg.output.resolution.replaygain.bps_out == 16)
451 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE);
452 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
453 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps);
455 resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps"));
456 if(flac_cfg.output.resolution.replaygain.bps_out == 24)
457 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE);
458 gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
459 gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps);
461 resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL);
463 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output")));
467 bbox = gtk_hbutton_box_new();
468 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
469 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
470 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
472 ok = gtk_button_new_with_label(_("Ok"));
473 gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL);
474 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
475 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
476 gtk_widget_grab_default(ok);
478 cancel = gtk_button_new_with_label(_("Cancel"));
479 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin));
480 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
481 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
483 gtk_widget_show_all(flac_configurewin);
486 void FLAC_XMMS__aboutbox()
488 static GtkWidget *about_window;
491 gdk_window_raise(about_window->window);
493 about_window = xmms_show_message(
494 _("About Flac Plugin"),
495 _("Flac Plugin by Josh Coalson\n"
500 "Daisuke Shimamura\n"
501 "Visit http://flac.sourceforge.net/"),
502 _("Ok"), FALSE, NULL, NULL);
503 gtk_signal_connect(GTK_OBJECT(about_window), "destroy",
504 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
509 * Get text of an Entry or a ComboBox
511 static gchar *gtk_entry_get_text_1 (GtkWidget *widget)
513 if (GTK_IS_COMBO(widget))
515 return gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry));
516 }else if (GTK_IS_ENTRY(widget))
518 return gtk_entry_get_text(GTK_ENTRY(widget));