From 159609135f34c2791eee7f2d6576e50fff80fa6a Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sat, 27 Jun 2009 18:14:05 +0100 Subject: Add support for changing ports. This commit adds a combo box for selecting ports. Overall this implementation could have taken two paths: * Implement port selection as combo box. * Implement port selection as a button. I went for the first option as is done in selecting card profiles over the second method used for selecting devices for streams. This seems more like how a config option should be presented as opposed to a runtime type thing. --- src/sourcewidget.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/sourcewidget.cc') diff --git a/src/sourcewidget.cc b/src/sourcewidget.cc index 94e78b1..2779df4 100644 --- a/src/sourcewidget.cc +++ b/src/sourcewidget.cc @@ -75,3 +75,28 @@ void SourceWidget::onDefaultToggleButton() { } pa_operation_unref(o); } + +void SourceWidget::onPortChange() { + Gtk::TreeModel::iterator iter; + + if (updating) + return; + + iter = portList->get_active(); + if (iter) + { + Gtk::TreeModel::Row row = *iter; + if (row) + { + pa_operation* o; + Glib::ustring port = row[portModel.name]; + + if (!(o = pa_context_set_source_port_by_index(get_context(), index, port.c_str(), NULL, NULL))) { + show_error(_("pa_context_set_source_port_by_index() failed")); + return; + } + + pa_operation_unref(o); + } + } +} \ No newline at end of file -- cgit