From 879eef6acb3c8a6ad937a5a7cfbfc9f151bcc0cd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 31 May 2006 17:54:34 +0000 Subject: Make the volume meter buttons insensitive if pavumeter is not in the $PATH git-svn-id: file:///home/lennart/svn/public/paman/trunk@69 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/ServerInfoManager.cc | 8 ++++++++ src/ServerInfoManager.hh | 3 ++- src/SinkWindow.cc | 2 ++ src/SourceWindow.cc | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 436912d..0e41cde 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -790,6 +790,14 @@ void ServerInfoManager::runVolumeMeter(const Glib::ustring &source) { Glib::spawn_command_line_async(t); } +bool ServerInfoManager::volumeMeterSupported() { + gchar *c; + c = g_find_program_in_path(PAVUMETER_PATH); + g_free(c); + + return !!c; +} + void ServerInfoManager::killClient(uint32_t index) { pa_operation_unref(pa_context_kill_client(&context, index, NULL, NULL)); } diff --git a/src/ServerInfoManager.hh b/src/ServerInfoManager.hh index 6467c05..c8ce1d8 100644 --- a/src/ServerInfoManager.hh +++ b/src/ServerInfoManager.hh @@ -243,7 +243,8 @@ public: void playSample(uint32_t sample, uint32_t sink); void runVolumeMeter(const Glib::ustring &source); - + bool volumeMeterSupported(); + void killClient(uint32_t index); void killSourceOutput(uint32_t index); void killSinkInput(uint32_t index); diff --git a/src/SinkWindow.cc b/src/SinkWindow.cc index d6971dd..93f39ec 100644 --- a/src/SinkWindow.cc +++ b/src/SinkWindow.cc @@ -70,6 +70,8 @@ SinkWindow::SinkWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeResetButton)); volumeMuteButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeMuteButton)); volumeMeterButton->signal_clicked().connect(sigc::mem_fun(*this, &SinkWindow::onVolumeMeterButton)); + + volumeMeterButton->set_sensitive(serverInfoManager->volumeMeterSupported()); } SinkWindow* SinkWindow::create() { diff --git a/src/SourceWindow.cc b/src/SourceWindow.cc index d12802d..52119ce 100644 --- a/src/SourceWindow.cc +++ b/src/SourceWindow.cc @@ -66,6 +66,8 @@ SourceWindow::SourceWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onVolumeResetButton)); volumeMuteButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onVolumeMuteButton)); volumeMeterButton->signal_clicked().connect(sigc::mem_fun(*this, &SourceWindow::onVolumeMeterButton)); + + volumeMeterButton->set_sensitive(serverInfoManager->volumeMeterSupported()); } SourceWindow* SourceWindow::create() { -- cgit