add option to kill a stream to popup menu

git-svn-id: file:///home/lennart/svn/public/pavucontrol/trunk@62 c17c95f2-f111-0410-90bf-f30a9569010c
This commit is contained in:
Lennart Poettering 2007-09-02 23:53:16 +00:00
parent e41c9bed6c
commit 362b4b2b0c
1 changed files with 19 additions and 4 deletions

View File

@ -162,10 +162,11 @@ public:
uint32_t index, clientIndex, sinkIndex; uint32_t index, clientIndex, sinkIndex;
virtual void executeVolumeUpdate(); virtual void executeVolumeUpdate();
virtual void onMuteToggleButton(); virtual void onMuteToggleButton();
virtual void onKill();
MainWindow *mainWindow; MainWindow *mainWindow;
Gtk::Menu menu, submenu; Gtk::Menu menu, submenu;
Gtk::MenuItem titleMenuItem; Gtk::MenuItem titleMenuItem, killMenuItem;
struct SinkMenuItem { struct SinkMenuItem {
SinkMenuItem(SinkInputWidget *w, const char *label, uint32_t i, bool active) : SinkMenuItem(SinkInputWidget *w, const char *label, uint32_t i, bool active) :
@ -380,7 +381,7 @@ void StreamWidget::executeVolumeUpdate() {
SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x), StreamWidget(cobject, x),
defaultMenuItem("Default"){ defaultMenuItem("_Default", true){
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
@ -451,7 +452,7 @@ void SinkWidget::onDefaultToggle() {
SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x), StreamWidget(cobject, x),
defaultMenuItem("Default"){ defaultMenuItem("_Default", true){
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
@ -523,12 +524,16 @@ void SourceWidget::onDefaultToggle() {
SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x), StreamWidget(cobject, x),
mainWindow(NULL), mainWindow(NULL),
titleMenuItem("Move Stream...") { titleMenuItem("_Move Stream...", true),
killMenuItem("_Terminate Stream", true) {
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
menu.append(titleMenuItem); menu.append(titleMenuItem);
titleMenuItem.set_submenu(submenu); titleMenuItem.set_submenu(submenu);
menu.append(killMenuItem);
killMenuItem.signal_activate().connect(sigc::mem_fun(*this, &SinkInputWidget::onKill));
} }
SinkInputWidget::~SinkInputWidget() { SinkInputWidget::~SinkInputWidget() {
@ -601,6 +606,16 @@ void SinkInputWidget::buildMenu() {
menu.show_all(); menu.show_all();
} }
void SinkInputWidget::onKill() {
pa_operation* o;
if (!(o = pa_context_kill_sink_input(context, index, NULL, NULL))) {
show_error("pa_context_kill_sink_input() failed");
return;
}
pa_operation_unref(o);
}
void SinkInputWidget::SinkMenuItem::onToggle() { void SinkInputWidget::SinkMenuItem::onToggle() {
if (widget->updating) if (widget->updating)