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