61
|
1 #ifdef HAVE_CONFIG_H
|
|
2 # include "config.h"
|
|
3 #endif
|
|
4
|
|
5 #include "vorbis.h"
|
|
6
|
|
7 #include <glib.h>
|
|
8 #include <glib/gi18n.h>
|
|
9 #include <gtk/gtk.h>
|
|
10 #include <stdlib.h>
|
|
11 #include <string.h>
|
|
12
|
|
13 #include "libaudacious/configdb.h"
|
|
14 #include "libaudacious/dirbrowser.h"
|
|
15 #include "libaudacious/titlestring.h"
|
|
16 #include "libaudacious/util.h"
|
|
17 #include "audacious/plugin.h"
|
|
18
|
|
19 extern GMutex *vf_mutex;
|
|
20
|
|
21 static GtkWidget *vorbis_configurewin = NULL;
|
|
22 static GtkWidget *vbox, *notebook;
|
|
23
|
|
24 static GtkWidget *streaming_proxy_use, *streaming_proxy_host_entry;
|
|
25 static GtkWidget *streaming_proxy_port_entry, *streaming_save_entry;
|
|
26 static GtkWidget *streaming_save_use, *streaming_size_spin,
|
|
27 *streaming_pre_spin;
|
|
28 static GtkWidget *streaming_proxy_auth_use;
|
|
29 static GtkWidget *streaming_proxy_auth_pass_entry,
|
|
30 *streaming_proxy_auth_user_entry;
|
|
31 static GtkWidget *streaming_proxy_auth_user_label,
|
|
32 *streaming_proxy_auth_pass_label;
|
|
33 static GtkWidget *streaming_proxy_hbox, *streaming_proxy_auth_hbox;
|
|
34 static GtkWidget *streaming_save_dirbrowser, *streaming_save_hbox;
|
|
35 static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry,
|
|
36 *title_desc;
|
|
37 static GtkWidget *rg_switch, *rg_clip_switch, *rg_booster_switch,
|
|
38 *rg_track_gain;
|
|
39
|
|
40 vorbis_config_t vorbis_cfg;
|
|
41
|
|
42 static void
|
|
43 vorbis_configurewin_ok(GtkWidget * widget, gpointer data)
|
|
44 {
|
|
45 ConfigDb *db;
|
|
46 GtkToggleButton *tb;
|
|
47
|
|
48 vorbis_cfg.http_buffer_size =
|
|
49 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
|
|
50 (streaming_size_spin));
|
|
51 vorbis_cfg.http_prebuffer =
|
|
52 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(streaming_pre_spin));
|
|
53
|
|
54 vorbis_cfg.use_proxy =
|
|
55 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
56 g_free(vorbis_cfg.proxy_host);
|
|
57 vorbis_cfg.proxy_host =
|
|
58 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry)));
|
|
59 vorbis_cfg.proxy_port =
|
|
60 atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry)));
|
|
61
|
|
62 vorbis_cfg.proxy_use_auth =
|
|
63 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
64 (streaming_proxy_auth_use));
|
|
65
|
|
66 g_free(vorbis_cfg.proxy_user);
|
|
67 vorbis_cfg.proxy_user = NULL;
|
|
68 if (strlen
|
|
69 (gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0)
|
|
70 vorbis_cfg.proxy_user =
|
|
71 g_strdup(gtk_entry_get_text
|
|
72 (GTK_ENTRY(streaming_proxy_auth_user_entry)));
|
|
73
|
|
74 g_free(vorbis_cfg.proxy_pass);
|
|
75 vorbis_cfg.proxy_pass = NULL;
|
|
76 if (strlen
|
|
77 (gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0)
|
|
78 vorbis_cfg.proxy_pass =
|
|
79 g_strdup(gtk_entry_get_text
|
|
80 (GTK_ENTRY(streaming_proxy_auth_pass_entry)));
|
|
81
|
|
82
|
|
83 vorbis_cfg.save_http_stream =
|
|
84 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
|
|
85 g_free(vorbis_cfg.save_http_path);
|
|
86 vorbis_cfg.save_http_path =
|
|
87 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry)));
|
|
88 g_free(vorbis_cfg.tag_format);
|
|
89 vorbis_cfg.tag_format =
|
|
90 g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry)));
|
|
91
|
|
92 tb = GTK_TOGGLE_BUTTON(title_tag_override);
|
|
93 vorbis_cfg.tag_override = gtk_toggle_button_get_active(tb);
|
|
94 tb = GTK_TOGGLE_BUTTON(rg_switch);
|
|
95 vorbis_cfg.use_replaygain = gtk_toggle_button_get_active(tb);
|
|
96 tb = GTK_TOGGLE_BUTTON(rg_clip_switch);
|
|
97 vorbis_cfg.use_anticlip = gtk_toggle_button_get_active(tb);
|
|
98 tb = GTK_TOGGLE_BUTTON(rg_booster_switch);
|
|
99 vorbis_cfg.use_booster = gtk_toggle_button_get_active(tb);
|
|
100 tb = GTK_TOGGLE_BUTTON(rg_track_gain);
|
|
101 if (gtk_toggle_button_get_active(tb))
|
|
102 vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_TRACK;
|
|
103 else
|
|
104 vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_ALBUM;
|
|
105
|
|
106
|
|
107 db = bmp_cfg_db_open();
|
|
108
|
|
109 bmp_cfg_db_set_int(db, "vorbis", "http_buffer_size",
|
|
110 vorbis_cfg.http_buffer_size);
|
|
111 bmp_cfg_db_set_int(db, "vorbis", "http_prebuffer",
|
|
112 vorbis_cfg.http_prebuffer);
|
|
113 bmp_cfg_db_set_bool(db, "vorbis", "use_proxy", vorbis_cfg.use_proxy);
|
|
114 bmp_cfg_db_set_string(db, "vorbis", "proxy_host", vorbis_cfg.proxy_host);
|
|
115 bmp_cfg_db_set_bool(db, "vorbis", "save_http_stream",
|
|
116 vorbis_cfg.save_http_stream);
|
|
117 bmp_cfg_db_set_string(db, "vorbis", "save_http_path",
|
|
118 vorbis_cfg.save_http_path);
|
|
119 bmp_cfg_db_set_bool(db, "vorbis", "tag_override",
|
|
120 vorbis_cfg.tag_override);
|
|
121 bmp_cfg_db_set_string(db, "vorbis", "tag_format", vorbis_cfg.tag_format);
|
|
122 bmp_cfg_db_set_int(db, "vorbis", "proxy_port", vorbis_cfg.proxy_port);
|
|
123 bmp_cfg_db_set_bool(db, "vorbis", "proxy_use_auth",
|
|
124 vorbis_cfg.proxy_use_auth);
|
|
125 if (vorbis_cfg.proxy_user)
|
|
126 bmp_cfg_db_set_string(db, "vorbis", "proxy_user",
|
|
127 vorbis_cfg.proxy_user);
|
|
128 else
|
|
129 bmp_cfg_db_unset_key(db, "vorbis", "proxy_user");
|
|
130
|
|
131 if (vorbis_cfg.proxy_pass)
|
|
132 bmp_cfg_db_set_string(db, "vorbis", "proxy_pass",
|
|
133 vorbis_cfg.proxy_pass);
|
|
134 else
|
|
135 bmp_cfg_db_unset_key(db, "vorbis", "proxy_pass");
|
|
136 bmp_cfg_db_set_bool(db, "vorbis", "use_anticlip",
|
|
137 vorbis_cfg.use_anticlip);
|
|
138 bmp_cfg_db_set_bool(db, "vorbis", "use_replaygain",
|
|
139 vorbis_cfg.use_replaygain);
|
|
140 bmp_cfg_db_set_int(db, "vorbis", "replaygain_mode",
|
|
141 vorbis_cfg.replaygain_mode);
|
|
142 bmp_cfg_db_set_bool(db, "vorbis", "use_booster", vorbis_cfg.use_booster);
|
|
143 bmp_cfg_db_close(db);
|
|
144 gtk_widget_destroy(vorbis_configurewin);
|
|
145 }
|
|
146
|
|
147 static void
|
|
148 proxy_use_cb(GtkWidget * w, gpointer data)
|
|
149 {
|
|
150 gboolean use_proxy, use_proxy_auth;
|
|
151
|
|
152 use_proxy =
|
|
153 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
154 use_proxy_auth =
|
|
155 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
156 (streaming_proxy_auth_use));
|
|
157
|
|
158 gtk_widget_set_sensitive(streaming_proxy_hbox, use_proxy);
|
|
159 gtk_widget_set_sensitive(streaming_proxy_auth_use, use_proxy);
|
|
160 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy
|
|
161 && use_proxy_auth);
|
|
162 }
|
|
163
|
|
164 static void
|
|
165 proxy_auth_use_cb(GtkWidget * w, gpointer data)
|
|
166 {
|
|
167 gboolean use_proxy, use_proxy_auth;
|
|
168
|
|
169 use_proxy =
|
|
170 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use));
|
|
171 use_proxy_auth =
|
|
172 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
173 (streaming_proxy_auth_use));
|
|
174
|
|
175 gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy
|
|
176 && use_proxy_auth);
|
|
177 }
|
|
178
|
|
179 static void
|
|
180 streaming_save_dirbrowser_cb(gchar * dir)
|
|
181 {
|
|
182 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir);
|
|
183 }
|
|
184
|
|
185 static void
|
|
186 streaming_save_browse_cb(GtkWidget * w, gpointer data)
|
|
187 {
|
|
188 if (streaming_save_dirbrowser)
|
|
189 return;
|
|
190
|
|
191 streaming_save_dirbrowser =
|
|
192 xmms_create_dir_browser(_("Select the directory where you want "
|
|
193 "to store the Ogg Vorbis streams:"),
|
|
194 vorbis_cfg.save_http_path,
|
|
195 GTK_SELECTION_SINGLE,
|
|
196 streaming_save_dirbrowser_cb);
|
|
197 g_signal_connect(G_OBJECT(streaming_save_dirbrowser),
|
|
198 "destroy", G_CALLBACK(gtk_widget_destroyed),
|
|
199 &streaming_save_dirbrowser);
|
|
200 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser),
|
|
201 GTK_WINDOW(vorbis_configurewin));
|
|
202 gtk_widget_show(streaming_save_dirbrowser);
|
|
203 }
|
|
204
|
|
205 static void
|
|
206 streaming_save_use_cb(GtkWidget * w, gpointer data)
|
|
207 {
|
|
208 gboolean save_stream;
|
|
209
|
|
210 save_stream =
|
|
211 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use));
|
|
212
|
|
213 gtk_widget_set_sensitive(streaming_save_hbox, save_stream);
|
|
214 }
|
|
215
|
|
216 static void
|
|
217 configure_destroy(GtkWidget * w, gpointer data)
|
|
218 {
|
|
219 /* if (streaming_save_dirbrowser) */
|
|
220 /* gtk_widget_destroy(streaming_save_dirbrowser); */
|
|
221 }
|
|
222
|
|
223 static void
|
|
224 title_tag_override_cb(GtkWidget * w, gpointer data)
|
|
225 {
|
|
226 gboolean override;
|
|
227 override =
|
|
228 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override));
|
|
229 gtk_widget_set_sensitive(title_tag_box, override);
|
|
230 gtk_widget_set_sensitive(title_desc, override);
|
|
231 }
|
|
232
|
|
233 static void
|
|
234 rg_switch_cb(GtkWidget * w, gpointer data)
|
|
235 {
|
|
236 gtk_widget_set_sensitive(GTK_WIDGET(data),
|
|
237 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
|
|
238 (w)));
|
|
239 }
|
|
240
|
|
241 void
|
|
242 vorbis_configure(void)
|
|
243 {
|
|
244 GtkWidget *streaming_vbox;
|
|
245 GtkWidget *streaming_buf_frame, *streaming_buf_hbox;
|
|
246 GtkWidget *streaming_size_box, *streaming_size_label;
|
|
247 GtkWidget *streaming_pre_box, *streaming_pre_label;
|
|
248 GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox;
|
|
249 GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label;
|
|
250 GtkWidget *streaming_save_frame, *streaming_save_vbox;
|
|
251 GtkWidget *streaming_save_label, *streaming_save_browse;
|
|
252 GtkWidget *title_frame, *title_tag_vbox, *title_tag_label;
|
|
253 GtkWidget *rg_frame, *rg_vbox;
|
|
254 GtkWidget *bbox, *ok, *cancel;
|
|
255 GtkWidget *rg_type_frame, *rg_type_vbox, *rg_album_gain;
|
|
256 GtkObject *streaming_size_adj, *streaming_pre_adj;
|
|
257
|
|
258 char *temp;
|
|
259
|
|
260 if (vorbis_configurewin != NULL) {
|
|
261 gtk_window_present(GTK_WINDOW(vorbis_configurewin));
|
|
262 return;
|
|
263 }
|
|
264
|
|
265 vorbis_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
266 gtk_window_set_type_hint(GTK_WINDOW(vorbis_configurewin),
|
|
267 GDK_WINDOW_TYPE_HINT_DIALOG);
|
|
268 gtk_window_set_position(GTK_WINDOW(vorbis_configurewin),
|
|
269 GTK_WIN_POS_CENTER);
|
|
270 g_signal_connect(G_OBJECT(vorbis_configurewin), "destroy",
|
|
271 G_CALLBACK(gtk_widget_destroyed), &vorbis_configurewin);
|
|
272 g_signal_connect(G_OBJECT(vorbis_configurewin), "destroy",
|
|
273 G_CALLBACK(configure_destroy), &vorbis_configurewin);
|
|
274 gtk_window_set_title(GTK_WINDOW(vorbis_configurewin),
|
|
275 _("Ogg Vorbis Audio Plugin Configuration"));
|
|
276 gtk_window_set_resizable(GTK_WINDOW(vorbis_configurewin), FALSE);
|
|
277 gtk_container_border_width(GTK_CONTAINER(vorbis_configurewin), 10);
|
|
278
|
|
279 vbox = gtk_vbox_new(FALSE, 10);
|
|
280 gtk_container_add(GTK_CONTAINER(vorbis_configurewin), vbox);
|
|
281
|
|
282 notebook = gtk_notebook_new();
|
|
283 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
|
|
284
|
|
285 streaming_vbox = gtk_vbox_new(FALSE, 0);
|
|
286
|
|
287 streaming_buf_frame = gtk_frame_new(_("Buffering:"));
|
|
288 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5);
|
|
289 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE,
|
|
290 FALSE, 0);
|
|
291
|
|
292 streaming_buf_hbox = gtk_hbox_new(TRUE, 5);
|
|
293 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5);
|
|
294 gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox);
|
|
295
|
|
296 streaming_size_box = gtk_hbox_new(FALSE, 5);
|
|
297 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box,
|
|
298 TRUE, TRUE, 0);
|
|
299 streaming_size_label = gtk_label_new(_("Buffer size (kb):"));
|
|
300 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label,
|
|
301 FALSE, FALSE, 0);
|
|
302 streaming_size_adj =
|
|
303 gtk_adjustment_new(vorbis_cfg.http_buffer_size, 4, 4096, 4, 4, 4);
|
|
304 streaming_size_spin =
|
|
305 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0);
|
|
306 gtk_widget_set_usize(streaming_size_spin, 60, -1);
|
|
307 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin,
|
|
308 FALSE, FALSE, 0);
|
|
309
|
|
310 streaming_pre_box = gtk_hbox_new(FALSE, 5);
|
|
311 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box,
|
|
312 TRUE, TRUE, 0);
|
|
313 streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
|
|
314 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label,
|
|
315 FALSE, FALSE, 0);
|
|
316 streaming_pre_adj =
|
|
317 gtk_adjustment_new(vorbis_cfg.http_prebuffer, 0, 90, 1, 1, 1);
|
|
318 streaming_pre_spin =
|
|
319 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0);
|
|
320 gtk_widget_set_usize(streaming_pre_spin, 60, -1);
|
|
321 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin,
|
|
322 FALSE, FALSE, 0);
|
|
323
|
|
324 /*
|
|
325 * Proxy config.
|
|
326 */
|
|
327 streaming_proxy_frame = gtk_frame_new(_("Proxy:"));
|
|
328 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5);
|
|
329 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame,
|
|
330 FALSE, FALSE, 0);
|
|
331
|
|
332 streaming_proxy_vbox = gtk_vbox_new(FALSE, 5);
|
|
333 gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5);
|
|
334 gtk_container_add(GTK_CONTAINER(streaming_proxy_frame),
|
|
335 streaming_proxy_vbox);
|
|
336
|
|
337 streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy"));
|
|
338 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use),
|
|
339 vorbis_cfg.use_proxy);
|
|
340 g_signal_connect(G_OBJECT(streaming_proxy_use), "clicked",
|
|
341 G_CALLBACK(proxy_use_cb), NULL);
|
|
342 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use,
|
|
343 FALSE, FALSE, 0);
|
|
344
|
|
345 streaming_proxy_hbox = gtk_hbox_new(FALSE, 5);
|
|
346 gtk_widget_set_sensitive(streaming_proxy_hbox, vorbis_cfg.use_proxy);
|
|
347 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox,
|
|
348 FALSE, FALSE, 0);
|
|
349
|
|
350 streaming_proxy_host_label = gtk_label_new(_("Host:"));
|
|
351 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
352 streaming_proxy_host_label, FALSE, FALSE, 0);
|
|
353
|
|
354 streaming_proxy_host_entry = gtk_entry_new();
|
|
355 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry),
|
|
356 vorbis_cfg.proxy_host);
|
|
357 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
358 streaming_proxy_host_entry, TRUE, TRUE, 0);
|
|
359
|
|
360 streaming_proxy_port_label = gtk_label_new(_("Port:"));
|
|
361 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
362 streaming_proxy_port_label, FALSE, FALSE, 0);
|
|
363
|
|
364 streaming_proxy_port_entry = gtk_entry_new();
|
|
365 gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1);
|
|
366 temp = g_strdup_printf("%d", vorbis_cfg.proxy_port);
|
|
367 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp);
|
|
368 g_free(temp);
|
|
369 gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox),
|
|
370 streaming_proxy_port_entry, FALSE, FALSE, 0);
|
|
371
|
|
372 streaming_proxy_auth_use =
|
|
373 gtk_check_button_new_with_label(_("Use authentication"));
|
|
374 gtk_widget_set_sensitive(streaming_proxy_auth_use, vorbis_cfg.use_proxy);
|
|
375 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
|
|
376 (streaming_proxy_auth_use),
|
|
377 vorbis_cfg.proxy_use_auth);
|
|
378 g_signal_connect(G_OBJECT(streaming_proxy_auth_use), "clicked",
|
|
379 G_CALLBACK(proxy_auth_use_cb), NULL);
|
|
380 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox),
|
|
381 streaming_proxy_auth_use, FALSE, FALSE, 0);
|
|
382
|
|
383 streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5);
|
|
384 gtk_widget_set_sensitive(streaming_proxy_auth_hbox,
|
|
385 vorbis_cfg.use_proxy
|
|
386 && vorbis_cfg.proxy_use_auth);
|
|
387 gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox),
|
|
388 streaming_proxy_auth_hbox, FALSE, FALSE, 0);
|
|
389
|
|
390 streaming_proxy_auth_user_label = gtk_label_new(_("Username:"));
|
|
391 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
392 streaming_proxy_auth_user_label, FALSE, FALSE, 0);
|
|
393
|
|
394 streaming_proxy_auth_user_entry = gtk_entry_new();
|
|
395 if (vorbis_cfg.proxy_user)
|
|
396 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_user_entry),
|
|
397 vorbis_cfg.proxy_user);
|
|
398 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
399 streaming_proxy_auth_user_entry, TRUE, TRUE, 0);
|
|
400
|
|
401 streaming_proxy_auth_pass_label = gtk_label_new(_("Password:"));
|
|
402 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
403 streaming_proxy_auth_pass_label, FALSE, FALSE, 0);
|
|
404
|
|
405 streaming_proxy_auth_pass_entry = gtk_entry_new();
|
|
406 if (vorbis_cfg.proxy_pass)
|
|
407 gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_pass_entry),
|
|
408 vorbis_cfg.proxy_pass);
|
|
409 gtk_entry_set_visibility(GTK_ENTRY(streaming_proxy_auth_pass_entry),
|
|
410 FALSE);
|
|
411 gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox),
|
|
412 streaming_proxy_auth_pass_entry, TRUE, TRUE, 0);
|
|
413
|
|
414
|
|
415 /*
|
|
416 * Save to disk config.
|
|
417 */
|
|
418 streaming_save_frame = gtk_frame_new(_("Save stream to disk:"));
|
|
419 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5);
|
|
420 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame,
|
|
421 FALSE, FALSE, 0);
|
|
422
|
|
423 streaming_save_vbox = gtk_vbox_new(FALSE, 5);
|
|
424 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5);
|
|
425 gtk_container_add(GTK_CONTAINER(streaming_save_frame),
|
|
426 streaming_save_vbox);
|
|
427
|
|
428 streaming_save_use =
|
|
429 gtk_check_button_new_with_label(_("Save stream to disk"));
|
|
430 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use),
|
|
431 vorbis_cfg.save_http_stream);
|
|
432 g_signal_connect(G_OBJECT(streaming_save_use), "clicked",
|
|
433 G_CALLBACK(streaming_save_use_cb), NULL);
|
|
434 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use,
|
|
435 FALSE, FALSE, 0);
|
|
436
|
|
437 streaming_save_hbox = gtk_hbox_new(FALSE, 5);
|
|
438 gtk_widget_set_sensitive(streaming_save_hbox,
|
|
439 vorbis_cfg.save_http_stream);
|
|
440 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox,
|
|
441 FALSE, FALSE, 0);
|
|
442
|
|
443 streaming_save_label = gtk_label_new(_("Path:"));
|
|
444 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label,
|
|
445 FALSE, FALSE, 0);
|
|
446
|
|
447 streaming_save_entry = gtk_entry_new();
|
|
448 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry),
|
|
449 vorbis_cfg.save_http_path);
|
|
450 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry,
|
|
451 TRUE, TRUE, 0);
|
|
452
|
|
453 streaming_save_browse = gtk_button_new_with_label(_("Browse"));
|
|
454 g_signal_connect(G_OBJECT(streaming_save_browse), "clicked",
|
|
455 G_CALLBACK(streaming_save_browse_cb), NULL);
|
|
456 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse,
|
|
457 FALSE, FALSE, 0);
|
|
458
|
|
459 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox,
|
|
460 gtk_label_new(_("Streaming")));
|
|
461
|
|
462 /* Title config.. */
|
|
463
|
|
464 title_frame = gtk_frame_new(_("Ogg Vorbis Tags:"));
|
|
465 gtk_container_border_width(GTK_CONTAINER(title_frame), 5);
|
|
466
|
|
467 title_tag_vbox = gtk_vbox_new(FALSE, 10);
|
|
468 gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5);
|
|
469 gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox);
|
|
470
|
|
471 title_tag_override =
|
|
472 gtk_check_button_new_with_label(_("Override generic titles"));
|
|
473 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override),
|
|
474 vorbis_cfg.tag_override);
|
|
475 g_signal_connect(G_OBJECT(title_tag_override), "clicked",
|
|
476 G_CALLBACK(title_tag_override_cb), NULL);
|
|
477 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE,
|
|
478 FALSE, 0);
|
|
479
|
|
480 title_tag_box = gtk_hbox_new(FALSE, 5);
|
|
481 gtk_widget_set_sensitive(title_tag_box, vorbis_cfg.tag_override);
|
|
482 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE,
|
|
483 FALSE, 0);
|
|
484
|
|
485 title_tag_label = gtk_label_new(_("Title format:"));
|
|
486 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE,
|
|
487 FALSE, 0);
|
|
488
|
|
489 title_tag_entry = gtk_entry_new();
|
|
490 gtk_entry_set_text(GTK_ENTRY(title_tag_entry), vorbis_cfg.tag_format);
|
|
491 gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE,
|
|
492 0);
|
|
493
|
|
494 title_desc = xmms_titlestring_descriptions("pafFetndgc", 2);
|
|
495 gtk_widget_set_sensitive(title_desc, vorbis_cfg.tag_override);
|
|
496 gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0);
|
|
497
|
|
498 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame,
|
|
499 gtk_label_new(_("Title")));
|
|
500
|
|
501 /* Replay Gain.. */
|
|
502
|
|
503 rg_frame = gtk_frame_new(_("ReplayGain Settings:"));
|
|
504 gtk_container_border_width(GTK_CONTAINER(rg_frame), 5);
|
|
505
|
|
506 rg_vbox = gtk_vbox_new(FALSE, 10);
|
|
507 gtk_container_border_width(GTK_CONTAINER(rg_vbox), 5);
|
|
508 gtk_container_add(GTK_CONTAINER(rg_frame), rg_vbox);
|
|
509
|
|
510 rg_clip_switch =
|
|
511 gtk_check_button_new_with_label(_("Enable Clipping Prevention"));
|
|
512 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_clip_switch),
|
|
513 vorbis_cfg.use_anticlip);
|
|
514 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_clip_switch, FALSE, FALSE, 0);
|
|
515
|
|
516 rg_switch = gtk_check_button_new_with_label(_("Enable ReplayGain"));
|
|
517 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_switch),
|
|
518 vorbis_cfg.use_replaygain);
|
|
519 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_switch, FALSE, FALSE, 0);
|
|
520
|
|
521 rg_type_frame = gtk_frame_new(_("ReplayGain Type:"));
|
|
522 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_type_frame, FALSE, FALSE, 0);
|
|
523
|
|
524 g_signal_connect(G_OBJECT(rg_switch), "toggled",
|
|
525 G_CALLBACK(rg_switch_cb), rg_type_frame);
|
|
526
|
|
527 rg_type_vbox = gtk_vbox_new(FALSE, 5);
|
|
528 gtk_container_set_border_width(GTK_CONTAINER(rg_type_vbox), 5);
|
|
529 gtk_container_add(GTK_CONTAINER(rg_type_frame), rg_type_vbox);
|
|
530
|
|
531 rg_track_gain =
|
|
532 gtk_radio_button_new_with_label(NULL, _("use Track Gain/Peak"));
|
|
533 if (vorbis_cfg.replaygain_mode == REPLAYGAIN_MODE_TRACK)
|
|
534 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_track_gain), TRUE);
|
|
535 else
|
|
536 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_track_gain), FALSE);
|
|
537 gtk_box_pack_start(GTK_BOX(rg_type_vbox), rg_track_gain, FALSE, FALSE, 0);
|
|
538
|
|
539 rg_album_gain =
|
|
540 gtk_radio_button_new_with_label(gtk_radio_button_group
|
|
541 (GTK_RADIO_BUTTON(rg_track_gain)),
|
|
542 _("use Album Gain/Peak"));
|
|
543 if (vorbis_cfg.replaygain_mode == REPLAYGAIN_MODE_ALBUM)
|
|
544 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_album_gain), TRUE);
|
|
545 else
|
|
546 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_album_gain), FALSE);
|
|
547 gtk_box_pack_start(GTK_BOX(rg_type_vbox), rg_album_gain, FALSE, FALSE, 0);
|
|
548
|
|
549 if (!vorbis_cfg.use_replaygain)
|
|
550 gtk_widget_set_sensitive(rg_type_frame, FALSE);
|
|
551
|
|
552 rg_booster_switch =
|
|
553 gtk_check_button_new_with_label(_
|
|
554 ("Enable 6dB Boost + Hard Limiting"));
|
|
555 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_booster_switch),
|
|
556 vorbis_cfg.use_booster);
|
|
557 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_booster_switch, FALSE, FALSE, 0);
|
|
558
|
|
559 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), rg_frame,
|
|
560 gtk_label_new(_("ReplayGain")));
|
|
561
|
|
562 /* Buttons */
|
|
563
|
|
564 bbox = gtk_hbutton_box_new();
|
|
565 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
|
566 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
|
|
567 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
|
568
|
|
569 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
|
570 gtk_button_set_use_stock(GTK_BUTTON(cancel), TRUE);
|
|
571 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
|
|
572 G_CALLBACK(gtk_widget_destroy),
|
|
573 G_OBJECT(vorbis_configurewin));
|
|
574 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
|
|
575 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
|
|
576
|
|
577 ok = gtk_button_new_from_stock(GTK_STOCK_OK);
|
|
578 gtk_button_set_use_stock(GTK_BUTTON(ok), TRUE);
|
|
579 g_signal_connect(G_OBJECT(ok), "clicked",
|
|
580 G_CALLBACK(vorbis_configurewin_ok), NULL);
|
|
581 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
|
|
582 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
|
|
583 gtk_widget_grab_default(ok);
|
|
584
|
|
585 gtk_widget_show_all(vorbis_configurewin);
|
|
586 }
|