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); }
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 osx_init(void) { left_volume = 1.0; right_volume = 1.0; #if 0 ConfigFile *cfgfile; memset(&osx_cfg, 0, sizeof (OSXConfig)); osx_cfg.audio_device = 0; osx_cfg.mixer_device = 0; osx_cfg.buffer_size = 3000; osx_cfg.prebuffer = 25; osx_cfg.use_alt_audio_device = FALSE; osx_cfg.alt_audio_device = NULL; osx_cfg.use_master=0; if ((cfgfile = xmms_cfg_open_default_file())) { xmms_cfg_read_int(cfgfile, "OSX", "audio_device", &osx_cfg.audio_device); xmms_cfg_read_int(cfgfile, "OSX", "mixer_device", &osx_cfg.mixer_device); xmms_cfg_read_int(cfgfile, "OSX", "buffer_size", &osx_cfg.buffer_size); xmms_cfg_read_int(cfgfile, "OSX", "prebuffer", &osx_cfg.prebuffer); xmms_cfg_read_boolean(cfgfile, "OSX", "use_master", &osx_cfg.use_master); xmms_cfg_read_boolean(cfgfile, "OSX", "use_alt_audio_device", &osx_cfg.use_alt_audio_device); xmms_cfg_read_string(cfgfile, "OSX", "alt_audio_device", &osx_cfg.alt_audio_device); xmms_cfg_read_boolean(cfgfile, "OSX", "use_alt_mixer_device", &osx_cfg.use_alt_mixer_device); xmms_cfg_read_string(cfgfile, "OSX", "alt_mixer_device", &osx_cfg.alt_mixer_device); xmms_cfg_free(cfgfile); } #endif }
static void read_config(void) { ConfigFile *cfgfile; g_free(cmd_line); g_free(cmd_line_after); g_free(cmd_line_end); cmd_line = NULL; cmd_line_after = NULL; cmd_line_end = NULL; if ((cfgfile = xmms_cfg_open_default_file()) != NULL) { xmms_cfg_read_string(cfgfile, "song_change", "cmd_line", &cmd_line); xmms_cfg_read_string(cfgfile, "song_change", "cmd_line_after", &cmd_line_after); xmms_cfg_read_string(cfgfile, "song_change", "cmd_line_end", &cmd_line_end); xmms_cfg_free(cfgfile); } if (!cmd_line) cmd_line = g_strdup(""); if (!cmd_line_after) cmd_line_after = g_strdup(""); if (!cmd_line_end) cmd_line_end = g_strdup(""); }
static void op_init (void) { ConfigFile *cfgfile; cfgfile = xmms_cfg_open_default_file(); xmms_cfg_read_string(cfgfile, "sndio", "audiodev", &audiodev); xmms_cfg_free(cfgfile); if (!audiodev) audiodev = g_strdup(""); }
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); }
static void wv_load_config() { ConfigFile *cfg; cfg = xmms_cfg_open_default_file(); xmms_cfg_read_boolean(cfg, "wavpack", "clip_prevention", &clipPreventionEnabled); xmms_cfg_read_boolean(cfg, "wavpack", "album_replaygain", &albumReplaygainEnabled); xmms_cfg_read_boolean(cfg, "wavpack", "dyn_bitrate", &dynBitrateEnabled); xmms_cfg_read_boolean(cfg, "wavpack", "replaygain", &replaygainEnabled); xmms_cfg_free(cfg); openedAudio = false; }
/* ---------------------------------------------------------------------- */ void joyapp_read_buttoncmd(void) { ConfigFile *cfile; gchar *button; int i; cfile = xmms_cfg_open_default_file(); for (i = 0; i < joy_cfg.num_buttons; i++) { joy_cfg.button_cmd[i] = 13; button = g_strdup_printf("button%d", i+1); xmms_cfg_read_int (cfile, "joystick", button, &joy_cfg.button_cmd[i]); g_free(button); } xmms_cfg_free (cfile); }
static void playerout_init(void) { ConfigFile *cfgfile; cfgfile = xmms_cfg_open_default_file(); if (cfgfile) { xmms_cfg_read_string(cfgfile, "playerout", "server_address", &server_address); xmms_cfg_read_int(cfgfile, "playerout", "server_port", &server_port); xmms_cfg_read_int(cfgfile, "playerout", "server_index", &server_index); xmms_cfg_read_int (cfgfile, "playerout", "buffer_time", &bufferTime); xmms_cfg_free(cfgfile); } if (!server_address) server_address = g_strdup ("localhost"); }
/* * Read configuration and initialize variables. */ static void read_config (void) { ConfigFile *cfgfile; show_volume = 1; show_balance = 1; show_pause = 1; show_trackname = 1; show_stop = 1; show_repeat = 1; show_shuffle = 1; g_free (colour); g_free (font); colour = NULL; font = NULL; timeout = 3; offset = 50; shadow_offset = 1; pos = XOSD_bottom; DEBUG("read config"); if ((cfgfile = xmms_cfg_open_default_file ()) != NULL) { xmms_cfg_read_string (cfgfile, "osd", "font", &font); xmms_cfg_read_string (cfgfile, "osd", "colour", &colour); xmms_cfg_read_int (cfgfile, "osd", "timeout", &timeout); xmms_cfg_read_int (cfgfile, "osd", "offset", &offset); xmms_cfg_read_int (cfgfile, "osd", "pos", &pos); xmms_cfg_read_int (cfgfile, "osd", "shadow_offset", &shadow_offset); xmms_cfg_read_int (cfgfile, "osd", "show_volume", &show_volume ); xmms_cfg_read_int (cfgfile, "osd", "show_balance", &show_balance ); xmms_cfg_read_int (cfgfile, "osd", "show_pause", &show_pause ); xmms_cfg_read_int (cfgfile, "osd", "show_trackname", &show_trackname ); xmms_cfg_read_int (cfgfile, "osd", "show_stop", &show_stop ); xmms_cfg_read_int (cfgfile, "osd", "show_repeat", &show_repeat ); xmms_cfg_read_int (cfgfile, "osd", "show_shuffle", &show_shuffle ); xmms_cfg_free(cfgfile); } if (font == NULL) font = g_strdup ("fixed"); if (colour == NULL) colour = g_strdup ("green"); }
/* ---------------------------------------------------------------------- */ 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(); }
/* ---------------------------------------------------------------------- */ void joyapp_read_config(void) { ConfigFile *cfile; joy_cfg.device_1 = g_strdup("/dev/js0"); joy_cfg.device_2 = g_strdup("/dev/js1"); cfile = xmms_cfg_open_default_file(); xmms_cfg_read_string(cfile, "joystick", "device1", &joy_cfg.device_1); xmms_cfg_read_string(cfile, "joystick", "device2", &joy_cfg.device_2); xmms_cfg_read_int(cfile, "joystick", "sensitivity", &joy_cfg.sens); xmms_cfg_read_int(cfile, "joystick", "up", &joy_cfg.up); xmms_cfg_read_int(cfile, "joystick", "down", &joy_cfg.down); xmms_cfg_read_int(cfile, "joystick", "left", &joy_cfg.left); xmms_cfg_read_int(cfile, "joystick", "right", &joy_cfg.right); xmms_cfg_read_int(cfile, "joystick", "alt_up", &joy_cfg.alt_up); xmms_cfg_read_int(cfile, "joystick", "alt_down", &joy_cfg.alt_down); xmms_cfg_read_int(cfile, "joystick", "alt_left", &joy_cfg.alt_left); xmms_cfg_read_int(cfile, "joystick", "alt_right", &joy_cfg.alt_right); xmms_cfg_free(cfile); }
static void cdda_init(void) { ConfigFile *cfgfile; struct driveinfo *drive = g_malloc0(sizeof(struct driveinfo)); int ndrives = 1, i; cdda_playing.fd = -1; memset(&cdda_cfg, 0, sizeof(CDDAConfig)); #ifdef HAVE_OSS drive->mixer = CDDA_MIXER_OSS; drive->oss_mixer = SOUND_MIXER_CD; #endif cfgfile = xmms_cfg_open_default_file(); /* These names are used for backwards compatibility */ xmms_cfg_read_string(cfgfile, "CDDA", "device", &drive->device); xmms_cfg_read_string(cfgfile, "CDDA", "directory", &drive->directory); xmms_cfg_read_int(cfgfile, "CDDA", "mixer", &drive->mixer); xmms_cfg_read_int(cfgfile, "CDDA", "readmode", &drive->dae); if (!drive->device) drive->device = g_strdup(CDDA_DEVICE); if (!drive->directory) drive->directory = g_strdup(CDDA_DIRECTORY); cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive); xmms_cfg_read_int(cfgfile, "CDDA", "num_drives", &ndrives); for (i = 1; i < ndrives; i++) { char label[20]; drive = g_malloc0(sizeof(struct driveinfo)); sprintf(label, "device%d", i); xmms_cfg_read_string(cfgfile, "CDDA", label, &drive->device); sprintf(label, "directory%d", i); xmms_cfg_read_string(cfgfile, "CDDA", label, &drive->directory); sprintf(label, "mixer%d", i); xmms_cfg_read_int(cfgfile, "CDDA", label, &drive->mixer); sprintf(label, "readmode%d", i); xmms_cfg_read_int(cfgfile, "CDDA", label, &drive->dae); cdda_cfg.drives = g_list_append(cdda_cfg.drives, drive); } xmms_cfg_read_boolean(cfgfile, "CDDA", "title_override", &cdda_cfg.title_override); xmms_cfg_read_string(cfgfile, "CDDA", "name_format", &cdda_cfg.name_format); xmms_cfg_read_boolean(cfgfile, "CDDA", "use_cddb", &cdda_cfg.use_cddb); xmms_cfg_read_string(cfgfile, "CDDA", "cddb_server", &cdda_cfg.cddb_server); #ifdef WITH_CDINDEX xmms_cfg_read_boolean(cfgfile, "CDDA", "use_cdin", &cdda_cfg.use_cdin); #else cdda_cfg.use_cdin = FALSE; #endif xmms_cfg_read_string(cfgfile, "CDDA", "cdin_server", &cdda_cfg.cdin_server); xmms_cfg_free(cfgfile); if (!cdda_cfg.cdin_server) cdda_cfg.cdin_server = g_strdup("www.cdindex.org"); if (!cdda_cfg.cddb_server) cdda_cfg.cddb_server = g_strdup(CDDB_DEFAULT_SERVER); if (!cdda_cfg.name_format) cdda_cfg.name_format = g_strdup("%p - %t"); }
/* * 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); }
void FLAC_XMMS__init(void) { ConfigFile *cfg; FLAC__uint32 test = 1; is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; flac_cfg.title.tag_override = FALSE; if (flac_cfg.title.tag_format) g_free(flac_cfg.title.tag_format); flac_cfg.title.convert_char_set = FALSE; cfg = xmms_cfg_open_default_file(); /* title */ xmms_cfg_read_boolean(cfg, "flac", "title.tag_override", &flac_cfg.title.tag_override); if(!xmms_cfg_read_string(cfg, "flac", "title.tag_format", &flac_cfg.title.tag_format)) flac_cfg.title.tag_format = g_strdup("%p - %t"); xmms_cfg_read_boolean(cfg, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); if(!xmms_cfg_read_string(cfg, "flac", "title.user_char_set", &flac_cfg.title.user_char_set)) flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current(); /* replaygain */ xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable); xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode); if(!xmms_cfg_read_int(cfg, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp)) flac_cfg.output.replaygain.preamp = 0; xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit); xmms_cfg_read_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16); xmms_cfg_read_boolean(cfg, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither); if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping)) flac_cfg.output.resolution.replaygain.noise_shaping = 1; if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out)) flac_cfg.output.resolution.replaygain.bps_out = 16; /* stream */ xmms_cfg_read_int(cfg, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size); xmms_cfg_read_int(cfg, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer); xmms_cfg_read_boolean(cfg, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy); if(flac_cfg.stream.proxy_host) g_free(flac_cfg.stream.proxy_host); if(!xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host)) flac_cfg.stream.proxy_host = g_strdup(""); xmms_cfg_read_int(cfg, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port); xmms_cfg_read_boolean(cfg, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth); if(flac_cfg.stream.proxy_user) g_free(flac_cfg.stream.proxy_user); flac_cfg.stream.proxy_user = NULL; xmms_cfg_read_string(cfg, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user); if(flac_cfg.stream.proxy_pass) g_free(flac_cfg.stream.proxy_pass); flac_cfg.stream.proxy_pass = NULL; xmms_cfg_read_string(cfg, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass); xmms_cfg_read_boolean(cfg, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream); if (flac_cfg.stream.save_http_path) g_free (flac_cfg.stream.save_http_path); if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || ! *flac_cfg.stream.save_http_path) { if (flac_cfg.stream.save_http_path) g_free (flac_cfg.stream.save_http_path); flac_cfg.stream.save_http_path = homedir(); } xmms_cfg_read_boolean(cfg, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming); xmms_cfg_read_boolean(cfg, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel); decoder_ = FLAC__stream_decoder_new(); xmms_cfg_free(cfg); }
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); }
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); }