diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-08-09 17:35:05 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-08-09 17:35:05 +0000 |
commit | 68599f389c0e8fac8daec38eb0bfac06145c0d23 (patch) | |
tree | 6403e57435accfa0666a031d89df182d52181b7a | |
parent | 4a55634d71fcda13dbd7adecb492759392cbab5b (diff) |
gray out options where no matching module is installed
git-svn-id: file:///home/lennart/svn/public/paprefs/trunk@26 54a58c19-9419-0410-9bbb-d8fa3e5d54ff
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/paprefs.cc | 32 |
2 files changed, 31 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 7729bee..f304f2d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. +# Needs fixing on some borked OS +SHREXT=.so + desktopdir = $(datadir)/applications gladedir = $(pkgdatadir) localedir = $(datadir)/locale @@ -29,8 +32,8 @@ desktop_DATA=$(desktop_in_files:.desktop.in=.desktop) paprefs_SOURCES=paprefs.cc paprefs_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) -paprefs_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) -paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" +paprefs_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) +paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" -DMODULESDIR=\""${libdir}/pulse-0.9/modules/"\" -DSHREXT=\"$(SHREXT)\" EXTRA_DIST = $(glade_DATA) $(desktop_in_files) diff --git a/src/paprefs.cc b/src/paprefs.cc index 2cad665..871f2de 100644 --- a/src/paprefs.cc +++ b/src/paprefs.cc @@ -63,10 +63,13 @@ public: void onChangeRtpReceive(); void onChangeRtpSend(); void readFromGConf(); + void checkForModules(); void writeToGConfRemoteAccess(); void writeToGConfRtpReceive(); void writeToGConfRtpSend(); void onGConfChange(const Glib::ustring& key, const Gnome::Conf::Value& value); + + bool rtpRecvAvailable, rtpSendAvailable, zeroconfAvailable, remoteAvailable; }; MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : @@ -89,6 +92,8 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade: Gdk::Color c("white"); titleEventBox->modify_bg(Gtk::STATE_NORMAL, c); + checkForModules(); + gconf = Gnome::Conf::Client::get_default_client(); gconf->set_error_handling(Gnome::Conf::CLIENT_HANDLE_ALL); gconf->add_dir(PA_GCONF_ROOT, Gnome::Conf::CLIENT_PRELOAD_RECURSIVE); @@ -125,15 +130,18 @@ void MainWindow::onCloseButtonClicked() { void MainWindow::updateSensitive() { bool b; + remoteAccessCheckButton->set_sensitive(remoteAvailable); b = remoteAccessCheckButton->get_active(); - zeroconfCheckButton->set_sensitive(b); - anonymousAuthCheckButton->set_sensitive(b); + zeroconfCheckButton->set_sensitive(b && zeroconfAvailable); + anonymousAuthCheckButton->set_sensitive(b && remoteAvailable); + rtpReceiveCheckButton->set_sensitive(rtpRecvAvailable); + rtpSendCheckButton->set_sensitive(rtpSendAvailable); b = rtpSendCheckButton->get_active(); - rtpLoopbackCheckButton->set_sensitive(b && !rtpSpeakerRadioButton->get_active()); - rtpMikeRadioButton->set_sensitive(b); - rtpSpeakerRadioButton->set_sensitive(b); - rtpNullSinkRadioButton->set_sensitive(b); + rtpLoopbackCheckButton->set_sensitive(b && !rtpSpeakerRadioButton->get_active() && rtpSendAvailable); + rtpMikeRadioButton->set_sensitive(b && rtpSendAvailable); + rtpSpeakerRadioButton->set_sensitive(b && rtpSendAvailable); + rtpNullSinkRadioButton->set_sensitive(b && rtpSendAvailable); } void MainWindow::onChangeRemoteAccess() { @@ -303,6 +311,18 @@ void MainWindow::readFromGConf() { updateSensitive(); } +void MainWindow::checkForModules() { + + remoteAvailable = + access(MODULESDIR "module-esound-protocol-tcp" SHREXT, F_OK) == 0 || + access(MODULESDIR "module-native-protocol-tcp" SHREXT, F_OK) == 0; + + zeroconfAvailable = access(MODULESDIR "module-zeroconf-publish" SHREXT, F_OK) == 0; + + rtpRecvAvailable = access(MODULESDIR "module-rtp-recv" SHREXT, F_OK) == 0; + rtpSendAvailable = access(MODULESDIR "module-rtp-send" SHREXT, F_OK) == 0; +} + int main(int argc, char *argv[]) { /* Initialize the i18n stuff */ |