Mercurial > audlegacy
annotate Plugins/Input/mpg123/configure.c @ 1260:bf0664762d4a trunk
[svn] - remove unused code (causes a crash on some GTKs, eww!)
author | nenolod |
---|---|
date | Thu, 15 Jun 2006 19:06:40 -0700 |
parents | b5ae09a6c2f1 |
children | c7b3996a123f |
rev | line source |
---|---|
61 | 1 |
2 #include "mpg123.h" | |
3 | |
4 #include <glib.h> | |
5 #include <glib/gi18n.h> | |
6 #include <gtk/gtk.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <math.h> | |
10 | |
11 #include <libaudacious/configdb.h> | |
12 #include <libaudacious/dirbrowser.h> | |
13 #include <libaudacious/titlestring.h> | |
14 | |
15 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
16 static GtkWidget *mpgdec_configurewin = NULL; |
61 | 17 static GtkWidget *vbox, *notebook; |
18 static GtkWidget *decode_vbox, *decode_hbox1; | |
19 static GtkWidget *decode_res_frame, *decode_res_vbox, *decode_res_16, | |
20 *decode_res_8; | |
21 static GtkWidget *decode_ch_frame, *decode_ch_vbox, *decode_ch_stereo, | |
22 *decode_ch_mono; | |
23 static GtkWidget *decode_freq_frame, *decode_freq_vbox, *decode_freq_1to1, | |
24 *decode_freq_1to2, *decode_freq_1to4; | |
25 | |
26 static GtkObject *streaming_size_adj, *streaming_pre_adj; | |
1071
592ef16386aa
[svn] - use global proxy configuration instead of individual configurations (chainsaw)
nenolod
parents:
651
diff
changeset
|
27 static GtkWidget *streaming_save_use, *streaming_save_entry; |
1260
bf0664762d4a
[svn] - remove unused code (causes a crash on some GTKs, eww!)
nenolod
parents:
1098
diff
changeset
|
28 static GtkWidget *streaming_udp_title; |
1071
592ef16386aa
[svn] - use global proxy configuration instead of individual configurations (chainsaw)
nenolod
parents:
651
diff
changeset
|
29 static GtkWidget *streaming_save_dirbrowser; |
61 | 30 static GtkWidget *streaming_save_hbox, *title_id3_box, *title_tag_desc; |
31 static GtkWidget *title_override, *title_id3_entry, *title_id3v2_disable; | |
32 | |
33 /* Encoding patch */ | |
34 static GtkWidget *title_encoding_hbox, *title_encoding_enabled, *title_encoding, *title_encoding_label; | |
35 /* Encoding patch */ | |
36 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
37 MPG123Config mpgdec_cfg; |
61 | 38 |
39 static void | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
40 mpgdec_configurewin_ok(GtkWidget * widget, gpointer data) |
61 | 41 { |
42 ConfigDb *db; | |
43 | |
44 if (GTK_TOGGLE_BUTTON(decode_res_16)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
45 mpgdec_cfg.resolution = 16; |
61 | 46 else if (GTK_TOGGLE_BUTTON(decode_res_8)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
47 mpgdec_cfg.resolution = 8; |
61 | 48 |
49 if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
50 mpgdec_cfg.channels = 2; |
61 | 51 else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
52 mpgdec_cfg.channels = 1; |
61 | 53 |
54 if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active) | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
55 mpgdec_cfg.downsample = 0; |
61 | 56 else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
57 mpgdec_cfg.downsample = 1; |
61 | 58 if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active) |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
59 mpgdec_cfg.downsample = 2; |
61 | 60 |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
61 mpgdec_cfg.http_buffer_size = |
61 | 62 (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
63 mpgdec_cfg.http_prebuffer = |
61 | 64 (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; |
65 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
66 mpgdec_cfg.save_http_stream = |
61 | 67 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
68 if (mpgdec_cfg.save_http_path) |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
69 g_free(mpgdec_cfg.save_http_path); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
70 mpgdec_cfg.save_http_path = |
61 | 71 g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); |
72 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
73 mpgdec_cfg.use_udp_channel = |
61 | 74 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); |
75 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
76 mpgdec_cfg.title_override = |
61 | 77 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
78 mpgdec_cfg.disable_id3v2 = |
61 | 79 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable)); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
80 g_free(mpgdec_cfg.id3_format); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
81 mpgdec_cfg.id3_format = |
61 | 82 g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry))); |
83 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
84 mpgdec_cfg.title_encoding_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled)); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
85 mpgdec_cfg.title_encoding = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_encoding))); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
86 if (mpgdec_cfg.title_encoding_enabled) |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
87 mpgdec_id3_encoding_list = g_strsplit_set(mpgdec_cfg.title_encoding, ENCODING_SEPARATOR, 0); |
61 | 88 db = bmp_cfg_db_open(); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
89 bmp_cfg_db_set_int(db, "MPG123", "resolution", mpgdec_cfg.resolution); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
90 bmp_cfg_db_set_int(db, "MPG123", "channels", mpgdec_cfg.channels); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
91 bmp_cfg_db_set_int(db, "MPG123", "downsample", mpgdec_cfg.downsample); |
61 | 92 bmp_cfg_db_set_int(db, "MPG123", "http_buffer_size", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
93 mpgdec_cfg.http_buffer_size); |
61 | 94 bmp_cfg_db_set_int(db, "MPG123", "http_prebuffer", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
95 mpgdec_cfg.http_prebuffer); |
61 | 96 bmp_cfg_db_set_bool(db, "MPG123", "save_http_stream", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
97 mpgdec_cfg.save_http_stream); |
61 | 98 bmp_cfg_db_set_string(db, "MPG123", "save_http_path", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
99 mpgdec_cfg.save_http_path); |
61 | 100 bmp_cfg_db_set_bool(db, "MPG123", "use_udp_channel", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
101 mpgdec_cfg.use_udp_channel); |
61 | 102 bmp_cfg_db_set_bool(db, "MPG123", "title_override", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
103 mpgdec_cfg.title_override); |
61 | 104 bmp_cfg_db_set_bool(db, "MPG123", "disable_id3v2", |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
105 mpgdec_cfg.disable_id3v2); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
106 bmp_cfg_db_set_string(db, "MPG123", "id3_format", mpgdec_cfg.id3_format); |
61 | 107 |
108 /* Encoding patch */ | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
109 bmp_cfg_db_set_bool(db, "MPG123", "title_encoding_enabled", mpgdec_cfg.title_encoding_enabled); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
110 bmp_cfg_db_set_string(db, "MPG123", "title_encoding", mpgdec_cfg.title_encoding); |
61 | 111 /* Encoding patch */ |
112 | |
113 bmp_cfg_db_close(db); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
114 gtk_widget_destroy(mpgdec_configurewin); |
61 | 115 } |
116 | |
117 static void | |
118 streaming_save_dirbrowser_cb(gchar * dir) | |
119 { | |
120 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir); | |
121 } | |
122 | |
123 static void | |
124 streaming_save_browse_cb(GtkWidget * w, gpointer data) | |
125 { | |
126 if (!streaming_save_dirbrowser) { | |
127 streaming_save_dirbrowser = | |
128 xmms_create_dir_browser(_ | |
129 ("Select the directory where you want to store the MPEG streams:"), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
130 mpgdec_cfg.save_http_path, |
61 | 131 GTK_SELECTION_SINGLE, |
132 streaming_save_dirbrowser_cb); | |
133 g_signal_connect(G_OBJECT(streaming_save_dirbrowser), "destroy", | |
134 G_CALLBACK(gtk_widget_destroyed), | |
135 &streaming_save_dirbrowser); | |
136 gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
137 GTK_WINDOW(mpgdec_configurewin)); |
61 | 138 gtk_widget_show(streaming_save_dirbrowser); |
139 } | |
140 } | |
141 | |
142 static void | |
143 streaming_save_use_cb(GtkWidget * w, gpointer data) | |
144 { | |
145 gboolean save_stream; | |
146 | |
147 save_stream = | |
148 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); | |
149 | |
150 gtk_widget_set_sensitive(streaming_save_hbox, save_stream); | |
151 } | |
152 | |
153 static void | |
154 title_override_cb(GtkWidget * w, gpointer data) | |
155 { | |
156 gboolean override; | |
157 override = | |
158 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); | |
159 gtk_widget_set_sensitive(title_id3_box, override); | |
160 gtk_widget_set_sensitive(title_tag_desc, override); | |
161 } | |
162 | |
163 /* Encoding patch */ | |
164 static void | |
165 title_encoding_enabled_cb(GtkWidget * w, gpointer data) | |
166 { | |
167 gboolean encoding_enabled; | |
168 encoding_enabled = | |
169 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_encoding_enabled)); | |
170 gtk_widget_set_sensitive(title_encoding_hbox, encoding_enabled); | |
171 } | |
172 /* Encoding patch */ | |
173 | |
174 static void | |
175 configure_destroy(GtkWidget * w, gpointer data) | |
176 { | |
177 if (streaming_save_dirbrowser) | |
178 gtk_widget_destroy(streaming_save_dirbrowser); | |
179 } | |
180 | |
181 void | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
182 mpgdec_configure(void) |
61 | 183 { |
184 GtkWidget *streaming_vbox; | |
185 GtkWidget *streaming_buf_frame, *streaming_buf_hbox; | |
186 GtkWidget *streaming_size_box, *streaming_size_label, | |
187 *streaming_size_spin; | |
188 GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin; | |
189 GtkWidget *streaming_save_frame, *streaming_save_vbox; | |
190 GtkWidget *streaming_save_label, *streaming_save_browse; | |
191 GtkWidget *streaming_cast_frame, *streaming_cast_vbox; | |
192 GtkWidget *title_frame, *title_id3_vbox, *title_id3_label; | |
193 GtkWidget *bbox, *ok, *cancel; | |
194 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
195 if (mpgdec_configurewin != NULL) { |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
196 gtk_window_present(GTK_WINDOW(mpgdec_configurewin)); |
61 | 197 return; |
198 } | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
199 mpgdec_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
200 gtk_window_set_type_hint(GTK_WINDOW(mpgdec_configurewin), |
61 | 201 GDK_WINDOW_TYPE_HINT_DIALOG); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
202 gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), |
61 | 203 GTK_WIN_POS_CENTER); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
204 g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
205 G_CALLBACK(gtk_widget_destroyed), &mpgdec_configurewin); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
206 g_signal_connect(G_OBJECT(mpgdec_configurewin), "destroy", |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
207 G_CALLBACK(configure_destroy), &mpgdec_configurewin); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
208 gtk_window_set_title(GTK_WINDOW(mpgdec_configurewin), |
61 | 209 _("MPEG Audio Plugin Configuration")); |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
210 gtk_window_set_resizable(GTK_WINDOW(mpgdec_configurewin), FALSE); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
211 /* gtk_window_set_position(GTK_WINDOW(mpgdec_configurewin), GTK_WIN_POS_MOUSE); */ |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
212 gtk_container_border_width(GTK_CONTAINER(mpgdec_configurewin), 10); |
61 | 213 |
214 vbox = gtk_vbox_new(FALSE, 10); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
215 gtk_container_add(GTK_CONTAINER(mpgdec_configurewin), vbox); |
61 | 216 |
217 notebook = gtk_notebook_new(); | |
218 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
219 | |
220 decode_vbox = gtk_vbox_new(FALSE, 5); | |
221 gtk_container_set_border_width(GTK_CONTAINER(decode_vbox), 5); | |
222 | |
223 decode_hbox1 = gtk_hbox_new(TRUE, 5); | |
224 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_hbox1, FALSE, FALSE, 0); | |
225 | |
226 decode_res_frame = gtk_frame_new(_("Resolution:")); | |
227 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_res_frame, TRUE, TRUE, | |
228 0); | |
229 | |
230 decode_res_vbox = gtk_vbox_new(FALSE, 5); | |
231 gtk_container_set_border_width(GTK_CONTAINER(decode_res_vbox), 5); | |
232 gtk_container_add(GTK_CONTAINER(decode_res_frame), decode_res_vbox); | |
233 | |
234 decode_res_16 = gtk_radio_button_new_with_label(NULL, _("16 bit")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
235 if (mpgdec_cfg.resolution == 16) |
61 | 236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_16), TRUE); |
237 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_16, FALSE, | |
238 FALSE, 0); | |
239 | |
240 decode_res_8 = | |
241 gtk_radio_button_new_with_label(gtk_radio_button_group | |
242 (GTK_RADIO_BUTTON(decode_res_16)), | |
243 _("8 bit")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
244 if (mpgdec_cfg.resolution == 8) |
61 | 245 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_res_8), TRUE); |
246 | |
247 gtk_box_pack_start(GTK_BOX(decode_res_vbox), decode_res_8, FALSE, | |
248 FALSE, 0); | |
249 | |
250 decode_ch_frame = gtk_frame_new(_("Channels:")); | |
251 gtk_box_pack_start(GTK_BOX(decode_hbox1), decode_ch_frame, TRUE, TRUE, 0); | |
252 | |
253 decode_ch_vbox = gtk_vbox_new(FALSE, 5); | |
254 gtk_container_set_border_width(GTK_CONTAINER(decode_ch_vbox), 5); | |
255 gtk_container_add(GTK_CONTAINER(decode_ch_frame), decode_ch_vbox); | |
256 | |
257 decode_ch_stereo = | |
258 gtk_radio_button_new_with_label(NULL, _("Stereo (if available)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
259 if (mpgdec_cfg.channels == 2) |
61 | 260 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_stereo), |
261 TRUE); | |
262 | |
263 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_stereo, FALSE, | |
264 FALSE, 0); | |
265 | |
266 decode_ch_mono = | |
267 gtk_radio_button_new_with_label(gtk_radio_button_group | |
268 (GTK_RADIO_BUTTON | |
269 (decode_ch_stereo)), _("Mono")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
270 if (mpgdec_cfg.channels == 1) |
61 | 271 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_ch_mono), TRUE); |
272 | |
273 gtk_box_pack_start(GTK_BOX(decode_ch_vbox), decode_ch_mono, FALSE, | |
274 FALSE, 0); | |
275 | |
276 decode_freq_frame = gtk_frame_new(_("Down sample:")); | |
277 gtk_box_pack_start(GTK_BOX(decode_vbox), decode_freq_frame, FALSE, | |
278 FALSE, 0); | |
279 | |
280 decode_freq_vbox = gtk_vbox_new(FALSE, 5); | |
281 gtk_container_set_border_width(GTK_CONTAINER(decode_freq_vbox), 5); | |
282 gtk_container_add(GTK_CONTAINER(decode_freq_frame), decode_freq_vbox); | |
283 | |
284 decode_freq_1to1 = | |
285 gtk_radio_button_new_with_label(NULL, _("1:1 (44 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
286 if (mpgdec_cfg.downsample == 0) |
61 | 287 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to1), |
288 TRUE); | |
289 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to1, FALSE, | |
290 FALSE, 0); | |
291 | |
292 decode_freq_1to2 = | |
293 gtk_radio_button_new_with_label(gtk_radio_button_group | |
294 (GTK_RADIO_BUTTON | |
295 (decode_freq_1to1)), | |
296 _("1:2 (22 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
297 if (mpgdec_cfg.downsample == 1) |
61 | 298 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to2), |
299 TRUE); | |
300 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to2, FALSE, | |
301 FALSE, 0); | |
302 | |
303 decode_freq_1to4 = | |
304 gtk_radio_button_new_with_label(gtk_radio_button_group | |
305 (GTK_RADIO_BUTTON | |
306 (decode_freq_1to1)), | |
307 _("1:4 (11 kHz)")); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
308 if (mpgdec_cfg.downsample == 2) |
61 | 309 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(decode_freq_1to4), |
310 TRUE); | |
311 | |
312 gtk_box_pack_start(GTK_BOX(decode_freq_vbox), decode_freq_1to4, FALSE, | |
313 FALSE, 0); | |
314 | |
315 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), decode_vbox, | |
316 gtk_label_new(_("Decoder"))); | |
317 | |
318 streaming_vbox = gtk_vbox_new(FALSE, 0); | |
319 | |
320 streaming_buf_frame = gtk_frame_new(_("Buffering:")); | |
321 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5); | |
322 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, | |
323 FALSE, 0); | |
324 | |
325 streaming_buf_hbox = gtk_hbox_new(TRUE, 5); | |
326 gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5); | |
327 gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox); | |
328 | |
329 streaming_size_box = gtk_hbox_new(FALSE, 5); | |
330 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */ | |
331 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, | |
332 TRUE, TRUE, 0); | |
333 streaming_size_label = gtk_label_new(_("Buffer size (kb):")); | |
334 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, | |
335 FALSE, FALSE, 0); | |
336 streaming_size_adj = | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
337 gtk_adjustment_new(mpgdec_cfg.http_buffer_size, 4, 4096, 4, 4, 4); |
61 | 338 streaming_size_spin = |
339 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0); | |
340 gtk_widget_set_usize(streaming_size_spin, 60, -1); | |
341 gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, | |
342 FALSE, FALSE, 0); | |
343 | |
344 streaming_pre_box = gtk_hbox_new(FALSE, 5); | |
345 /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */ | |
346 gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, | |
347 TRUE, TRUE, 0); | |
348 streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):")); | |
349 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, | |
350 FALSE, FALSE, 0); | |
351 streaming_pre_adj = | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
352 gtk_adjustment_new(mpgdec_cfg.http_prebuffer, 0, 90, 1, 1, 1); |
61 | 353 streaming_pre_spin = |
354 gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0); | |
355 gtk_widget_set_usize(streaming_pre_spin, 60, -1); | |
356 gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, | |
357 FALSE, FALSE, 0); | |
358 | |
359 /* | |
360 * Save to disk config. | |
361 */ | |
362 streaming_save_frame = gtk_frame_new(_("Save stream to disk:")); | |
363 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5); | |
364 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, | |
365 FALSE, FALSE, 0); | |
366 | |
367 streaming_save_vbox = gtk_vbox_new(FALSE, 5); | |
368 gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5); | |
369 gtk_container_add(GTK_CONTAINER(streaming_save_frame), | |
370 streaming_save_vbox); | |
371 | |
372 streaming_save_use = | |
373 gtk_check_button_new_with_label(_("Save stream to disk")); | |
374 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
375 mpgdec_cfg.save_http_stream); |
61 | 376 g_signal_connect(G_OBJECT(streaming_save_use), "clicked", |
377 G_CALLBACK(streaming_save_use_cb), NULL); | |
378 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, | |
379 FALSE, FALSE, 0); | |
380 | |
381 streaming_save_hbox = gtk_hbox_new(FALSE, 5); | |
382 gtk_widget_set_sensitive(streaming_save_hbox, | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
383 mpgdec_cfg.save_http_stream); |
61 | 384 gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, |
385 FALSE, FALSE, 0); | |
386 | |
387 streaming_save_label = gtk_label_new(_("Path:")); | |
388 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, | |
389 FALSE, FALSE, 0); | |
390 | |
391 streaming_save_entry = gtk_entry_new(); | |
392 gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
393 mpgdec_cfg.save_http_path); |
61 | 394 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, |
395 TRUE, TRUE, 0); | |
396 | |
397 streaming_save_browse = gtk_button_new_with_label(_("Browse")); | |
398 g_signal_connect(G_OBJECT(streaming_save_browse), "clicked", | |
399 G_CALLBACK(streaming_save_browse_cb), NULL); | |
400 gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, | |
401 FALSE, FALSE, 0); | |
402 | |
403 streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:")); | |
404 gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5); | |
405 gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, | |
406 FALSE, FALSE, 0); | |
407 | |
408 streaming_cast_vbox = gtk_vbox_new(5, FALSE); | |
409 gtk_container_add(GTK_CONTAINER(streaming_cast_frame), | |
410 streaming_cast_vbox); | |
411 | |
412 streaming_udp_title = | |
413 gtk_check_button_new_with_label(_ | |
414 ("Enable Icecast Metadata UDP Channel")); | |
415 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
416 mpgdec_cfg.use_udp_channel); |
61 | 417 gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, |
418 FALSE, FALSE, 0); | |
419 | |
420 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, | |
421 gtk_label_new(_("Streaming"))); | |
422 | |
423 title_frame = gtk_frame_new(_("ID3 Tags:")); | |
424 gtk_container_border_width(GTK_CONTAINER(title_frame), 5); | |
425 | |
426 title_id3_vbox = gtk_vbox_new(FALSE, 10); | |
427 gtk_container_border_width(GTK_CONTAINER(title_id3_vbox), 5); | |
428 gtk_container_add(GTK_CONTAINER(title_frame), title_id3_vbox); | |
429 | |
430 title_id3v2_disable = | |
431 gtk_check_button_new_with_label(_("Disable ID3V2 tags")); | |
432 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_id3v2_disable), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
433 mpgdec_cfg.disable_id3v2); |
61 | 434 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3v2_disable, FALSE, |
435 FALSE, 0); | |
436 | |
437 | |
438 /* Encoding patch */ | |
439 title_encoding_enabled = | |
440 gtk_check_button_new_with_label(_("Convert non-UTF8 ID3 tags to UTF8")); | |
441 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_encoding_enabled), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
442 mpgdec_cfg.title_encoding_enabled); |
61 | 443 g_signal_connect(G_OBJECT(title_encoding_enabled), "clicked", |
444 G_CALLBACK(title_encoding_enabled_cb), NULL); | |
445 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_enabled, FALSE, | |
446 FALSE, 0); | |
447 | |
448 title_encoding_hbox = gtk_hbox_new(FALSE, 5); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
449 gtk_widget_set_sensitive(title_encoding_hbox, mpgdec_cfg.title_encoding_enabled); |
61 | 450 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_encoding_hbox, FALSE, |
451 FALSE, 0); | |
452 | |
453 title_encoding_label = gtk_label_new(_("ID3 encoding:")); | |
454 gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding_label, FALSE, | |
455 FALSE, 0); | |
456 | |
457 title_encoding = gtk_entry_new(); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
458 gtk_entry_set_text(GTK_ENTRY(title_encoding), mpgdec_cfg.title_encoding); |
61 | 459 gtk_box_pack_start(GTK_BOX(title_encoding_hbox), title_encoding, TRUE, TRUE, |
460 0); | |
461 /* Encoding patch */ | |
462 | |
463 | |
464 title_override = | |
465 gtk_check_button_new_with_label(_("Override generic titles")); | |
466 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_override), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
467 mpgdec_cfg.title_override); |
61 | 468 g_signal_connect(G_OBJECT(title_override), "clicked", |
469 G_CALLBACK(title_override_cb), NULL); | |
470 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_override, FALSE, | |
471 FALSE, 0); | |
472 | |
473 title_id3_box = gtk_hbox_new(FALSE, 5); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
474 gtk_widget_set_sensitive(title_id3_box, mpgdec_cfg.title_override); |
61 | 475 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_id3_box, FALSE, |
476 FALSE, 0); | |
477 | |
478 title_id3_label = gtk_label_new(_("ID3 format:")); | |
479 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_label, FALSE, | |
480 FALSE, 0); | |
481 | |
482 title_id3_entry = gtk_entry_new(); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
483 gtk_entry_set_text(GTK_ENTRY(title_id3_entry), mpgdec_cfg.id3_format); |
61 | 484 gtk_box_pack_start(GTK_BOX(title_id3_box), title_id3_entry, TRUE, TRUE, |
485 0); | |
486 | |
487 title_tag_desc = xmms_titlestring_descriptions("pafFetnygc", 2); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
488 gtk_widget_set_sensitive(title_tag_desc, mpgdec_cfg.title_override); |
61 | 489 gtk_box_pack_start(GTK_BOX(title_id3_vbox), title_tag_desc, FALSE, |
490 FALSE, 0); | |
491 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, | |
492 gtk_label_new(_("Title"))); | |
493 | |
494 bbox = gtk_hbutton_box_new(); | |
495 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
496 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
497 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
498 | |
499 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
500 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
501 G_CALLBACK(gtk_widget_destroy), | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
502 GTK_OBJECT(mpgdec_configurewin)); |
61 | 503 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); |
504 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
505 | |
506 | |
507 ok = gtk_button_new_from_stock(GTK_STOCK_OK); | |
508 g_signal_connect(G_OBJECT(ok), "clicked", | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
509 G_CALLBACK(mpgdec_configurewin_ok), NULL); |
61 | 510 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); |
511 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); | |
512 gtk_widget_grab_default(ok); | |
513 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1071
diff
changeset
|
514 gtk_widget_show_all(mpgdec_configurewin); |
61 | 515 } |