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