47
49
gconf_client_set_string(client, "/apps/gnomeradio/mixer", settings.mixer, NULL);
48
50
gconf_client_set_string(client, "/apps/gnomeradio/mixer-device", settings.mixer_dev, NULL);
49
51
gconf_client_set_bool(client, "/apps/gnomeradio/mute-on-exit", settings.mute_on_exit, NULL);
50
//gconf_client_set_float(client, "/apps/gnomeradio/volume", volume->value, NULL);
52
/*gconf_client_set_float(client, "/apps/gnomeradio/volume", volume->value, NULL);*/
51
53
gconf_client_set_float(client, "/apps/gnomeradio/last-freq", adj->value/STEPS, NULL);
53
55
/* Store recording settings */
54
gconf_client_set_string(client, "/apps/gnomeradio/recording/audiodevice", rec_settings.audiodevice, NULL);
55
gconf_client_set_string(client, "/apps/gnomeradio/recording/destination", rec_settings.destination, NULL);
56
/* gconf_client_set_string(client, "/apps/gnomeradio/recording/audiodevice", rec_settings.audiodevice, NULL);
56
57
gconf_client_set_bool(client, "/apps/gnomeradio/recording/record-as-mp3", rec_settings.mp3, NULL);
57
58
gconf_client_set_string(client, "/apps/gnomeradio/recording/sample-rate", rec_settings.rate, NULL);
58
59
gconf_client_set_string(client, "/apps/gnomeradio/recording/sample-format", rec_settings.sample, NULL);
59
60
gconf_client_set_bool(client, "/apps/gnomeradio/recording/record-in-stereo", rec_settings.stereo, NULL);
60
61
gconf_client_set_string(client, "/apps/gnomeradio/recording/encoder", rec_settings.encoder, NULL);
61
62
gconf_client_set_string(client, "/apps/gnomeradio/recording/bitrate", rec_settings.bitrate, NULL);
65
gconf_client_set_string(client, "/apps/gnomeradio/recording/destination", rec_settings.destination, NULL);
66
gconf_client_set_string(client, "/apps/gnomeradio/recording/profile", rec_settings.profile, NULL);
63
68
/* Store the presets */
64
69
count = g_list_length(settings.presets);
134
136
rec_settings.encoder = g_strdup("oggenc");
135
137
rec_settings.bitrate = gconf_client_get_string(client, "/apps/gnomeradio/recording/bitrate", NULL);
136
138
if (!rec_settings.bitrate)
137
rec_settings.bitrate = g_strdup("192");
139
rec_settings.bitrate = g_strdup("192");*/
141
rec_settings.destination = gconf_client_get_string(client, "/apps/gnomeradio/recording/destination", NULL);
142
if (!rec_settings.destination)
143
rec_settings.destination = g_strdup(g_get_home_dir());
144
rec_settings.profile = gconf_client_get_string(client, "/apps/gnomeradio/recording/profile", NULL);
145
if (!rec_settings.profile)
146
rec_settings.profile = g_strdup("cdlossy");
139
148
/* Load the presets */
140
149
count = gconf_client_get_int(client, "/apps/gnomeradio/presets/presets", NULL);
141
150
for (i=0;i<count;i++)
144
152
ps = malloc(sizeof(preset));
145
153
buffer = g_strdup_printf("/apps/gnomeradio/presets/%d/name", i);
146
tmp = gconf_client_get_string(client, buffer, NULL);
149
ps->title = g_strdup(tmp);
154
ps->title = gconf_client_get_string(client, buffer, NULL);
157
ps->title = g_strdup(_("unnamed"));
151
158
buffer = g_strdup_printf("/apps/gnomeradio/presets/%d/freqency", i);
152
159
freq = gconf_client_get_float(client, buffer, NULL);
153
160
if ((freq < FREQ_MIN) || (freq > FREQ_MAX))
445
491
g_list_free(list);
448
GtkWidget* prefs_window(void)
494
GtkWidget* prefs_window(GtkWidget *app)
450
496
GtkWidget *dialog;
451
497
GtkWidget *box, *sbox, *pbox, *rbox;
452
498
GtkWidget *settings_box, *presets_box, *record_box;
453
499
GtkWidget *settings_label, *presets_label, *record_label;
454
500
GtkWidget *s_indent_label, *p_indent_label, *r_indent_label;
455
GtkWidget *encoder_label, *bitrate_label, *destination_label;
501
GtkWidget *destination_label;
456
502
GtkWidget *destination_button;
457
GtkWidget *encoder_combo, *bitrate_combo;
458
GtkWidget *mixer_eb, *encoder_eb, *bitrate_eb;
503
GtkWidget *profile_combo;
504
GtkWidget *mixer_eb, *profile_eb;
459
505
GtkWidget *preset_box;
460
506
GtkWidget *settings_table, *record_table;
461
507
GtkWidget *device_label, *mixer_label;
603
648
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), list_column);
604
649
g_signal_connect(GTK_OBJECT(cellrenderer), "edited", GTK_SIGNAL_FUNC(freq_cell_edited_cb), NULL);
606
button_box = gtk_vbox_new(FALSE, 15);
651
button_box = gtk_hbox_new(FALSE, 12);
608
653
add_button = gtk_button_new_from_stock(GTK_STOCK_ADD);
609
654
del_button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
611
gtk_box_pack_start(GTK_BOX(button_box), add_button, FALSE, FALSE, 0);
612
gtk_box_pack_start(GTK_BOX(button_box), del_button, FALSE, FALSE, 0);
656
gtk_box_pack_end(GTK_BOX(button_box), del_button, FALSE, FALSE, 0);
657
gtk_box_pack_end(GTK_BOX(button_box), add_button, FALSE, FALSE, 0);
614
659
gtk_box_pack_start(GTK_BOX(preset_box), scrolled_window, TRUE, TRUE, 0);
615
660
gtk_box_pack_start(GTK_BOX(preset_box), button_box, TRUE, TRUE, 0);
639
684
r_indent_label = gtk_label_new(" ");
640
685
gtk_box_pack_start(GTK_BOX(rbox), r_indent_label, FALSE, FALSE, 0);
642
bitrates = g_list_append(NULL, g_strdup("32"));
643
bitrates = g_list_append(bitrates, g_strdup("40"));
644
bitrates = g_list_append(bitrates, g_strdup("48"));
645
bitrates = g_list_append(bitrates, g_strdup("56"));
646
bitrates = g_list_append(bitrates, g_strdup("64"));
647
bitrates = g_list_append(bitrates, g_strdup("80"));
648
bitrates = g_list_append(bitrates, g_strdup("96"));
649
bitrates = g_list_append(bitrates, g_strdup("112"));
650
bitrates = g_list_append(bitrates, g_strdup("128"));
651
bitrates = g_list_append(bitrates, g_strdup("160"));
652
bitrates = g_list_append(bitrates, g_strdup("192"));
653
bitrates = g_list_append(bitrates, g_strdup("224"));
654
bitrates = g_list_append(bitrates, g_strdup("256"));
655
bitrates = g_list_append(bitrates, g_strdup("320"));
657
record_table = gtk_table_new(3, 2, FALSE);
687
record_table = gtk_table_new(2, 2, FALSE);
658
688
gtk_table_set_col_spacings(GTK_TABLE(record_table), 15);
659
689
gtk_table_set_row_spacings(GTK_TABLE(record_table), 5);
661
encoder_label = gtk_label_new(_("Encoder:"));
662
bitrate_label = gtk_label_new(_("Bitrate:"));
663
691
destination_label = gtk_label_new(_("Destination directory:"));
664
gtk_misc_set_alignment(GTK_MISC(encoder_label), 0.0f, 0.5f);
665
gtk_misc_set_alignment(GTK_MISC(bitrate_label), 0.0f, 0.5f);
666
692
gtk_misc_set_alignment(GTK_MISC(destination_label), 0.0f, 0.5f);
668
694
destination_button = gtk_button_new();
669
695
gtk_button_set_label(GTK_BUTTON(destination_button), rec_settings.destination);
671
encoder_eb = gtk_event_box_new();
672
encoder_combo = gtk_combo_box_new_text();
673
gtk_container_add(GTK_CONTAINER(encoder_eb), encoder_combo);
674
encoders = get_installed_encoders();
675
if (!encoders) rec_settings.mp3 = FALSE;
676
ptr = encoders = g_list_prepend(encoders, (gpointer)g_strdup(_("Wave file")));
677
for (i = 0, active = 0; ptr; ptr = g_list_next(ptr)) {
678
gtk_combo_box_append_text(GTK_COMBO_BOX(encoder_combo), ptr->data);
679
if (g_str_equal(ptr->data, rec_settings.encoder)) active = i;
683
if (!rec_settings.mp3) active = 0;
684
gtk_combo_box_set_active(GTK_COMBO_BOX(encoder_combo), active);
685
if (encoders) g_object_set_data_full(G_OBJECT(encoder_combo), "encoders", encoders, (GDestroyNotify)free_string_list);
687
bitrate_eb = gtk_event_box_new();
688
bitrate_combo = gtk_combo_box_new_text();
689
gtk_container_add(GTK_CONTAINER(bitrate_eb), bitrate_combo);
691
for (i = 0, active = 0; ptr; ptr = g_list_next(ptr)) {
692
gchar *buffer = g_strdup_printf(_("%s kb/s"), (gchar*)ptr->data);
693
gtk_combo_box_append_text(GTK_COMBO_BOX(bitrate_combo), buffer);
695
if (!strncmp(ptr->data, rec_settings.bitrate, strlen(rec_settings.bitrate))) active = i;
698
gtk_combo_box_set_active(GTK_COMBO_BOX(bitrate_combo), active);
699
g_object_set_data_full(G_OBJECT(bitrate_combo), "bitrates", bitrates, (GDestroyNotify)free_string_list);
701
gtk_widget_set_sensitive(bitrate_combo, rec_settings.mp3);
697
profile_eb = gtk_event_box_new();
698
profile_combo = gm_audio_profile_choose_new();
699
gtk_container_add(GTK_CONTAINER(profile_eb), profile_combo);
700
gm_audio_profile_choose_set_active(profile_combo, rec_settings.profile);
703
702
gtk_table_attach_defaults(GTK_TABLE(record_table), destination_label, 0, 1, 0, 1);
704
703
gtk_table_attach_defaults(GTK_TABLE(record_table), destination_button, 1, 2, 0, 1);
705
gtk_table_attach_defaults(GTK_TABLE(record_table), encoder_label, 0, 1, 1, 2);
706
gtk_table_attach_defaults(GTK_TABLE(record_table), encoder_eb, 1, 2, 1, 2);
707
gtk_table_attach_defaults(GTK_TABLE(record_table), bitrate_label, 0, 1, 2, 3);
708
gtk_table_attach_defaults(GTK_TABLE(record_table), bitrate_eb, 1, 2, 2, 3);
704
gtk_table_attach_defaults(GTK_TABLE(record_table), profile_eb, 0, 2, 1, 2);
710
706
g_signal_connect(GTK_OBJECT(destination_button), "clicked", GTK_SIGNAL_FUNC(destination_button_clicked_cb), NULL);
711
g_signal_connect(GTK_OBJECT(encoder_combo), "changed", GTK_SIGNAL_FUNC(encoder_combo_change_cb), (gpointer)bitrate_combo);
712
g_signal_connect(GTK_OBJECT(bitrate_combo), "changed", GTK_SIGNAL_FUNC(bitrate_combo_change_cb), NULL);
707
g_signal_connect(GTK_OBJECT(profile_combo), "changed", GTK_SIGNAL_FUNC(profile_combo_change_cb), NULL);
714
gtk_tooltips_set_tip(tooltips, encoder_eb, _("Choose the mp3-/ogg-encoder that should be used, or to record as a uncompressed wave file"), NULL);
715
gtk_tooltips_set_tip(tooltips, bitrate_eb, _("Choose the bitrate in which the mp3/ogg will be encoded"), NULL);
709
gtk_tooltips_set_tip(tooltips, profile_eb, _("Choose the Media Profile that should be used to record."), NULL);
717
711
gtk_box_pack_start(GTK_BOX(rbox), record_table, TRUE, TRUE, 0);