From 9481de22354d1f07212c39a9ed67134930bfe2a5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 16 Sep 2004 22:57:01 +0000 Subject: implement client/source-output/sink-input killing git-svn-id: file:///home/lennart/svn/public/paman/trunk@34 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/ClientWindow.cc | 7 +++++++ src/ClientWindow.hh | 2 ++ src/ServerInfoManager.cc | 12 ++++++++++++ src/ServerInfoManager.hh | 4 ++++ src/SinkInputWindow.cc | 5 +++++ src/SinkInputWindow.hh | 1 + src/SourceOutputWindow.cc | 6 ++++++ src/SourceOutputWindow.hh | 3 ++- 8 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ClientWindow.cc b/src/ClientWindow.cc index 6cb814e..01f3ecf 100644 --- a/src/ClientWindow.cc +++ b/src/ClientWindow.cc @@ -25,6 +25,7 @@ ClientWindow::ClientWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_clicked().connect(sigc::mem_fun(*this, &ClientWindow::onCloseButton)); toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &ClientWindow::onToOwnerModuleButton)); + killButton->signal_clicked().connect(sigc::mem_fun(*this, &ClientWindow::onKillButton)); } ClientWindow* ClientWindow::create() { @@ -49,6 +50,8 @@ void ClientWindow::updateInfo(const ClientInfo &i) { owner_module = i.owner_module; toOwnerModuleButton->set_sensitive(owner_module != (uint32_t) -1); + + index = i.index; } void ClientWindow::onCloseButton() { @@ -64,3 +67,7 @@ bool ClientWindow::on_delete_event(GdkEventAny*) { hide(); return false; } + +void ClientWindow::onKillButton() { + serverInfoManager->killClient(index); +} diff --git a/src/ClientWindow.hh b/src/ClientWindow.hh index 837a3b7..da0049a 100644 --- a/src/ClientWindow.hh +++ b/src/ClientWindow.hh @@ -23,12 +23,14 @@ public: *killButton; uint32_t owner_module; + uint32_t index; void updateInfo(const ClientInfo &i); virtual void onCloseButton(); virtual void onToOwnerModuleButton(); virtual bool on_delete_event(GdkEventAny* e); + virtual void onKillButton(); }; #endif diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 13c751a..5d0a6f0 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -710,3 +710,15 @@ void ServerInfoManager::runVolumeMeter(const Glib::ustring &source) { snprintf(t, sizeof(t), "%s %s", PAVUMETER_PATH, source.c_str()); Glib::spawn_command_line_async(t); } + +void ServerInfoManager::killClient(uint32_t index) { + pa_operation_unref(pa_context_kill_client(&context, index, NULL, NULL)); +} + +void ServerInfoManager::killSourceOutput(uint32_t index) { + pa_operation_unref(pa_context_kill_source_output(&context, index, NULL, NULL)); +} + +void ServerInfoManager::killSinkInput(uint32_t index) { + pa_operation_unref(pa_context_kill_sink_input(&context, index, NULL, NULL)); +} diff --git a/src/ServerInfoManager.hh b/src/ServerInfoManager.hh index 01e9394..5cd5c5e 100644 --- a/src/ServerInfoManager.hh +++ b/src/ServerInfoManager.hh @@ -209,6 +209,10 @@ public: void playSample(uint32_t sample, uint32_t sink); void runVolumeMeter(const Glib::ustring &source); + + void killClient(uint32_t index); + void killSourceOutput(uint32_t index); + void killSinkInput(uint32_t index); protected: std::map sinks; diff --git a/src/SinkInputWindow.cc b/src/SinkInputWindow.cc index 6a59969..ffd1791 100644 --- a/src/SinkInputWindow.cc +++ b/src/SinkInputWindow.cc @@ -48,6 +48,7 @@ SinkInputWindow::SinkInputWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_value_changed().connect(sigc::mem_fun(*this, &SinkInputWindow::onVolumeScaleValueChanged)); volumeResetButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkInputWindow::onVolumeResetButton)); volumeMuteButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkInputWindow::onVolumeMuteButton)); + killButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkInputWindow::onKillButton)); } SinkInputWindow* SinkInputWindow::create() { @@ -140,3 +141,7 @@ bool SinkInputWindow::on_delete_event(GdkEventAny* ) { hide(); return false; } + +void SinkInputWindow::onKillButton() { + serverInfoManager->killSinkInput(index); +} diff --git a/src/SinkInputWindow.hh b/src/SinkInputWindow.hh index aaade23..01ef7b8 100644 --- a/src/SinkInputWindow.hh +++ b/src/SinkInputWindow.hh @@ -44,6 +44,7 @@ public: virtual void onVolumeResetButton(); virtual void onVolumeMuteButton(); virtual bool on_delete_event(GdkEventAny* e); + virtual void onKillButton(); }; #endif diff --git a/src/SourceOutputWindow.cc b/src/SourceOutputWindow.cc index e93dff4..e2cc5db 100644 --- a/src/SourceOutputWindow.cc +++ b/src/SourceOutputWindow.cc @@ -37,6 +37,7 @@ SourceOutputWindow::SourceOutputWindow(BaseObjectType* cobject, const Glib::RefP toOwnerModuleButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToOwnerModuleButton)); toClientButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToClientButton)); toSourceButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onToSourceButton)); + killButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceOutputWindow::onKillButton)); } SourceOutputWindow* SourceOutputWindow::create() { @@ -80,6 +81,7 @@ void SourceOutputWindow::updateInfo(const SourceOutputInfo &i) { this->source = i.source; owner_module = i.owner_module; client = i.client; + index = i.index; toOwnerModuleButton->set_sensitive(owner_module != PA_INVALID_INDEX); toClientButton->set_sensitive(client != PA_INVALID_INDEX); @@ -108,3 +110,7 @@ bool SourceOutputWindow::on_delete_event(GdkEventAny*) { hide(); return false; } + +void SourceOutputWindow::onKillButton() { + serverInfoManager->killSourceOutput(index); +} diff --git a/src/SourceOutputWindow.hh b/src/SourceOutputWindow.hh index 5fc4e8c..c474f72 100644 --- a/src/SourceOutputWindow.hh +++ b/src/SourceOutputWindow.hh @@ -27,7 +27,7 @@ public: *toSourceButton, *killButton; - uint32_t owner_module, source, client; + uint32_t owner_module, source, client, index; void updateInfo(const SourceOutputInfo &i); @@ -36,6 +36,7 @@ public: virtual void onToClientButton(); virtual void onToSourceButton(); virtual bool on_delete_event(GdkEventAny* e); + virtual void onKillButton(); }; #endif -- cgit