static void save_and_close(GtkWidget *w, gpointer data) { char *cmd, *cmd_after, *cmd_end; ConfigFile *cfgfile = xmms_cfg_open_default_file(); cmd = gtk_entry_get_text(GTK_ENTRY(cmd_entry)); cmd_after = gtk_entry_get_text(GTK_ENTRY(cmd_after_entry)); cmd_end = gtk_entry_get_text(GTK_ENTRY(cmd_end_entry)); xmms_cfg_write_string(cfgfile, "song_change", "cmd_line", cmd); xmms_cfg_write_string(cfgfile, "song_change", "cmd_line_after", cmd_after); xmms_cfg_write_string(cfgfile, "song_change", "cmd_line_end", cmd_end); xmms_cfg_write_default_file(cfgfile); xmms_cfg_free(cfgfile); if (timeout_tag) { g_free(cmd_line); cmd_line = g_strdup(cmd); g_free(cmd_line_after); cmd_line_after = g_strdup(cmd_after); g_free(cmd_line_end); cmd_line_end = g_strdup(cmd_end); } gtk_widget_destroy(configure_win); }
void xmms_cfg_write_boolean(ConfigFile * cfg, gchar * section, gchar * key, gboolean value) { g_return_if_fail(cfg != NULL); g_return_if_fail(section != NULL); g_return_if_fail(key != NULL); if (value) xmms_cfg_write_string(cfg, section, key, "TRUE"); else xmms_cfg_write_string(cfg, section, key, "FALSE"); }
static void configure_ok_cb(gpointer data) { ConfigFile *cfgfile; if (server_address) g_free(server_address); server_address = g_strdup(gtk_entry_get_text(GTK_ENTRY(server_address_entry))); server_port = atoi (gtk_entry_get_text (GTK_ENTRY (server_port_entry))); server_index = atoi (gtk_entry_get_text( GTK_ENTRY (server_index_entry))); bufferTime = atoi (gtk_entry_get_text (GTK_ENTRY (buffer_entry))); cfgfile = xmms_cfg_open_default_file(); if (!cfgfile) cfgfile = xmms_cfg_new(); xmms_cfg_write_string(cfgfile, "playerout", "server_address", server_address); xmms_cfg_write_int(cfgfile, "playerout", "server_port", server_port); xmms_cfg_write_int(cfgfile, "playerout", "server_index", server_index); xmms_cfg_write_int (cfgfile, "playerout", "buffer_time", bufferTime); xmms_cfg_free(cfgfile); gtk_widget_destroy(configure_win); }
void cdda_cdinfo_write_file(guint32 cddb_discid, cdinfo_t *cdinfo) { /* * We currently identify cdinfo on disk with the CDDB-discid. * Maybe it would be smarter to use the cdindex id instead? */ char *filename; ConfigFile *cfg; char sectionname[10], trackstr[16]; int i, numtracks = CLAMP(cddb_discid & 0xff, 0, 99); sprintf(sectionname, "%08x", cddb_discid); filename = g_strconcat(g_get_home_dir(), "/.xmms/cdinfo", NULL); if ((cfg = xmms_cfg_open_file(filename)) == NULL) cfg = xmms_cfg_new(); if (cdinfo->albname) xmms_cfg_write_string(cfg, sectionname, "Albumname", cdinfo->albname); else xmms_cfg_write_string(cfg, sectionname, "Albumname", ""); if (cdinfo->artname) xmms_cfg_write_string(cfg, sectionname, "Artistname", cdinfo->artname); for (i = 1; i <= numtracks; i++) { if (cdinfo->tracks[i].artist) { sprintf(trackstr, "track_artist%d", i); xmms_cfg_write_string(cfg, sectionname, trackstr, cdinfo->tracks[i].artist); } if (cdinfo->tracks[i].title) { sprintf(trackstr, "track_title%d", i); xmms_cfg_write_string(cfg, sectionname, trackstr, cdinfo->tracks[i].title); } } if (!xmms_cfg_write_file(cfg, filename)) /*FIXME */; xmms_cfg_free(cfg); g_free(filename); }
void xmms_cfg_write_int(ConfigFile * cfg, gchar * section, gchar * key, gint value) { char *strvalue; g_return_if_fail(cfg != NULL); g_return_if_fail(section != NULL); g_return_if_fail(key != NULL); strvalue = g_strdup_printf("%d", value); xmms_cfg_write_string(cfg, section, key, strvalue); g_free(strvalue); }
/* ---------------------------------------------------------------------- */ void joyapp_save_config(void) { ConfigFile *cfile; cfile = xmms_cfg_open_default_file(); xmms_cfg_write_string(cfile, "joystick", "device1", joy_cfg.device_1); xmms_cfg_write_string(cfile, "joystick", "device2", joy_cfg.device_2); xmms_cfg_write_int(cfile, "joystick", "sensitivity", joy_cfg.sens); xmms_cfg_write_int(cfile, "joystick", "up", joy_cfg.up); xmms_cfg_write_int(cfile, "joystick", "down", joy_cfg.down); xmms_cfg_write_int(cfile, "joystick", "left", joy_cfg.left); xmms_cfg_write_int(cfile, "joystick", "right", joy_cfg.right); xmms_cfg_write_int(cfile, "joystick", "alt_up", joy_cfg.alt_up); xmms_cfg_write_int(cfile, "joystick", "alt_down", joy_cfg.alt_down); xmms_cfg_write_int(cfile, "joystick", "alt_left", joy_cfg.alt_left); xmms_cfg_write_int(cfile, "joystick", "alt_right", joy_cfg.alt_right); xmms_cfg_write_default_file(cfile); xmms_cfg_free(cfile); joyapp_save_buttoncmd(); }
static void configure_win_ok_cb(GtkWidget *w, gpointer data) { ConfigFile *cfgfile; strlcpy(audiodev, gtk_entry_get_text(GTK_ENTRY(adevice_entry)), PATH_MAX); cfgfile = xmms_cfg_open_default_file(); xmms_cfg_write_string(cfgfile, "sndio", "audiodev", audiodev); xmms_cfg_write_default_file(cfgfile); xmms_cfg_free(cfgfile); gtk_widget_destroy(configure_win); }
void xmms_cfg_write_double(ConfigFile * cfg, gchar * section, gchar * key, gdouble value) { char *strvalue, *locale; g_return_if_fail(cfg != NULL); g_return_if_fail(section != NULL); g_return_if_fail(key != NULL); locale = g_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "C"); strvalue = g_strdup_printf("%g", value); setlocale(LC_NUMERIC, locale); xmms_cfg_write_string(cfg, section, key, strvalue); g_free(locale); g_free(strvalue); }
/* Save current settings to the xmms config file */ void irapp_save_config(void) { ConfigFile *cfgfile; gchar *filename, buttontext[20]; gint i; filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL); cfgfile = xmms_cfg_open_file(filename); if (!cfgfile) cfgfile = xmms_cfg_new(); xmms_cfg_write_string(cfgfile, "irman", "device", ircfg.device); xmms_cfg_write_int(cfgfile, "irman", "codelen", ircfg.codelen); for (i = 0; i < 10; i++) { sprintf(buttontext, "button%d", i); xmms_cfg_write_string(cfgfile, "irman", buttontext, ircfg.button[i]); sprintf(buttontext, "playlist%d", i); xmms_cfg_write_string(cfgfile, "irman", buttontext, ircfg.playlist[i]); } for (i = 10; i < 100; i++) { sprintf(buttontext, "playlist%d", i); xmms_cfg_write_string(cfgfile, "irman", buttontext, ircfg.playlist[i]); } xmms_cfg_write_string(cfgfile, "irman", "button_play", ircfg.button_play); xmms_cfg_write_string(cfgfile, "irman", "button_stop", ircfg.button_stop); xmms_cfg_write_string(cfgfile, "irman", "button_next", ircfg.button_next); xmms_cfg_write_string(cfgfile, "irman", "button_prev", ircfg.button_prev); xmms_cfg_write_string(cfgfile, "irman", "button_pause", ircfg.button_pause); xmms_cfg_write_string(cfgfile, "irman", "button_seekf", ircfg.button_seekf); xmms_cfg_write_string(cfgfile, "irman", "button_seekb", ircfg.button_seekb); xmms_cfg_write_string(cfgfile, "irman", "button_volup", ircfg.button_volup); xmms_cfg_write_string(cfgfile, "irman", "button_voldown", ircfg.button_voldown); xmms_cfg_write_string(cfgfile, "irman", "button_shuffle", ircfg.button_shuffle); xmms_cfg_write_string(cfgfile, "irman", "button_repeat", ircfg.button_repeat); xmms_cfg_write_string(cfgfile, "irman", "button_playlist", ircfg.button_playlist); xmms_cfg_write_string(cfgfile, "irman", "button_plus100", ircfg.button_plus100); xmms_cfg_write_file(cfgfile, filename); xmms_cfg_free(cfgfile); g_free(filename); }
static void flac_configurewin_ok(GtkWidget * widget, gpointer data) { ConfigFile *cfg; gchar *filename; (void)widget, (void)data; /* unused arguments */ g_free(flac_cfg.title.tag_format); flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry))); flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry)); filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL); cfg = xmms_cfg_open_file(filename); if (!cfg) cfg = xmms_cfg_new(); /* title */ xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override); xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format); xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set); xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set); /* output */ xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable); xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode); xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp); xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit); xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16); xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither); xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping); xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out); /* streaming */ flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); g_free(flac_cfg.stream.proxy_host); flac_cfg.stream.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry))); flac_cfg.stream.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry))); flac_cfg.stream.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); if(flac_cfg.stream.proxy_user) g_free(flac_cfg.stream.proxy_user); flac_cfg.stream.proxy_user = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0) flac_cfg.stream.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))); if(flac_cfg.stream.proxy_pass) g_free(flac_cfg.stream.proxy_pass); flac_cfg.stream.proxy_pass = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0) flac_cfg.stream.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))); flac_cfg.stream.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); if (flac_cfg.stream.save_http_path) g_free(flac_cfg.stream.save_http_path); flac_cfg.stream.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); #ifdef FLAC_ICECAST flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title)); flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); #endif xmms_cfg_write_int(cfg, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size); xmms_cfg_write_int(cfg, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer); xmms_cfg_write_boolean(cfg, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy); xmms_cfg_write_string(cfg, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host); xmms_cfg_write_int(cfg, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port); xmms_cfg_write_boolean(cfg, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth); if(flac_cfg.stream.proxy_user) xmms_cfg_write_string(cfg, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user); else xmms_cfg_remove_key(cfg, "flac", "stream.proxy_user"); if(flac_cfg.stream.proxy_pass) xmms_cfg_write_string(cfg, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass); else xmms_cfg_remove_key(cfg, "flac", "stream.proxy_pass"); xmms_cfg_write_boolean(cfg, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream); xmms_cfg_write_string(cfg, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path); #ifdef FLAC_ICECAST xmms_cfg_write_boolean(cfg, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming); xmms_cfg_write_boolean(cfg, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel); #endif xmms_cfg_write_file(cfg, filename); xmms_cfg_free(cfg); g_free(filename); gtk_widget_destroy(flac_configurewin); }
static void vorbis_configurewin_ok(GtkWidget * widget, gpointer data) { ConfigFile *cfg; GtkToggleButton *tb; vorbis_cfg.http_buffer_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(streaming_size_spin)); vorbis_cfg.http_prebuffer = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(streaming_pre_spin)); vorbis_cfg.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); g_free(vorbis_cfg.proxy_host); vorbis_cfg.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry))); vorbis_cfg.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry))); vorbis_cfg.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); g_free(vorbis_cfg.proxy_user); vorbis_cfg.proxy_user = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0) vorbis_cfg.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))); g_free(vorbis_cfg.proxy_pass); vorbis_cfg.proxy_pass = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0) vorbis_cfg.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))); vorbis_cfg.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); g_free(vorbis_cfg.save_http_path); vorbis_cfg.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); g_free(vorbis_cfg.tag_format); vorbis_cfg.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry))); tb = GTK_TOGGLE_BUTTON(title_tag_override); vorbis_cfg.tag_override = gtk_toggle_button_get_active(tb); tb = GTK_TOGGLE_BUTTON(rg_switch); vorbis_cfg.use_replaygain = gtk_toggle_button_get_active(tb); tb = GTK_TOGGLE_BUTTON(rg_clip_switch); vorbis_cfg.use_anticlip = gtk_toggle_button_get_active(tb); tb = GTK_TOGGLE_BUTTON(rg_booster_switch); vorbis_cfg.use_booster = gtk_toggle_button_get_active(tb); tb = GTK_TOGGLE_BUTTON(rg_track_gain); if (gtk_toggle_button_get_active(tb)) vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_TRACK; else vorbis_cfg.replaygain_mode = REPLAYGAIN_MODE_ALBUM; cfg = xmms_cfg_open_default_file(); xmms_cfg_write_int(cfg, "vorbis", "http_buffer_size", vorbis_cfg.http_buffer_size); xmms_cfg_write_int(cfg, "vorbis", "http_prebuffer", vorbis_cfg.http_prebuffer); xmms_cfg_write_boolean(cfg, "vorbis", "use_proxy", vorbis_cfg.use_proxy); xmms_cfg_write_string(cfg, "vorbis", "proxy_host", vorbis_cfg.proxy_host); xmms_cfg_write_boolean(cfg, "vorbis", "save_http_stream", vorbis_cfg.save_http_stream); xmms_cfg_write_string(cfg, "vorbis", "save_http_path", vorbis_cfg.save_http_path); xmms_cfg_write_boolean(cfg, "vorbis", "tag_override", vorbis_cfg.tag_override); xmms_cfg_write_string(cfg, "vorbis", "tag_format", vorbis_cfg.tag_format); xmms_cfg_write_int(cfg, "vorbis", "proxy_port", vorbis_cfg.proxy_port); xmms_cfg_write_boolean(cfg, "vorbis", "proxy_use_auth", vorbis_cfg.proxy_use_auth); if (vorbis_cfg.proxy_user) xmms_cfg_write_string(cfg, "vorbis", "proxy_user", vorbis_cfg.proxy_user); else xmms_cfg_remove_key(cfg, "vorbis", "proxy_user"); if (vorbis_cfg.proxy_pass) xmms_cfg_write_string(cfg, "vorbis", "proxy_pass", vorbis_cfg.proxy_pass); else xmms_cfg_remove_key(cfg, "vorbis", "proxy_pass"); xmms_cfg_write_boolean(cfg, "vorbis", "use_anticlip", vorbis_cfg.use_anticlip); xmms_cfg_write_boolean(cfg, "vorbis", "use_replaygain", vorbis_cfg.use_replaygain); xmms_cfg_write_int(cfg, "vorbis", "replaygain_mode", vorbis_cfg.replaygain_mode); xmms_cfg_write_boolean(cfg, "vorbis", "use_booster", vorbis_cfg.use_booster); xmms_cfg_write_default_file(cfg); xmms_cfg_free(cfg); gtk_widget_destroy(vorbis_configurewin); }
/* * Apply changed from configuration dialog. */ static void configure_apply_cb (gpointer data) { ConfigFile *cfgfile; show_volume=isactive(vol_on); show_balance=isactive(bal_on); show_pause=isactive(pause_on); show_trackname=isactive(trackname_on); show_stop=isactive(stop_on); show_repeat=isactive(repeat_on); show_shuffle=isactive(shuffle_on); if (colour) g_free (colour); if (font) g_free (font); colour = g_strdup (gtk_entry_get_text (GTK_ENTRY (colour_entry))); font = g_strdup (gtk_entry_get_text (GTK_ENTRY (font_entry))); timeout = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (timeout_spin)); offset = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (offset_spin)); shadow_offset = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (shadow_spin)); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pos_top))) pos = XOSD_top; else pos = XOSD_bottom; if (osd) { xosd_set_colour (osd, colour); if (xosd_set_font (osd, font) == -1) { DEBUG("invalid font"); DEBUG(font); } xosd_set_timeout (osd, timeout); xosd_set_offset (osd, offset); xosd_set_shadow_offset (osd, shadow_offset); xosd_set_pos (osd, pos); } cfgfile = xmms_cfg_open_default_file(); xmms_cfg_write_string(cfgfile, "osd", "colour", colour); xmms_cfg_write_string(cfgfile, "osd", "font", font); xmms_cfg_write_int(cfgfile, "osd", "timeout", timeout); xmms_cfg_write_int(cfgfile, "osd", "offset", offset); xmms_cfg_write_int(cfgfile, "osd", "shadow_offset", shadow_offset); xmms_cfg_write_int(cfgfile, "osd", "pos", pos); xmms_cfg_write_int (cfgfile, "osd", "show_volume", show_volume ); xmms_cfg_write_int (cfgfile, "osd", "show_balance", show_balance ); xmms_cfg_write_int (cfgfile, "osd", "show_pause", show_pause ); xmms_cfg_write_int (cfgfile, "osd", "show_trackname", show_trackname ); xmms_cfg_write_int (cfgfile, "osd", "show_stop", show_stop ); xmms_cfg_write_int (cfgfile, "osd", "show_repeat", show_repeat ); xmms_cfg_write_int (cfgfile, "osd", "show_shuffle", show_shuffle ); xmms_cfg_write_default_file(cfgfile); xmms_cfg_free(cfgfile); }
static void mpg123_configurewin_ok(GtkWidget * widget, gpointer data) { ConfigFile *cfg; gchar *filename; if (GTK_TOGGLE_BUTTON(decode_res_16)->active) mpg123_cfg.resolution = 16; else if (GTK_TOGGLE_BUTTON(decode_res_8)->active) mpg123_cfg.resolution = 8; if (GTK_TOGGLE_BUTTON(decode_ch_stereo)->active) mpg123_cfg.channels = 2; else if (GTK_TOGGLE_BUTTON(decode_ch_mono)->active) mpg123_cfg.channels = 1; if (GTK_TOGGLE_BUTTON(decode_freq_1to1)->active) mpg123_cfg.downsample = 0; else if (GTK_TOGGLE_BUTTON(decode_freq_1to2)->active) mpg123_cfg.downsample = 1; if (GTK_TOGGLE_BUTTON(decode_freq_1to4)->active) mpg123_cfg.downsample = 2; if (GTK_TOGGLE_BUTTON(detect_by_content)->active) mpg123_cfg.detect_by = DETECT_CONTENT; else if (GTK_TOGGLE_BUTTON(detect_by_extension)->active) mpg123_cfg.detect_by = DETECT_EXTENSION; else if (GTK_TOGGLE_BUTTON(detect_by_both)->active) mpg123_cfg.detect_by = DETECT_BOTH; else mpg123_cfg.detect_by = DETECT_EXTENSION; #ifdef USE_SIMD if (GTK_TOGGLE_BUTTON(auto_select)->active) mpg123_cfg.default_synth = SYNTH_AUTO; else if (GTK_TOGGLE_BUTTON(decoder_fpu)->active) mpg123_cfg.default_synth = SYNTH_FPU; else if (GTK_TOGGLE_BUTTON(decoder_mmx)->active) mpg123_cfg.default_synth = SYNTH_MMX; else mpg123_cfg.default_synth = SYNTH_3DNOW; #endif mpg123_cfg.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; mpg123_cfg.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; mpg123_cfg.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); g_free(mpg123_cfg.proxy_host); mpg123_cfg.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry))); mpg123_cfg.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry))); mpg123_cfg.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); if(mpg123_cfg.proxy_user) g_free(mpg123_cfg.proxy_user); mpg123_cfg.proxy_user = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0) mpg123_cfg.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))); if(mpg123_cfg.proxy_pass) g_free(mpg123_cfg.proxy_pass); mpg123_cfg.proxy_pass = NULL; if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0) mpg123_cfg.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))); mpg123_cfg.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); if (mpg123_cfg.save_http_path) g_free(mpg123_cfg.save_http_path); mpg123_cfg.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); mpg123_cfg.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title)); mpg123_cfg.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); mpg123_cfg.title_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_override)); mpg123_cfg.disable_id3v2 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_id3v2_disable)); g_free(mpg123_cfg.id3_format); mpg123_cfg.id3_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_id3_entry))); filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL); cfg = xmms_cfg_open_file(filename); if (!cfg) cfg = xmms_cfg_new(); xmms_cfg_write_int(cfg, "MPG123", "resolution", mpg123_cfg.resolution); xmms_cfg_write_int(cfg, "MPG123", "channels", mpg123_cfg.channels); xmms_cfg_write_int(cfg, "MPG123", "downsample", mpg123_cfg.downsample); xmms_cfg_write_int(cfg, "MPG123", "http_buffer_size", mpg123_cfg.http_buffer_size); xmms_cfg_write_int(cfg, "MPG123", "http_prebuffer", mpg123_cfg.http_prebuffer); xmms_cfg_write_boolean(cfg, "MPG123", "use_proxy", mpg123_cfg.use_proxy); xmms_cfg_write_string(cfg, "MPG123", "proxy_host", mpg123_cfg.proxy_host); xmms_cfg_write_int(cfg, "MPG123", "proxy_port", mpg123_cfg.proxy_port); xmms_cfg_write_boolean(cfg, "MPG123", "proxy_use_auth", mpg123_cfg.proxy_use_auth); if(mpg123_cfg.proxy_user) xmms_cfg_write_string(cfg, "MPG123", "proxy_user", mpg123_cfg.proxy_user); else xmms_cfg_remove_key(cfg, "MPG123", "proxy_user"); if(mpg123_cfg.proxy_pass) xmms_cfg_write_string(cfg, "MPG123", "proxy_pass", mpg123_cfg.proxy_pass); else xmms_cfg_remove_key(cfg, "MPG123", "proxy_pass"); xmms_cfg_write_boolean(cfg, "MPG123", "save_http_stream", mpg123_cfg.save_http_stream); xmms_cfg_write_string(cfg, "MPG123", "save_http_path", mpg123_cfg.save_http_path); xmms_cfg_write_boolean(cfg, "MPG123", "cast_title_streaming", mpg123_cfg.cast_title_streaming); xmms_cfg_write_boolean(cfg, "MPG123", "use_udp_channel", mpg123_cfg.use_udp_channel); xmms_cfg_write_boolean(cfg, "MPG123", "title_override", mpg123_cfg.title_override); xmms_cfg_write_boolean(cfg, "MPG123", "disable_id3v2", mpg123_cfg.disable_id3v2); xmms_cfg_write_string(cfg, "MPG123", "id3_format", mpg123_cfg.id3_format); xmms_cfg_write_int(cfg, "MPG123", "detect_by", mpg123_cfg.detect_by); #ifdef USE_SIMD xmms_cfg_write_int(cfg, "MPG123", "default_synth", mpg123_cfg.default_synth); #endif xmms_cfg_write_file(cfg, filename); xmms_cfg_free(cfg); g_free(filename); gtk_widget_destroy(mpg123_configurewin); }
static void cdda_configurewin_ok_cb(GtkWidget * w, gpointer data) { ConfigFile *cfgfile; struct driveinfo *drive; GList *node; int olddrives, ndrives, i; olddrives = g_list_length(cdda_cfg.drives); for (node = cdda_cfg.drives; node; node = node->next) { drive = node->data; g_free(drive->device); g_free(drive->directory); g_free(drive); } g_list_free(cdda_cfg.drives); cdda_cfg.drives = NULL; for (node = drives; node; node = node->next) { struct driveconfig *config = node->data; char *tmp; drive = g_malloc0(sizeof (*drive)); drive->device = g_strdup(gtk_entry_get_text(GTK_ENTRY(config->device))); tmp = gtk_entry_get_text(GTK_ENTRY(config->directory)); if (strlen(tmp) < 2 || tmp[strlen(tmp) - 1] == '/') drive->directory = g_strdup(tmp); else drive->directory = g_strconcat(tmp, "/", NULL); if (GET_TB(config->mixer_oss)) drive->mixer = CDDA_MIXER_OSS; else if (GET_TB(config->mixer_drive)) drive->mixer = CDDA_MIXER_DRIVE; else drive->mixer = CDDA_MIXER_NONE; if (GET_TB(config->dae)) drive->dae = CDDA_READ_DAE; else drive->dae = CDDA_READ_ANALOG; #ifdef HAVE_OSS drive->oss_mixer = SOUND_MIXER_CD; #endif cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive); } cdda_cfg.title_override = GET_TB(cdi_name_override); g_free(cdda_cfg.name_format); cdda_cfg.name_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(cdi_name))); cdda_cfg.use_cddb = GET_TB(cdi_use_cddb); cdda_cddb_set_server(gtk_entry_get_text(GTK_ENTRY(cdi_cddb_server))); #if 0 cdda_cfg.use_cdin = GET_TB(cdi_use_cdin); if (strcmp(cdda_cfg.cdin_server, gtk_entry_get_text(GTK_ENTRY(cdi_cdin_server)))) { g_free(cdda_cfg.cdin_server); cdda_cfg.cdin_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(cdi_cdin_server))); } #endif cfgfile = xmms_cfg_open_default_file(); drive = cdda_cfg.drives->data; xmms_cfg_write_string(cfgfile, "CDDA", "device", drive->device); xmms_cfg_write_string(cfgfile, "CDDA", "directory", drive->directory); xmms_cfg_write_int(cfgfile, "CDDA", "mixer", drive->mixer); xmms_cfg_write_int(cfgfile, "CDDA", "readmode", drive->dae); /* xmms_cfg_write_boolean(cfgfile, "CDDA", "use_oss_mixer", cdda_cfg.use_oss_mixer); */ for (node = cdda_cfg.drives->next, i = 1; node; node = node->next, i++) { char label[20]; drive = node->data; sprintf(label, "device%d", i); xmms_cfg_write_string(cfgfile, "CDDA", label, drive->device); sprintf(label, "directory%d", i); xmms_cfg_write_string(cfgfile, "CDDA", label, drive->directory); sprintf(label, "mixer%d", i); xmms_cfg_write_int(cfgfile, "CDDA", label, drive->mixer); sprintf(label, "readmode%d", i); xmms_cfg_write_int(cfgfile, "CDDA", label, drive->dae); } ndrives = g_list_length(cdda_cfg.drives); for (i = ndrives; i < olddrives; i++) /* FIXME: Clear old entries */; xmms_cfg_write_int(cfgfile, "CDDA", "num_drives", ndrives); xmms_cfg_write_boolean(cfgfile, "CDDA", "title_override", cdda_cfg.title_override); xmms_cfg_write_string(cfgfile, "CDDA", "name_format", cdda_cfg.name_format); xmms_cfg_write_boolean(cfgfile, "CDDA", "use_cddb", cdda_cfg.use_cddb); xmms_cfg_write_string(cfgfile, "CDDA", "cddb_server", cdda_cfg.cddb_server); xmms_cfg_write_int(cfgfile, "CDDA", "cddb_protocol_level", cdda_cfg.cddb_protocol_level); xmms_cfg_write_boolean(cfgfile, "CDDA", "use_cdin", cdda_cfg.use_cdin); xmms_cfg_write_string(cfgfile, "CDDA", "cdin_server", cdda_cfg.cdin_server); xmms_cfg_write_default_file(cfgfile); xmms_cfg_free(cfgfile); }