xmms - Fix inline linking problems with old glib
[flac.git] / src / plugin_xmms / configure.c
1 /* libxmms-flac - XMMS FLAC input plugin
2  * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Daisuke Shimamura
3  *
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>
8  *
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.
13  *
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.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #include "plugin.h"
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <glib.h>
29 #include <gtk/gtk.h>
30 #include <pthread.h>
31 #include <math.h>
32
33 #include <xmms/configfile.h>
34 #include <xmms/dirbrowser.h>
35 #include <xmms/titlestring.h>
36 #include <xmms/util.h>
37 #include <xmms/plugin.h>
38
39 #include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */
40 #include "charset.h"
41 #include "configure.h"
42 #include "locale_hack.h"
43
44 /*
45  * Initialize Global Valueable
46  */
47 flac_config_t flac_cfg = {
48         /* title */
49         {
50                 FALSE, /* tag_override */
51                 NULL, /* tag_format */
52                 FALSE, /* convert_char_set */
53                 NULL /* user_char_set */
54         },
55         /* stream */
56         {
57                 100 /* KB */, /* http_buffer_size */
58                 50, /* http_prebuffer */
59                 FALSE, /* use_proxy */
60                 NULL, /* proxy_host */
61                 0, /* proxy_port */
62                 FALSE, /* proxy_use_auth */
63                 NULL, /* proxy_user */
64                 NULL, /* proxy_pass */
65                 FALSE, /* save_http_stream */
66                 NULL, /* save_http_path */
67                 FALSE, /* cast_title_streaming */
68                 FALSE /* use_udp_channel */
69         },
70         /* output */
71         {
72                 /* replaygain */
73                 {
74                         FALSE, /* enable */
75                         TRUE, /* album_mode */
76                         0, /* preamp */
77                         FALSE /* hard_limit */
78                 },
79                 /* resolution */
80                 {
81                         /* normal */
82                         {
83                                 TRUE /* dither_24_to_16 */
84                         },
85                         /* replaygain */
86                         {
87                                 TRUE, /* dither */
88                                 NOISE_SHAPING_LOW, /* noise_shaping */
89                                 16 /* bps_out */
90                         }
91                 }
92         }
93 };
94
95
96 static GtkWidget *flac_configurewin = NULL;
97 static GtkWidget *vbox, *notebook;
98
99 static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry, *title_desc;
100 static GtkWidget *convert_char_set, *fileCharacterSetEntry, *userCharacterSetEntry;
101 static GtkWidget *replaygain_enable, *replaygain_album_mode;
102 static GtkWidget *replaygain_preamp_hscale, *replaygain_preamp_label, *replaygain_hard_limit;
103 static GtkObject *replaygain_preamp;
104 static GtkWidget *resolution_normal_dither_24_to_16;
105 static GtkWidget *resolution_replaygain_dither;
106 static GtkWidget *resolution_replaygain_noise_shaping_frame;
107 static GtkWidget *resolution_replaygain_noise_shaping_radio_none;
108 static GtkWidget *resolution_replaygain_noise_shaping_radio_low;
109 static GtkWidget *resolution_replaygain_noise_shaping_radio_medium;
110 static GtkWidget *resolution_replaygain_noise_shaping_radio_high;
111 static GtkWidget *resolution_replaygain_bps_out_frame;
112 static GtkWidget *resolution_replaygain_bps_out_radio_16bps;
113 static GtkWidget *resolution_replaygain_bps_out_radio_24bps;
114
115 static GtkObject *streaming_size_adj, *streaming_pre_adj;
116 static GtkWidget *streaming_proxy_use, *streaming_proxy_host_entry;
117 static GtkWidget *streaming_proxy_port_entry, *streaming_save_use, *streaming_save_entry;
118 static GtkWidget *streaming_proxy_auth_use;
119 static GtkWidget *streaming_proxy_auth_pass_entry, *streaming_proxy_auth_user_entry;
120 static GtkWidget *streaming_proxy_auth_user_label, *streaming_proxy_auth_pass_label;
121 #ifdef FLAC_ICECAST
122 static GtkWidget *streaming_cast_title, *streaming_udp_title;
123 #endif
124 static GtkWidget *streaming_proxy_hbox, *streaming_proxy_auth_hbox, *streaming_save_dirbrowser;
125 static GtkWidget *streaming_save_hbox;
126
127 static gchar *gtk_entry_get_text_1 (GtkWidget *widget);
128 static void flac_configurewin_ok(GtkWidget * widget, gpointer data);
129 static void configure_destroy(GtkWidget * w, gpointer data);
130
131 static void flac_configurewin_ok(GtkWidget * widget, gpointer data)
132 {
133         ConfigFile *cfg;
134         gchar *filename;
135
136         (void)widget, (void)data; /* unused arguments */
137         g_free(flac_cfg.title.tag_format);
138         flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry)));
139         flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry));
140
141         filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL);
142         cfg = xmms_cfg_open_file(filename);
143         if (!cfg)
144                 cfg = xmms_cfg_new();
145         /* title */
146         xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override);
147         xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format);
148         xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set);
149         xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set);
150         /* output */
151         xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable);
152         xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode);
153         xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp);
154         xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit);
155         xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16);
156         xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither);
157         xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping);
158         xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out);
159         /* streaming */
160         flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value;
161         flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value;
162
163         flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
164         if(flac_cfg.stream.proxy_host)
165                 g_free(flac_cfg.stream.proxy_host);
166         flac_cfg.stream.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
167         flac_cfg.stream.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));
168
169         flac_cfg.stream.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
170
171         if(flac_cfg.stream.proxy_user)
172                 g_free(flac_cfg.stream.proxy_user);
173         flac_cfg.stream.proxy_user = NULL;
174         if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0)
175                 flac_cfg.stream.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry)));
176
177         if(flac_cfg.stream.proxy_pass)
178                 g_free(flac_cfg.stream.proxy_pass);
179         flac_cfg.stream.proxy_pass = NULL;
180         if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0)
181                 flac_cfg.stream.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry)));
182
183
184         flac_cfg.stream.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
185         if (flac_cfg.stream.save_http_path)
186                 g_free(flac_cfg.stream.save_http_path);
187         flac_cfg.stream.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry)));
188
189 #ifdef FLAC_ICECAST
190         flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title));
191         flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title));
192 #endif
193
194         xmms_cfg_write_int(cfg, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size);
195         xmms_cfg_write_int(cfg, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer);
196         xmms_cfg_write_boolean(cfg, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy);
197         xmms_cfg_write_string(cfg, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host);
198         xmms_cfg_write_int(cfg, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port);
199         xmms_cfg_write_boolean(cfg, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth);
200         if(flac_cfg.stream.proxy_user)
201                 xmms_cfg_write_string(cfg, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user);
202         else
203                 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_user");
204         if(flac_cfg.stream.proxy_pass)
205                 xmms_cfg_write_string(cfg, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass);
206         else
207                 xmms_cfg_remove_key(cfg, "flac", "stream.proxy_pass");
208         xmms_cfg_write_boolean(cfg, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream);
209         xmms_cfg_write_string(cfg, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path);
210 #ifdef FLAC_ICECAST
211         xmms_cfg_write_boolean(cfg, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming);
212         xmms_cfg_write_boolean(cfg, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel);
213 #endif
214
215         xmms_cfg_write_file(cfg, filename);
216         xmms_cfg_free(cfg);
217         g_free(filename);
218         gtk_widget_destroy(flac_configurewin);
219 }
220
221 static void configure_destroy(GtkWidget *widget, gpointer data)
222 {
223         (void)widget, (void)data; /* unused arguments */
224 }
225
226 static void title_tag_override_cb(GtkWidget *widget, gpointer data)
227 {
228         (void)widget, (void)data; /* unused arguments */
229         flac_cfg.title.tag_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override));
230
231         gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
232         gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
233
234 }
235
236 static void convert_char_set_cb(GtkWidget *widget, gpointer data)
237 {
238         (void)widget, (void)data; /* unused arguments */
239         flac_cfg.title.convert_char_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(convert_char_set));
240
241         gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE);
242         gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
243 }
244
245 static void replaygain_enable_cb(GtkWidget *widget, gpointer data)
246 {
247         (void)widget, (void)data; /* unused arguments */
248         flac_cfg.output.replaygain.enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_enable));
249
250         gtk_widget_set_sensitive(replaygain_album_mode, flac_cfg.output.replaygain.enable);
251         gtk_widget_set_sensitive(replaygain_preamp_hscale, flac_cfg.output.replaygain.enable);
252         gtk_widget_set_sensitive(replaygain_hard_limit, flac_cfg.output.replaygain.enable);
253 }
254
255 static void replaygain_album_mode_cb(GtkWidget *widget, gpointer data)
256 {
257         (void)widget, (void)data; /* unused arguments */
258         flac_cfg.output.replaygain.album_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_album_mode));
259 }
260
261 static void replaygain_hard_limit_cb(GtkWidget *widget, gpointer data)
262 {
263         (void)widget, (void)data; /* unused arguments */
264         flac_cfg.output.replaygain.hard_limit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit));
265 }
266
267 static void replaygain_preamp_cb(GtkWidget *widget, gpointer data)
268 {
269         GString *gstring = g_string_new("");
270         (void)widget, (void)data; /* unused arguments */
271         flac_cfg.output.replaygain.preamp = (int) floor(GTK_ADJUSTMENT(replaygain_preamp)->value + 0.5);
272
273         g_string_sprintf(gstring, "%i dB", flac_cfg.output.replaygain.preamp);
274         gtk_label_set_text(GTK_LABEL(replaygain_preamp_label), _(gstring->str));
275 }
276
277 static void resolution_normal_dither_24_to_16_cb(GtkWidget *widget, gpointer data)
278 {
279         (void)widget, (void)data; /* unused arguments */
280         flac_cfg.output.resolution.normal.dither_24_to_16 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16));
281 }
282
283 static void resolution_replaygain_dither_cb(GtkWidget *widget, gpointer data)
284 {
285         (void)widget, (void)data; /* unused arguments */
286         flac_cfg.output.resolution.replaygain.dither = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither));
287
288         gtk_widget_set_sensitive(resolution_replaygain_noise_shaping_frame, flac_cfg.output.resolution.replaygain.dither);
289 }
290
291 static void resolution_replaygain_noise_shaping_cb(GtkWidget *widget, gpointer data)
292 {
293         (void)widget, (void)data; /* unused arguments */
294         flac_cfg.output.resolution.replaygain.noise_shaping =
295                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none))? 0 :
296                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low))? 1 :
297                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium))? 2 :
298                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high))? 3 :
299                 0
300         ;
301 }
302
303 static void resolution_replaygain_bps_out_cb(GtkWidget *widget, gpointer data)
304 {
305         (void)widget, (void)data; /* unused arguments */
306         flac_cfg.output.resolution.replaygain.bps_out =
307                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps))? 16 :
308                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps))? 24 :
309                 16
310         ;
311 }
312
313 static void proxy_use_cb(GtkWidget * w, gpointer data)
314 {
315         gboolean use_proxy, use_proxy_auth;
316         (void) w;
317         (void) data;
318
319         use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
320         use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
321
322         gtk_widget_set_sensitive(streaming_proxy_hbox, use_proxy);
323         gtk_widget_set_sensitive(streaming_proxy_auth_use, use_proxy);
324         gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth);
325 }
326
327 static void proxy_auth_use_cb(GtkWidget *w, gpointer data)
328 {
329         gboolean use_proxy, use_proxy_auth;
330         (void) w;
331         (void) data;
332
333         use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
334         use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use));
335
336         gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth);
337 }
338
339 static void streaming_save_dirbrowser_cb(gchar * dir)
340 {
341         gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir);
342 }
343
344 static void streaming_save_browse_cb(GtkWidget * w, gpointer data)
345 {
346         (void) w;
347         (void) data;
348         if (!streaming_save_dirbrowser)
349         {
350                 streaming_save_dirbrowser = xmms_create_dir_browser(_("Select the directory where you want to store the MPEG streams:"),
351                                                                     flac_cfg.stream.save_http_path, GTK_SELECTION_SINGLE, streaming_save_dirbrowser_cb);
352                 gtk_signal_connect(GTK_OBJECT(streaming_save_dirbrowser), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &streaming_save_dirbrowser);
353                 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), GTK_WINDOW(flac_configurewin));
354                 gtk_widget_show(streaming_save_dirbrowser);
355         }
356 }
357
358 static void streaming_save_use_cb(GtkWidget * w, gpointer data)
359 {
360         gboolean save_stream;
361         (void) w;
362         (void) data;
363
364         save_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
365
366         gtk_widget_set_sensitive(streaming_save_hbox, save_stream);
367 }
368
369
370 void FLAC_XMMS__configure(void)
371 {
372         GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
373         GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame;
374         GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox;
375         GtkWidget *resolution_replaygain_noise_shaping_vbox;
376         GtkWidget *resolution_replaygain_bps_out_vbox;
377         GtkWidget *label, *hbox;
378         GtkWidget *bbox, *ok, *cancel;
379         GList *list;
380
381         GtkWidget *streaming_vbox;
382         GtkWidget *streaming_buf_frame, *streaming_buf_hbox;
383         GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin;
384         GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin;
385         GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
386         GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label;
387         GtkWidget *streaming_save_frame, *streaming_save_vbox;
388         GtkWidget *streaming_save_label, *streaming_save_browse;
389 #ifdef FLAC_ICECAST
390         GtkWidget *streaming_cast_frame, *streaming_cast_vbox;
391 #endif
392         char *temp;
393
394         if (flac_configurewin != NULL) {
395                 gdk_window_raise(flac_configurewin->window);
396                 return;
397         }
398         flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG);
399         gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin);
400         gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin);
401         gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration"));
402         gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE);
403         gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10);
404
405         vbox = gtk_vbox_new(FALSE, 10);
406         gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox);
407
408         notebook = gtk_notebook_new();
409         gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
410
411         /* Title config.. */
412
413         title_frame = gtk_frame_new(_("Tag Handling"));
414         gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
415
416         title_tag_vbox = gtk_vbox_new(FALSE, 10);
417         gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
418         gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
419
420         /* Convert Char Set */
421
422         convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set"));
423         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set);
424         gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL);
425         gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0);
426         /*  Combo boxes... */
427         hbox = gtk_hbox_new(FALSE,4);
428         gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox);
429         label = gtk_label_new(_("Convert character set from :"));
430         gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
431         fileCharacterSetEntry = gtk_combo_new();
432         gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0);
433
434         label = gtk_label_new (_("to :"));
435         gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
436         userCharacterSetEntry = gtk_combo_new();
437         gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0);
438
439         gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE);
440         gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE);
441         gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE);
442         gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE);
443
444         list = Charset_Create_List();
445         gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),Charset_Create_List_UTF8_Only());
446         gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list);
447         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set));
448         gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE);
449         gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set);
450
451         /* Override Tagging Format */
452
453         title_tag_override = gtk_check_button_new_with_label(_("Override generic titles"));
454         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override);
455         gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL);
456         gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0);
457
458         title_tag_box = gtk_hbox_new(FALSE, 5);
459         gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override);
460         gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0);
461
462         title_tag_label = gtk_label_new(_("Title format:"));
463         gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0);
464
465         title_tag_entry = gtk_entry_new();
466         gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format);
467         gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0);
468
469         title_desc = xmms_titlestring_descriptions("pafFetnygc", 2);
470         gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override);
471         gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);
472
473         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title")));
474
475         /* Output config.. */
476
477         output_vbox = gtk_vbox_new(FALSE, 10);
478         gtk_container_border_width(GTK_CONTAINER(output_vbox), 5);
479
480         /* replaygain */
481
482         replaygain_frame = gtk_frame_new(_("ReplayGain"));
483         gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5);
484         gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0);
485
486         replaygain_vbox = gtk_vbox_new(FALSE, 10);
487         gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5);
488         gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox);
489
490         replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing"));
491         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable);
492         gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL);
493         gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0);
494
495         replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode"));
496         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode);
497         gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL);
498         gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0);
499
500         hbox = gtk_hbox_new(FALSE,3);
501         gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox);
502         label = gtk_label_new(_("Preamp:"));
503         gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
504         replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0);
505         gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL);
506         replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp));
507         gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE);
508         gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0);
509         replaygain_preamp_label = gtk_label_new(_("0 dB"));
510         gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0);
511         gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp));
512
513         replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting"));
514         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit);
515         gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL);
516         gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0);
517
518         replaygain_enable_cb(replaygain_enable, NULL);
519
520         /* resolution */
521
522         resolution_frame = gtk_frame_new(_("Resolution"));
523         gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5);
524         gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0);
525
526         resolution_hbox = gtk_hbox_new(FALSE, 10);
527         gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5);
528         gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox);
529
530         resolution_normal_frame = gtk_frame_new(_("Without ReplayGain"));
531         gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5);
532         gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0);
533
534         resolution_normal_vbox = gtk_vbox_new(FALSE, 10);
535         gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5);
536         gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox);
537
538         resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps"));
539         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16);
540         gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL);
541         gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0);
542
543         resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain"));
544         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5);
545         gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0);
546
547         resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10);
548         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5);
549         gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox);
550
551         resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering"));
552         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither);
553         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL);
554         gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0);
555
556         hbox = gtk_hbox_new(FALSE, 10);
557         gtk_container_border_width(GTK_CONTAINER(hbox), 5);
558         gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0);
559
560         resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping"));
561         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5);
562         gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0);
563
564         resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new();
565         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5);
566         gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox);
567
568         resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none"));
569         if(flac_cfg.output.resolution.replaygain.noise_shaping == 0)
570                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE);
571         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
572         gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none);
573
574         resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low"));
575         if(flac_cfg.output.resolution.replaygain.noise_shaping == 1)
576                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE);
577         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
578         gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low);
579
580         resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium"));
581         if(flac_cfg.output.resolution.replaygain.noise_shaping == 2)
582                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE);
583         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
584         gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium);
585
586         resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high"));
587         if(flac_cfg.output.resolution.replaygain.noise_shaping == 3)
588                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE);
589         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL);
590         gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high);
591
592         resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to"));
593         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5);
594         gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0);
595
596         resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new();
597         gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0);
598         gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox);
599
600         resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps"));
601         if(flac_cfg.output.resolution.replaygain.bps_out == 16)
602                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE);
603         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
604         gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps);
605
606         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"));
607         if(flac_cfg.output.resolution.replaygain.bps_out == 24)
608                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE);
609         gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL);
610         gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps);
611
612         resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL);
613
614         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output")));
615
616         /* Streaming */
617
618         streaming_vbox = gtk_vbox_new(FALSE, 0);
619
620         streaming_buf_frame = gtk_frame_new(_("Buffering:"));
621         gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5);
622         gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, FALSE, 0);
623
624         streaming_buf_hbox = gtk_hbox_new(TRUE, 5);
625         gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5);
626         gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox);
627
628         streaming_size_box = gtk_hbox_new(FALSE, 5);
629         /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */
630         gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, TRUE, TRUE, 0);
631         streaming_size_label = gtk_label_new(_("Buffer size (kb):"));
632         gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0);
633         streaming_size_adj = gtk_adjustment_new(flac_cfg.stream.http_buffer_size, 4, 4096, 4, 4, 4);
634         streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0);
635         gtk_widget_set_usize(streaming_size_spin, 60, -1);
636         gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, FALSE, FALSE, 0);
637
638         streaming_pre_box = gtk_hbox_new(FALSE, 5);
639         /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */
640         gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, TRUE, TRUE, 0);
641         streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
642         gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0);
643         streaming_pre_adj = gtk_adjustment_new(flac_cfg.stream.http_prebuffer, 0, 90, 1, 1, 1);
644         streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0);
645         gtk_widget_set_usize(streaming_pre_spin, 60, -1);
646         gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, FALSE, FALSE, 0);
647
648         /*
649          * Proxy config.
650          */
651         streaming_proxy_frame = gtk_frame_new(_("Proxy:"));
652         gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5);
653         gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame, FALSE, FALSE, 0);
654
655         streaming_proxy_vbox = gtk_vbox_new(FALSE, 5);
656         gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5);
657         gtk_container_add(GTK_CONTAINER(streaming_proxy_frame), streaming_proxy_vbox);
658
659         streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy"));
660         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use), flac_cfg.stream.use_proxy);
661         gtk_signal_connect(GTK_OBJECT(streaming_proxy_use), "clicked", GTK_SIGNAL_FUNC(proxy_use_cb), NULL);
662         gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use, FALSE, FALSE, 0);
663
664         streaming_proxy_hbox = gtk_hbox_new(FALSE, 5);
665         gtk_widget_set_sensitive(streaming_proxy_hbox, flac_cfg.stream.use_proxy);
666         gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox, FALSE, FALSE, 0);
667
668         streaming_proxy_host_label = gtk_label_new(_("Host:"));
669         gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0);
670
671         streaming_proxy_host_entry = gtk_entry_new();
672         gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host? flac_cfg.stream.proxy_host : "");
673         gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0);
674
675         streaming_proxy_port_label = gtk_label_new(_("Port:"));
676         gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_label, FALSE, FALSE, 0);
677
678         streaming_proxy_port_entry = gtk_entry_new();
679         gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1);
680         temp = g_strdup_printf("%d", flac_cfg.stream.proxy_port);
681         gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp);
682         g_free(temp);
683         gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_entry, FALSE, FALSE, 0);
684
685         streaming_proxy_auth_use = gtk_check_button_new_with_label(_("Use authentication"));
686         gtk_widget_set_sensitive(streaming_proxy_auth_use, flac_cfg.stream.use_proxy);
687         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use), flac_cfg.stream.proxy_use_auth);
688         gtk_signal_connect(GTK_OBJECT(streaming_proxy_auth_use), "clicked", GTK_SIGNAL_FUNC(proxy_auth_use_cb), NULL);
689         gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_use, FALSE, FALSE, 0);
690
691         streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5);
692         gtk_widget_set_sensitive(streaming_proxy_auth_hbox, flac_cfg.stream.use_proxy && flac_cfg.stream.proxy_use_auth);
693         gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_hbox, FALSE, FALSE, 0);
694
695         streaming_proxy_auth_user_label = gtk_label_new(_("Username:"));
696         gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_label, FALSE, FALSE, 0);
697
698         streaming_proxy_auth_user_entry = gtk_entry_new();
699         if(flac_cfg.stream.proxy_user)
700                 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_user_entry), flac_cfg.stream.proxy_user);
701         gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_entry, TRUE, TRUE, 0);
702
703         streaming_proxy_auth_pass_label = gtk_label_new(_("Password:"));
704         gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_label, FALSE, FALSE, 0);
705
706         streaming_proxy_auth_pass_entry = gtk_entry_new();
707         if(flac_cfg.stream.proxy_pass)
708                 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_pass_entry), flac_cfg.stream.proxy_pass);
709         gtk_entry_set_visibility(GTK_ENTRY(streaming_proxy_auth_pass_entry), FALSE);
710         gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_entry, TRUE, TRUE, 0);
711
712
713         /*
714          * Save to disk config.
715          */
716         streaming_save_frame = gtk_frame_new(_("Save stream to disk:"));
717         gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5);
718         gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, FALSE, FALSE, 0);
719
720         streaming_save_vbox = gtk_vbox_new(FALSE, 5);
721         gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5);
722         gtk_container_add(GTK_CONTAINER(streaming_save_frame), streaming_save_vbox);
723
724         streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk"));
725         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), flac_cfg.stream.save_http_stream);
726         gtk_signal_connect(GTK_OBJECT(streaming_save_use), "clicked", GTK_SIGNAL_FUNC(streaming_save_use_cb), NULL);
727         gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, FALSE, FALSE, 0);
728
729         streaming_save_hbox = gtk_hbox_new(FALSE, 5);
730         gtk_widget_set_sensitive(streaming_save_hbox, flac_cfg.stream.save_http_stream);
731         gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0);
732
733         streaming_save_label = gtk_label_new(_("Path:"));
734         gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0);
735
736         streaming_save_entry = gtk_entry_new();
737         gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path? flac_cfg.stream.save_http_path : "");
738         gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0);
739
740         streaming_save_browse = gtk_button_new_with_label(_("Browse"));
741         gtk_signal_connect(GTK_OBJECT(streaming_save_browse), "clicked", GTK_SIGNAL_FUNC(streaming_save_browse_cb), NULL);
742         gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, FALSE, FALSE, 0);
743
744 #ifdef FLAC_ICECAST
745         streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:"));
746         gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5);
747         gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, FALSE, FALSE, 0);
748
749         streaming_cast_vbox = gtk_vbox_new(5, FALSE);
750         gtk_container_add(GTK_CONTAINER(streaming_cast_frame), streaming_cast_vbox);
751
752         streaming_cast_title = gtk_check_button_new_with_label(_("Enable SHOUT/Icecast title streaming"));
753         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_cast_title), flac_cfg.stream.cast_title_streaming);
754         gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title, FALSE, FALSE, 0);
755
756         streaming_udp_title = gtk_check_button_new_with_label(_("Enable Icecast Metadata UDP Channel"));
757         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), flac_cfg.stream.use_udp_channel);
758         gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0);
759 #endif
760
761         gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, gtk_label_new(_("Streaming")));
762
763         /* Buttons */
764
765         bbox = gtk_hbutton_box_new();
766         gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
767         gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
768         gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
769
770         ok = gtk_button_new_with_label(_("Ok"));
771         gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL);
772         GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
773         gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
774         gtk_widget_grab_default(ok);
775
776         cancel = gtk_button_new_with_label(_("Cancel"));
777         gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin));
778         GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
779         gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
780
781         gtk_widget_show_all(flac_configurewin);
782 }
783
784 void FLAC_XMMS__aboutbox(void)
785 {
786         static GtkWidget *about_window;
787
788         if (about_window)
789                 gdk_window_raise(about_window->window);
790
791         about_window = xmms_show_message(
792                 _("About Flac Plugin"),
793                 _("Flac Plugin by Josh Coalson\n"
794                   "contributions by\n"
795                   "......\n"
796                   "......\n"
797                   "and\n"
798                   "Daisuke Shimamura\n"
799                   "Visit http://flac.sourceforge.net/"),
800                 _("Ok"), FALSE, NULL, NULL);
801         gtk_signal_connect(GTK_OBJECT(about_window), "destroy",
802                            GTK_SIGNAL_FUNC(gtk_widget_destroyed),
803                            &about_window);
804 }
805
806 /*
807  * Get text of an Entry or a ComboBox
808  */
809 static gchar *gtk_entry_get_text_1 (GtkWidget *widget)
810 {
811         if (GTK_IS_COMBO(widget))
812         {
813                 return gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry));
814         }else if (GTK_IS_ENTRY(widget))
815         {
816                 return gtk_entry_get_text(GTK_ENTRY(widget));
817         }else
818         {
819                 return NULL;
820         }
821 }