configure.c
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:39k
源码类别:

Windows CE

开发平台:

C/C++

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