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