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