69
static void active_is_always_recording(void);
72
67
* Fills the tree list with supported codecs
75
preferences_dialog_fill_codec_list(const account_t *account)
70
fill_codec_list(const account_t *account)
77
72
// Get model of view and clear it
78
73
GtkListStore *codecStore = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(codecTreeView)));
79
74
gtk_list_store_clear(codecStore);
81
GQueue *current = account ? account->codecs : get_system_codec_list();
83
if (!account) DEBUG("Using system codec list");
78
g_debug("Account is NULL, using global codec list");
79
list = get_audio_codecs_list();
81
list = account->acodecs;
86
for (guint i = 0; i < g_queue_get_length(current); i++) {
87
codec_t *c = codec_list_get_nth(i, current);
85
for (size_t i = 0; i < list->length; ++i) {
86
codec_t *c = g_queue_peek_nth(list, i);
89
g_debug("%s is %sactive", c->name, c->is_active ? "" : "not ");
92
91
gtk_list_store_append(codecStore, &iter);
92
gchar *samplerate = g_strdup_printf("%d " KHZ, (gint) (c->sample_rate * 0.001));
93
gchar *bitrate = g_strdup_printf("%s " KBPS, c->bitrate);
93
95
gtk_list_store_set(codecStore, &iter,
94
96
COLUMN_CODEC_ACTIVE, c->is_active,
95
97
COLUMN_CODEC_NAME, c->name,
96
COLUMN_CODEC_FREQUENCY, g_strdup_printf("%d kHz", (gint)(c->sample_rate * 0.001)),
97
COLUMN_CODEC_BITRATE, g_strdup_printf("%.1f kbps", c->_bitrate),
98
COLUMN_CODEC_FREQUENCY, samplerate,
99
COLUMN_CODEC_BITRATE, bitrate,
107
static GtkListStore *
108
create_device_list_store(gchar **list)
110
GtkListStore *list_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
112
for (gchar **tmp = list; tmp && *tmp; ++tmp) {
113
gint device_index = dbus_get_audio_device_index(*tmp);
115
gtk_list_store_append(list_store, &iter);
116
gtk_list_store_set(list_store, &iter, 0, *tmp, 1, device_index, -1);
104
123
* Fill store with output audio plugins
107
preferences_dialog_fill_audio_plugin_list()
126
create_alsa_plugin_list_store()
109
gtk_list_store_clear(pluginlist);
128
GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING);
111
130
// Call dbus to retreive list
112
131
gchar **list = dbus_get_audio_plugin_list();
114
// For each API name included in list
118
for (gchar *managerName = list[c]; managerName != NULL; managerName = list[c]) {
121
gtk_list_store_append(pluginlist, &iter);
122
gtk_list_store_set(pluginlist, &iter, 0, managerName, -1);
128
preferences_dialog_fill_output_audio_device_list()
130
gtk_list_store_clear(outputlist);
132
// Call dbus to retrieve list
133
for (gchar **list = dbus_get_audio_output_device_list(); *list ; list++) {
134
int device_index = dbus_get_audio_device_index(*list);
136
gtk_list_store_append(outputlist, &iter);
137
gtk_list_store_set(outputlist, &iter, 0, *list, 1, device_index, -1);
142
preferences_dialog_fill_ringtone_audio_device_list()
144
gtk_list_store_clear(ringtonelist);
146
// Call dbus to retreive output device
147
for (gchar **list = dbus_get_audio_output_device_list(); *list; list++) {
148
int device_index = dbus_get_audio_device_index(*list);
150
gtk_list_store_append(ringtonelist, &iter);
151
gtk_list_store_set(ringtonelist, &iter, 0, *list, 1, device_index, -1);
156
select_active_output_audio_device()
158
gboolean show_alsa = must_show_alsa_conf();
133
// For each plugin name included in list
134
for (gchar **tmp = list; tmp && *tmp; ++tmp) {
136
gtk_list_store_append(list_store, &iter);
137
gtk_list_store_set(list_store, &iter, 0, *tmp, -1);
144
select_active_output_audio_device(GtkWidget *output)
163
146
// Select active output device on server
164
147
gchar **devices = dbus_get_current_audio_devices_index();
167
int currentDeviceIndex = atoi(devices[0]);
168
DEBUG("audio device index for output = %d", currentDeviceIndex);
169
GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(output));
171
// Find the currently set output device
173
gtk_tree_model_get_iter_first(model, &iter);
177
gtk_tree_model_get(model, &iter, 1, &deviceIndex, -1);
179
if (deviceIndex == currentDeviceIndex) {
180
// Set current iteration the active one
181
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(output), &iter);
184
} while (gtk_tree_model_iter_next(model, &iter));
148
if (devices && devices[0]) {
150
int currentDeviceIndex = atoi(devices[0]);
152
g_debug("audio device index for output = %d", currentDeviceIndex);
153
GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(output));
155
// Find the currently set output device
157
gtk_tree_model_get_iter_first(model, &iter);
161
gtk_tree_model_get(model, &iter, 1, &deviceIndex, -1);
163
if (deviceIndex == currentDeviceIndex) {
164
// Set current iteration the active one
165
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(output), &iter);
168
} while (gtk_tree_model_iter_next(model, &iter));
186
171
// No index was found, select first one
187
WARN("No active output device found");
172
g_warning("No active output device found");
188
173
gtk_combo_box_set_active(GTK_COMBO_BOX(output), 0);
588
567
g_signal_connect(G_OBJECT(codecMoveDownButton), "clicked",
589
568
G_CALLBACK(codec_move_down), (gpointer) account);
591
preferences_dialog_fill_codec_list(account);
570
fill_codec_list(account);
593
572
return audiocodecs_hbox;
597
select_audio_manager(void)
599
if (!must_show_alsa_conf() && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pulse))) {
575
static GtkWidget* alsa_box()
577
GtkWidget *alsa_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
578
gtk_widget_show(alsa_hbox);
580
GtkWidget *grid = gtk_grid_new();
581
gtk_grid_set_column_spacing(GTK_GRID(grid), 40);
582
gtk_box_pack_start(GTK_BOX(alsa_hbox), grid, TRUE, TRUE, 1);
583
gtk_widget_show(grid);
585
gchar *message = "<small><i>default</i> plugin always uses internal sound card. Select <i>dmix/dsnoop</i> to use an alternate soundcard.</small>";
586
GtkWidget *info_bar = gnome_info_bar(message, GTK_MESSAGE_INFO);
587
/* Info bar gets a width of 2 cells */
588
gtk_grid_attach(GTK_GRID(grid), info_bar, 1, 1, 2, 1);
590
g_debug("Configuration plugin");
591
GtkWidget *label = gtk_label_new(_("ALSA plugin"));
592
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
593
gtk_grid_attach(GTK_GRID(grid), label, 1, 2, 1, 1);
594
gtk_widget_show(label);
595
// Set choices of audio managers
596
GtkListStore *alsa_pluginlist = create_alsa_plugin_list_store();
597
GtkWidget *alsa_plugin = gtk_combo_box_new_with_model(GTK_TREE_MODEL(alsa_pluginlist));
598
select_active_output_alsa_plugin(alsa_plugin);
599
gtk_label_set_mnemonic_widget(GTK_LABEL(label), alsa_plugin);
600
g_signal_connect(G_OBJECT(alsa_plugin), "changed", G_CALLBACK(select_output_alsa_plugin), NULL);
603
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
604
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(alsa_plugin), renderer, TRUE);
605
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(alsa_plugin), renderer, "text", 0, NULL);
606
gtk_grid_attach(GTK_GRID(grid), alsa_plugin, 2, 2, 1, 1);
607
gtk_widget_show(alsa_plugin);
609
// Device : Output device
610
// Create title label
611
g_debug("Configuration output");
612
label = gtk_label_new(_("Output"));
613
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
614
gtk_grid_attach(GTK_GRID(grid), label, 1, 3, 1, 1);
615
gtk_widget_show(label);
616
// Set choices of output devices
617
GtkListStore *outputlist = create_output_list_store();
618
alsa_output = gtk_combo_box_new_with_model(GTK_TREE_MODEL(outputlist));
619
select_active_output_audio_device(alsa_output);
620
gtk_label_set_mnemonic_widget(GTK_LABEL(label), alsa_output);
621
g_signal_connect(G_OBJECT(alsa_output), "changed", G_CALLBACK(select_audio_output_device), NULL);
624
renderer = gtk_cell_renderer_text_new();
625
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(alsa_output), renderer, TRUE);
626
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(alsa_output), renderer, "text", 0, NULL);
627
gtk_grid_attach(GTK_GRID(grid), alsa_output, 2, 3, 1, 1);
628
gtk_widget_show(alsa_output);
630
// Device : Input device
631
// Create title label
632
g_debug("Configuration input");
633
label = gtk_label_new(_("Input"));
634
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
635
gtk_grid_attach(GTK_GRID(grid), label, 1, 4, 1, 1);
636
gtk_widget_show(label);
638
// Set choices of input devices
639
GtkListStore *inputlist = create_input_list_store();
640
alsa_input = gtk_combo_box_new_with_model(GTK_TREE_MODEL(inputlist));
641
select_active_input_audio_device(alsa_input);
642
gtk_label_set_mnemonic_widget(GTK_LABEL(label), alsa_input);
643
g_signal_connect(G_OBJECT(alsa_input), "changed", G_CALLBACK(select_audio_input_device), NULL);
646
renderer = gtk_cell_renderer_text_new();
647
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(alsa_input), renderer, TRUE);
648
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(alsa_input), renderer, "text", 0, NULL);
649
gtk_grid_attach(GTK_GRID(grid), alsa_input, 2, 4, 1, 1);
650
gtk_widget_show(alsa_input);
652
g_debug("Configuration rintgtone");
653
label = gtk_label_new(_("Ringtone"));
654
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
655
gtk_grid_attach(GTK_GRID(grid), label, 1, 5, 1, 1);
656
gtk_widget_show(label);
657
// set choices of ringtone devices
658
GtkListStore *ringtonelist = create_output_list_store();
659
alsa_ringtone = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ringtonelist));
660
select_active_ringtone_audio_device(alsa_ringtone);
661
gtk_label_set_mnemonic_widget(GTK_LABEL(label), alsa_output);
662
g_signal_connect(G_OBJECT(alsa_ringtone), "changed", G_CALLBACK(select_audio_ringtone_device), NULL);
665
renderer = gtk_cell_renderer_text_new();
666
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(alsa_ringtone), renderer, TRUE);
667
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(alsa_ringtone), renderer, "text", 0, NULL);
668
gtk_grid_attach(GTK_GRID(grid), alsa_ringtone, 2, 5, 1, 1);
669
gtk_widget_show(alsa_ringtone);
671
gtk_widget_show_all(alsa_hbox);
673
// Update the combo box
674
gchar *alsa_pluginname = dbus_get_current_audio_output_plugin();
675
update_device_widget(alsa_pluginname, alsa_output, alsa_input, alsa_ringtone);
676
g_free(alsa_pluginname);
680
static GtkWidget* pulse_box()
682
GtkWidget *pulse_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
683
gtk_widget_show(pulse_hbox);
685
GtkWidget *grid = gtk_grid_new();
686
gtk_grid_set_column_spacing(GTK_GRID(grid), 40);
687
gtk_box_pack_start(GTK_BOX(pulse_hbox), grid, TRUE, TRUE, 1);
688
gtk_widget_show(grid);
690
// Device : Output device
691
// Create title label
692
g_debug("Configuration output");
693
GtkWidget *label = gtk_label_new(_("Output"));
694
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
695
gtk_grid_attach(GTK_GRID(grid), label, 1, 3, 1, 1);
696
gtk_widget_show(label);
698
// Set choices of output devices
699
GtkListStore *outputlist = create_output_list_store();
700
GtkWidget *pulse_output = gtk_combo_box_new_with_model(GTK_TREE_MODEL(outputlist));
701
select_active_output_audio_device(pulse_output);
702
gtk_label_set_mnemonic_widget(GTK_LABEL(label), pulse_output);
703
g_signal_connect(G_OBJECT(pulse_output), "changed", G_CALLBACK(select_audio_output_device), NULL);
706
GtkCellRenderer * renderer = gtk_cell_renderer_text_new();
707
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(pulse_output), renderer, TRUE);
708
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(pulse_output), renderer, "text", 0, NULL);
709
gtk_grid_attach(GTK_GRID(grid), pulse_output, 2, 3, 1, 1);
710
gtk_widget_show(pulse_output);
712
// Device : Input device
713
// Create title label
714
g_debug("Configuration input");
715
label = gtk_label_new(_("Input"));
716
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
717
gtk_grid_attach(GTK_GRID(grid), label, 1, 4, 1, 1);
718
gtk_widget_show(label);
720
// Set choices of output devices
721
GtkListStore *inputlist = create_input_list_store();
722
GtkWidget *pulse_input = gtk_combo_box_new_with_model(GTK_TREE_MODEL(inputlist));
723
select_active_input_audio_device(pulse_input);
724
gtk_label_set_mnemonic_widget(GTK_LABEL(label), pulse_input);
725
g_signal_connect(G_OBJECT(pulse_input), "changed", G_CALLBACK(select_audio_input_device), NULL);
728
renderer = gtk_cell_renderer_text_new();
729
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(pulse_input), renderer, TRUE);
730
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(pulse_input), renderer, "text", 0, NULL);
731
gtk_grid_attach(GTK_GRID(grid), pulse_input, 2, 4, 1, 1);
732
gtk_widget_show(pulse_input);
734
g_debug("Configuration rintgtone");
735
label = gtk_label_new(_("Ringtone"));
736
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
737
gtk_grid_attach(GTK_GRID(grid), label, 1, 5, 1, 1);
738
gtk_widget_show(label);
739
// set choices of ringtone devices
740
GtkListStore *ringtonelist = create_output_list_store();
741
GtkWidget *ringtone = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ringtonelist));
742
select_active_ringtone_audio_device(ringtone);
743
gtk_label_set_mnemonic_widget(GTK_LABEL(label), pulse_output);
744
g_signal_connect(G_OBJECT(ringtone), "changed", G_CALLBACK(select_audio_ringtone_device), NULL);
747
renderer = gtk_cell_renderer_text_new();
748
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ringtone), renderer, TRUE);
749
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ringtone), renderer, "text", 0, NULL);
750
gtk_grid_attach(GTK_GRID(grid), ringtone, 2, 5, 1, 1);
751
gtk_widget_show(ringtone);
753
gtk_widget_show_all(pulse_hbox);
760
select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client)
762
if (!must_show_alsa_conf() && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(alsa_button))) {
600
763
dbus_set_audio_manager(ALSA_API_STR);
764
gtk_container_remove(GTK_CONTAINER(pulse_conf), pulsebox);
765
gtk_widget_hide(pulse_conf);
601
767
alsabox = alsa_box();
602
768
gtk_container_add(GTK_CONTAINER(alsa_conf), alsabox);
603
769
gtk_widget_show(alsa_conf);
604
770
gtk_widget_set_sensitive(alsa_conf, TRUE);
605
771
gtk_action_set_sensitive(volumeToggle_, TRUE);
606
} else if (must_show_alsa_conf() && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pulse))) {
772
} else if (must_show_alsa_conf() && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(alsa_button))) {
607
773
dbus_set_audio_manager(PULSEAUDIO_API_STR);
608
gtk_container_remove(GTK_CONTAINER(alsa_conf) , alsabox);
774
gtk_container_remove(GTK_CONTAINER(alsa_conf), alsabox);
609
775
gtk_widget_hide(alsa_conf);
777
pulsebox = pulse_box();
778
gtk_container_add(GTK_CONTAINER(pulse_conf), pulsebox);
779
gtk_widget_show(pulse_conf);
780
gtk_widget_set_sensitive(pulse_conf, TRUE);
781
gtk_action_set_sensitive(volumeToggle_, TRUE);
611
783
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) {
612
784
main_window_volume_controls(FALSE);
613
eel_gconf_set_integer(SHOW_VOLUME_CONTROLS, FALSE);
785
g_settings_set_boolean(client->settings, "show-volume-controls", FALSE);
614
786
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE);
617
789
gtk_action_set_sensitive(volumeToggle_, FALSE);
791
g_warning("Unexpected audio API state");
794
static const gchar *reverse_state(const gchar *state)
796
if (g_strcmp0(state, "enabled") == 0)
623
803
active_noise_suppress(void)
625
805
gchar *state = dbus_get_noise_suppress_state();
627
if (g_strcmp0(state, "enabled") == 0)
628
dbus_set_noise_suppress_state("disabled");
630
dbus_set_noise_suppress_state("enabled");
806
dbus_set_noise_suppress_state(reverse_state(state));
636
811
active_echo_cancel(void)
638
813
gchar *state = dbus_get_echo_cancel_state();
640
if (g_strcmp0(state, "enabled") == 0)
641
dbus_set_echo_cancel_state("disabled");
643
dbus_set_echo_cancel_state("enabled");
814
dbus_set_echo_cancel_state(reverse_state(state));
649
echo_tail_length_changed(GtkRange *range, gpointer user_data UNUSED)
651
dbus_set_echo_cancel_tail_length(gtk_range_get_value(range));
655
echo_delay_changed(GtkRange *range, gpointer user_data UNUSED)
657
dbus_set_echo_cancel_delay(gtk_range_get_value(range));
661
819
active_is_always_recording(void)
663
821
dbus_set_is_always_recording(!dbus_get_is_always_recording());
666
GtkWidget* alsa_box()
668
GtkWidget *alsa_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
669
gtk_widget_show(alsa_hbox);
671
GtkWidget *table = gtk_table_new(6, 3, FALSE);
672
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 40);
673
gtk_box_pack_start(GTK_BOX(alsa_hbox) , table , TRUE , TRUE , 1);
674
gtk_widget_show(table);
676
gchar *message = "<small><i>default</i> plugin always uses internal sound card. Select <i>dmix/dsnoop</i> to use an alternate soundcard.</small>";
677
GtkWidget *info_bar = gnome_info_bar(message, GTK_MESSAGE_INFO);
678
gtk_table_attach(GTK_TABLE(table), info_bar, 1, 3, 1, 2, GTK_FILL, GTK_SHRINK, 10, 10);
680
DEBUG("Configuration plugin");
681
GtkWidget *label = gtk_label_new(_("ALSA plugin"));
682
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
683
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
684
gtk_widget_show(label);
685
// Set choices of audio managers
686
pluginlist = gtk_list_store_new(1, G_TYPE_STRING);
687
preferences_dialog_fill_audio_plugin_list();
688
plugin = gtk_combo_box_new_with_model(GTK_TREE_MODEL(pluginlist));
689
select_active_output_audio_plugin();
690
gtk_label_set_mnemonic_widget(GTK_LABEL(label), plugin);
691
g_signal_connect(G_OBJECT(plugin), "changed", G_CALLBACK(select_output_audio_plugin), plugin);
694
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
695
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(plugin), renderer, TRUE);
696
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(plugin), renderer, "text", 0, NULL);
697
gtk_table_attach(GTK_TABLE(table), plugin, 2, 3, 2, 3, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
698
gtk_widget_show(plugin);
700
// Device : Output device
701
// Create title label
702
DEBUG("Configuration output");
703
label = gtk_label_new(_("Output"));
704
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
705
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
706
gtk_widget_show(label);
707
// Set choices of output devices
708
outputlist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
709
preferences_dialog_fill_output_audio_device_list();
710
output = gtk_combo_box_new_with_model(GTK_TREE_MODEL(outputlist));
711
select_active_output_audio_device();
712
gtk_label_set_mnemonic_widget(GTK_LABEL(label), output);
713
g_signal_connect(G_OBJECT(output), "changed", G_CALLBACK(select_audio_output_device), output);
716
renderer = gtk_cell_renderer_text_new();
717
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(output), renderer, TRUE);
718
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(output), renderer, "text", 0, NULL);
719
gtk_table_attach(GTK_TABLE(table), output, 2, 3, 3, 4, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
720
gtk_widget_show(output);
722
// Device : Input device
723
// Create title label
724
DEBUG("Configuration input");
725
label = gtk_label_new(_("Input"));
726
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
727
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
728
gtk_widget_show(label);
730
// Set choices of output devices
731
inputlist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
732
preferences_dialog_fill_input_audio_device_list();
733
input = gtk_combo_box_new_with_model(GTK_TREE_MODEL(inputlist));
734
select_active_input_audio_device();
735
gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
736
g_signal_connect(G_OBJECT(input), "changed", G_CALLBACK(select_audio_input_device), input);
739
renderer = gtk_cell_renderer_text_new();
740
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(input), renderer, TRUE);
741
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(input), renderer, "text", 0, NULL);
742
gtk_table_attach(GTK_TABLE(table), input, 2, 3, 4, 5, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
743
gtk_widget_show(input);
745
DEBUG("Configuration rintgtone");
746
label = gtk_label_new(_("Ringtone"));
747
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
748
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
749
gtk_widget_show(label);
750
// set choices of ringtone devices
751
ringtonelist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
752
preferences_dialog_fill_ringtone_audio_device_list();
753
ringtone = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ringtonelist));
754
select_active_ringtone_audio_device();
755
gtk_label_set_mnemonic_widget(GTK_LABEL(label), output);
756
g_signal_connect(G_OBJECT(ringtone), "changed", G_CALLBACK(select_audio_ringtone_device), output);
759
renderer = gtk_cell_renderer_text_new();
760
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ringtone), renderer, TRUE);
761
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ringtone), renderer, "text", 0, NULL);
762
gtk_table_attach(GTK_TABLE(table), ringtone, 2, 3, 5, 6, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
763
gtk_widget_show(ringtone);
765
gtk_widget_show_all(alsa_hbox);
767
// Update the combo box
768
update_device_widget(dbus_get_current_audio_output_plugin());
772
static void record_path_changed(GtkFileChooser *chooser , GtkLabel *label UNUSED)
775
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser));
776
dbus_set_record_path(path);
779
GtkWidget* create_audio_configuration()
824
static void restore_recording_path(GtkFileChooser *chooser)
826
gchar *recording_path = dbus_get_record_path();
827
if (recording_path && strlen(recording_path) > 0)
828
gtk_file_chooser_set_current_folder(chooser, recording_path);
829
g_free(recording_path);
832
static void record_path_changed(GtkFileChooser *chooser, G_GNUC_UNUSED gpointer data)
834
gchar* path = gtk_file_chooser_get_filename(chooser);
835
if (!g_access(path, W_OK)) {
836
dbus_set_record_path(path);
838
g_warning("Directory %s is not writable", path);
839
restore_recording_path(chooser);
844
GtkWidget* create_audio_configuration(SFLPhoneClient *client)
781
846
/* Main widget */
782
847
GtkWidget *audio_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);
783
848
gtk_container_set_border_width(GTK_CONTAINER(audio_vbox), 10);
785
850
GtkWidget *frame;
787
gnome_main_section_new_with_table(_("Sound Manager"), &frame, &table, 1, 4);
852
gnome_main_section_new_with_grid(_("Sound Manager"), &frame, &grid);
788
853
gtk_box_pack_start(GTK_BOX(audio_vbox), frame, FALSE, FALSE, 0);
790
855
gchar *audio_manager = dbus_get_audio_manager();
791
gboolean pulse_audio = FALSE;
793
if (g_strcmp0(audio_manager, PULSEAUDIO_API_STR) == 0)
856
const gboolean using_pulse = g_strcmp0(audio_manager, PULSEAUDIO_API_STR) == 0;
796
857
g_free(audio_manager);
798
pulse = gtk_radio_button_new_with_mnemonic(NULL , _("_Pulseaudio"));
799
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pulse), pulse_audio);
800
gtk_table_attach(GTK_TABLE(table), pulse, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
802
GtkWidget *alsa = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(pulse), _("_ALSA"));
803
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alsa), !pulse_audio);
804
g_signal_connect(G_OBJECT(alsa), "clicked", G_CALLBACK(select_audio_manager), NULL);
805
gtk_table_attach(GTK_TABLE(table), alsa, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
859
GtkWidget *pulse_button = gtk_radio_button_new_with_mnemonic(NULL , _("_Pulseaudio"));
860
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pulse_button), using_pulse);
861
gtk_grid_attach(GTK_GRID(grid), pulse_button, 0, 0, 1, 1);
863
// Box for the Pulse configuration
864
pulse_conf = gnome_main_section_new(_("Pulseaudio settings"));
865
gtk_box_pack_start(GTK_BOX(audio_vbox), pulse_conf, FALSE, FALSE, 0);
866
gtk_widget_show(pulse_conf);
868
GtkWidget *alsa_button = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(pulse_button), _("_ALSA"));
869
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alsa_button), !using_pulse);
870
g_signal_connect(G_OBJECT(alsa_button), "clicked", G_CALLBACK(select_audio_manager), client);
871
gtk_grid_attach(GTK_GRID(grid), alsa_button, 1, 0, 1, 1);
807
873
// Box for the ALSA configuration
808
874
alsa_conf = gnome_main_section_new(_("ALSA settings"));