diff options
author | Lennart Poettering <lennart@poettering.net> | 2006-07-27 18:14:19 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2006-07-27 18:14:19 +0000 |
commit | c2ec65fc81cc51573f3fb9deb02fa2830a359604 (patch) | |
tree | 49e831a8851cc24d19e0078f1f2e7c5af8a29a10 | |
parent | bd57a254d64dfd1cecb36d54e5417c5972ec1841 (diff) |
initial commit
git-svn-id: file:///home/lennart/svn/public/paprefs/trunk@3 54a58c19-9419-0410-9bbb-d8fa3e5d54ff
-rw-r--r-- | Makefile.am | 39 | ||||
-rwxr-xr-x | bootstrap.sh | 59 | ||||
-rw-r--r-- | configure.ac | 72 | ||||
-rw-r--r-- | doc/Makefile.am | 36 | ||||
-rw-r--r-- | doc/README.html.in | 121 | ||||
-rw-r--r-- | doc/style.css | 27 | ||||
-rw-r--r-- | src/Makefile.am | 31 | ||||
-rw-r--r-- | src/paprefs.cc | 316 | ||||
-rw-r--r-- | src/paprefs.desktop | 11 | ||||
-rw-r--r-- | src/paprefs.glade | 532 |
10 files changed, 1244 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..92b22c3 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,39 @@ +# $Id$ +# +# This file is part of paprefs. +# +# paprefs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# paprefs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paprefs; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +EXTRA_DIST = bootstrap.sh README LICENSE +SUBDIRS=src +# doc + +MAINTAINERCLEANFILES=README +noinst_DATA = README + +README: + rm -f README + $(MAKE) -C doc README + cd $(srcdir) && ln -s doc/README README + +homepage: all dist + test -d $$HOME/homepage/private + mkdir -p $$HOME/homepage/private/projects/paprefs + cp paprefs-@PACKAGE_VERSION@.tar.gz $$HOME/homepage/private/projects/paprefs + cp doc/README.html doc/screenshot.png doc/style.css $$HOME/homepage/private/projects/paprefs + ln -sf README.html $$HOME/homepage/private/projects/paprefs/index.html + +.PHONY: homepage diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..0d3db06 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# $Id$ + +# This file is part of paprefs. +# +# paprefs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# paprefs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paprefs; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +VERSION=1.9 + +run_versioned() { + local P + local V + + V=$(echo "$2" | sed -e 's,\.,,g') + + if [ -e "`which $1$V`" ] ; then + P="$1$V" + else + if [ -e "`which $1-$2`" ] ; then + P="$1-$2" + else + P="$1" + fi + fi + + shift 2 + "$P" "$@" +} + +set -ex + +if [ "x$1" = "xam" ] ; then + run_versioned automake "$VERSION" -a -c --foreign + ./config.status +else + rm -rf autom4te.cache + rm -f config.cache + + run_versioned aclocal "$VERSION" + run_versioned autoconf 2.59 -Wall + run_versioned autoheader 2.59 + run_versioned automake "$VERSION" -a -c --foreign + + CFLAGS="-g -O0" ./configure --sysconfdir=/etc "$@" + + make clean +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..d48afdf --- /dev/null +++ b/configure.ac @@ -0,0 +1,72 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +# $Id$ + +# This file is part of paprefs. +# +# paprefs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# paprefs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paprefs; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +AC_PREREQ(2.57) +AC_INIT([paprefs],[0.9.0],[mzpaprefs (at) 0pointer (dot) de]) +AC_CONFIG_SRCDIR([src/paprefs.cc]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) + +AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/paprefs/]) + +if type -p stow > /dev/null && test -d /usr/local/stow ; then + AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) + ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" +fi + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_LN_S +AC_TYPE_SIGNAL +AC_HEADER_STDC + +PKG_CHECK_MODULES(GUILIBS, [ gtkmm-2.4 libglademm-2.4 sigc++-2.0 gconfmm-2.6]) +AC_SUBST(GUILIBS_CFLAGS) +AC_SUBST(GUILIBS_LIBS) + +# If using GCC specifiy some additional parameters +if test "x$GCC" = "xyes" ; then + CFLAGS="$CFLAGS -pipe -Wall -W -Wno-unused-parameter" + CXXFLAGS="$CXXFLAGS -pipe -Wall -W" +fi + +# LYNX documentation generation +AC_ARG_ENABLE(lynx, + AS_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation), +[case "${enableval}" in + yes) lynx=yes ;; + no) lynx=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-lynx) ;; +esac],[lynx=yes]) + +if test x$lynx = xyes ; then + AC_CHECK_PROG(have_lynx, lynx, yes, no) + + if test x$have_lynx = xno ; then + AC_MSG_ERROR([*** Sorry, you have to install lynx or use --disable-lynx ***]) + fi +fi + +AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes]) + +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/README.html]) +AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..5f985dc --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,36 @@ +# $Id$ + +# This file is part of paprefs. +# +# paprefs is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# paprefs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paprefs; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +noinst_DATA = README.html README +EXTRA_DIST = $(noinst_DATA) style.css README.html.in + +MAINTAINERCLEANFILES = README README.html +CLEANFILES = + +if USE_LYNX +README: README.html + lynx --dump $^ | sed 's,file://localhost/.*/doc/README.html,README,' > $@ + +CLEANFILES += README +endif + +tidy: README.html + tidy -e < README.html + +.PHONY: tidy + diff --git a/doc/README.html.in b/doc/README.html.in new file mode 100644 index 0000000..7089154 --- /dev/null +++ b/doc/README.html.in @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="iso-8859-1"?> <!-- -*-html-helper-*- --> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + +<head> +<title>PulseAudio Volume Control @PACKAGE_VERSION@</title> +<link rel="stylesheet" type="text/css" href="style.css" /> +</head> + +<body> +<h1><a name="top">PulseAudio Volume Control @PACKAGE_VERSION@</a></h1> + +<p><i>Copyright 2006 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> + +<ul class="toc"> + <li><a href="#license">License</a></li> + <li><a href="#news">News</a></li> + <li><a href="#overview">Overview</a></li> + <li><a href="#status">Current Status</a></li> + <li><a href="#documentation">Documentation</a></li> + <li><a href="#requirements">Requirements</a></li> + <li><a href="#installation">Installation</a></li> + <li><a href="#acks">Acknowledgements</a></li> + <li><a href="#download">Download</a></li> +</ul> + +<h2><a name="license">License</a></h2> + +<p>This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version.</p> + +<p>This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details.</p> + +<p>You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p> + +<h2><a name="news">News</a></h2> + +<div class="news-date">Mon Jul 24 2006: </div> <p class="news-text"><a +href="@PACKAGE_URL@paprefs-0.9.3.tar.gz">Version 0.9.3</a> released; show client names only if they are set</p> + +<div class="news-date">Sat Jul 8 2006: </div> <p class="news-text"><a +href="@PACKAGE_URL@paprefs-0.9.2.tar.gz">Version 0.9.2</a> released; update for <a href="http://pulseaudio.org/">PulseAudio 0.9.2</a></p> + +<div class="news-date">Fri Jun 2 2006: </div> <p class="news-text"><a +href="@PACKAGE_URL@paprefs-0.9.1.tar.gz">Version 0.9.1</a> released; add a <tt>.desktop</tt> file; update icons everywhere</p> + +<div class="news-date">Sat May 27 2006: </div> <p class="news-text"><a +href="@PACKAGE_URL@paprefs-0.9.0.tar.gz">Version 0.9.0</a> released; update for Polypaudio 0.9.0; show client name of playback streams; make volume slider more responsive</p> + +<div class="news-date">Fri Apr 21 2006: </div> <p class="news-text"><a +href="@PACKAGE_URL@paprefs-0.8.tar.gz">Version 0.8</a> released; initial release</p> + +<h2><a name="overview">Overview</a></h2> + +<p>PulseAudio Volume Control (<tt>paprefs</tt>) is a simple GTK +based volume control tool ("mixer") for the <a +href="http://0pointer.de/lennart/projects/pulseaudio/">PulseAudio +sound server</a>. In contrast to classic mixer tools this one allows +you to control both the volume of hardware devices and of each +playback stream seperately.</p> + +<p>Everybody loves <a href="@PACKAGE_URL@/screenshot.png">screenshots</a>.</p> + +<h2><a name="status">Current Status</a></h2> + +<p>Works perfectly.</p> + +<h2><a name="documentation">Documentation</a></h2> + +<p>There is not much to say. Just run <tt>paprefs</tt> and see for yourself.</p> + +<h2><a name="requirements">Requirements</a></h2> + +<p>Currently, <tt>paprefs</tt> is tested on Linux only.</p> + +<p><tt>paprefs</tt> was developed and tested on Debian GNU/Linux +"testing" from April 2006, it should work on most other Linux +distributions (and maybe Unix versions) since it uses GNU autoconf for +source code configuration.</p> + +<p><tt>paprefs</tt> requires <a href="http://gtkmm.sf.net/"><tt>gtkmm</tt></a> and <tt>glademmm</tt> installed.</p> + +<p>Obviously <tt>paprefs</tt> requires an installation of <a href="http://pulseaudio.org/">PulseAudio</a> (version 0.9.x).</p> + +<h2><a name="installation">Installation</a></h2> + +<p>As this package is made with the GNU autotools you should run +<tt>./configure</tt> inside the distribution directory for configuring +the source tree. After that you should run <tt>make</tt> for +compilation and <tt>make install</tt> (as root) for installation of +<tt>paprefs</tt>.</p> + +<h2><a name="acks">Acknowledgements</a></h2> + +<p>None so far.</p> + +<h2><a name="download">Download</a></h2> + +<p>The newest release is always available from <a href="@PACKAGE_URL@">@PACKAGE_URL@</a></p> + +<p>The current release is <a href="@PACKAGE_URL@paprefs-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p> + +<p>Get <tt>paprefs</tt>'s development sources from the <a href="http://subversion.tigris.org/">Subversion</a> <a href="svn://svn.0pointer.net/paprefs">repository</a> (<a href="http://0pointer.net/cgi-bin/viewcvs.cgi/?root=paprefs">viewcvs</a>): </p> + +<pre>svn checkout svn://svn.0pointer.net/paprefs/trunk paprefs</pre> + +<p>If you want to be notified whenever I release a new version of this software use the subscription feature of <a href="http://freshmeat.net/projects/paprefs/">Freshmeat</a>.</p> + +<hr/> +<address class="grey">Lennart Poettering <@PACKAGE_BUGREPORT@>, July 2006</address> +<div class="grey"><i>$Id$</i></div> + +</body> +</html> diff --git a/doc/style.css b/doc/style.css new file mode 100644 index 0000000..2d7ba67 --- /dev/null +++ b/doc/style.css @@ -0,0 +1,27 @@ +/* $Id$ */ + +/*** + * This file is part of paprefs. + * + * paprefs is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * paprefs is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with paprefs; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + ***/ + +body { color: black; background-color: white; } +a:link, a:visited { color: #900000; } +div.news-date { font-size: 80%; font-style: italic; } +pre { background-color: #f0f0f0; padding: 0.4cm; } +.grey { color: #8f8f8f; font-size: 80%; } +table { margin-left: 1cm; border:1px solid lightgrey; padding: 0.2cm; } +td { padding-left:10px; padding-right:10px; } diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..6a54d31 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,31 @@ +# $Id$ +# +# This file is part of paprefs. +# +# paprefs is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# paprefs is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with paprefs; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +desktopdir = $(datadir)/applications + +bin_PROGRAMS=paprefs + +dist_pkgdata_DATA=paprefs.glade +dist_desktop_DATA=paprefs.desktop + +paprefs_SOURCES=paprefs.cc + +paprefs_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) +paprefs_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) +paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(pkgdatadir)/paprefs.glade\" diff --git a/src/paprefs.cc b/src/paprefs.cc new file mode 100644 index 0000000..8f59404 --- /dev/null +++ b/src/paprefs.cc @@ -0,0 +1,316 @@ +/* $Id$ */ + +/*** + This file is part of paprefs. + + paprefs is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + paprefs is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with paprefs; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <signal.h> + +#include <gtkmm.h> +#include <libglademm.h> +#include <gconfmm.h> + +#define PA_GCONF_ROOT "/system/pulseaudio" +#define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules" + +class MainWindow : public Gtk::Window { +public: + MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); + static MainWindow* create(); + + Gtk::EventBox *titleEventBox; + Gtk::Button *closeButton; + + Gtk::CheckButton + *remoteAccessCheckButton, + *zeroconfCheckButton, + *anonymousAuthCheckButton, + *rtpReceiveCheckButton, + *rtpSendCheckButton, + *rtpLoopbackCheckButton; + + Gtk::RadioButton + *rtpMikeRadioButton, + *rtpSpeakerRadioButton, + *rtpNullSinkRadioButton; + + Glib::RefPtr<Gnome::Conf::Client> gconf; + + bool ignoreChanges; + + void onCloseButtonClicked(); + void updateSensitive(); + void onChangeRemoteAccess(); + void onChangeRtpReceive(); + void onChangeRtpSend(); + void readFromGConf(); + void writeToGConfRemoteAccess(); + void writeToGConfRtpReceive(); + void writeToGConfRtpSend(); + void onGConfChange(const Glib::ustring& key, const Gnome::Conf::Value& value); +}; + +MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : + Gtk::Window(cobject), ignoreChanges(true) { + + x->get_widget("titleEventBox", titleEventBox); + x->get_widget("closeButton", closeButton); + + x->get_widget("remoteAccessCheckButton", remoteAccessCheckButton); + x->get_widget("zeroconfCheckButton", zeroconfCheckButton); + x->get_widget("anonymousAuthCheckButton", anonymousAuthCheckButton); + x->get_widget("rtpReceiveCheckButton", rtpReceiveCheckButton); + x->get_widget("rtpSendCheckButton", rtpSendCheckButton); + x->get_widget("rtpLoopbackCheckButton", rtpLoopbackCheckButton); + + x->get_widget("rtpMikeRadioButton", rtpMikeRadioButton); + x->get_widget("rtpSpeakerRadioButton", rtpSpeakerRadioButton); + x->get_widget("rtpNullSinkRadioButton", rtpNullSinkRadioButton); + + Gdk::Color c("white"); + titleEventBox->modify_bg(Gtk::STATE_NORMAL, c); + + 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); + + gconf->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::onGConfChange)); + readFromGConf(); + + closeButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onCloseButtonClicked)); + + remoteAccessCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRemoteAccess)); + zeroconfCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRemoteAccess)); + anonymousAuthCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRemoteAccess)); + + rtpReceiveCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpReceive)); + + rtpSendCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend)); + rtpLoopbackCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend)); + rtpMikeRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend)); + rtpSpeakerRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend)); + rtpNullSinkRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend)); +} + +MainWindow* MainWindow::create() { + MainWindow* w; + Glib::RefPtr<Gnome::Glade::Xml> x = Gnome::Glade::Xml::create(GLADE_FILE, "mainWindow"); + x->get_widget_derived("mainWindow", w); + return w; +} + +void MainWindow::onCloseButtonClicked() { + Gtk::Main::quit(); +} + +void MainWindow::updateSensitive() { + bool b; + + b = remoteAccessCheckButton->get_active(); + zeroconfCheckButton->set_sensitive(b); + anonymousAuthCheckButton->set_sensitive(b); + + b = rtpSendCheckButton->get_active(); + rtpLoopbackCheckButton->set_sensitive(b && !rtpSpeakerRadioButton->get_active()); + rtpMikeRadioButton->set_sensitive(b); + rtpSpeakerRadioButton->set_sensitive(b); + rtpNullSinkRadioButton->set_sensitive(b); +} + +void MainWindow::onChangeRemoteAccess() { + + if (ignoreChanges) + return; + + updateSensitive(); + writeToGConfRemoteAccess(); +} + +void MainWindow::onChangeRtpReceive() { + if (ignoreChanges) + return; + + updateSensitive(); + writeToGConfRtpReceive(); + writeToGConfRtpSend(); +} + +void MainWindow::onChangeRtpSend() { + if (ignoreChanges) + return; + + updateSensitive(); + writeToGConfRtpSend(); +} + +void MainWindow::writeToGConfRemoteAccess() { + Gnome::Conf::ChangeSet changeSet; + bool zeroconfEnabled, anonymousEnabled; + + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/locked", true); + gconf->change_set_commit(changeSet, true); + + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/zeroconf_enabled", zeroconfEnabled = zeroconfCheckButton->get_active()); + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/anonymous_enabled", anonymousEnabled = anonymousAuthCheckButton->get_active()); + + if (remoteAccessCheckButton->get_active()) { + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/name0", Glib::ustring("module-native-protocol-tcp")); + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/name1", Glib::ustring("module-esound-protocol-tcp")); + + if (anonymousEnabled) { + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/args0", Glib::ustring("auth-anonymous=1")); + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/args1", Glib::ustring("auth-anonymous=1")); + } else { + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/args0", Glib::ustring("")); + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/args1", Glib::ustring("")); + } + + if (zeroconfEnabled) { + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/name2", Glib::ustring("module-zeroconf-publish")); + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/args2", Glib::ustring("")); + } else { + changeSet.unset(PA_GCONF_PATH_MODULES"/remote-access/name2"); + changeSet.unset(PA_GCONF_PATH_MODULES"/remote-access/args2"); + } + + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/enabled", true); + } else + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/enabled", false); + + gconf->change_set_commit(changeSet, true); + + changeSet.set(PA_GCONF_PATH_MODULES"/remote-access/locked", false); + gconf->change_set_commit(changeSet, true); + + gconf->suggest_sync(); +} + +void MainWindow::writeToGConfRtpReceive() { + Gnome::Conf::ChangeSet changeSet; + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/locked", true); + gconf->change_set_commit(changeSet, true); + + if (rtpReceiveCheckButton->get_active()) { + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/name0", Glib::ustring("module-rtp-recv")); + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/args0", Glib::ustring("")); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/enabled", true); + } else + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/enabled", false); + + gconf->change_set_commit(changeSet, true); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-recv/locked", false); + gconf->change_set_commit(changeSet, true); + + gconf->suggest_sync(); +} + +void MainWindow::writeToGConfRtpSend() { + Gnome::Conf::ChangeSet changeSet; + bool loopbackEnabled, mikeEnabled, speakerEnabled = false; + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/locked", true); + gconf->change_set_commit(changeSet, true); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/loopback_enabled", loopbackEnabled = rtpLoopbackCheckButton->get_active()); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/mode", Glib::ustring( + (mikeEnabled = rtpMikeRadioButton->get_active()) ? "microphone" : + ((speakerEnabled = rtpSpeakerRadioButton->get_active()) ? "speaker" : "null-sink"))); + + if (rtpSendCheckButton->get_active()) { + if (!mikeEnabled && !speakerEnabled) { + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/name0", Glib::ustring("module-null-sink")); + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args0", Glib::ustring("sink_name=rtp format=s16be channels=2 rate=44100")); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/name1", Glib::ustring("module-rtp-send")); + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args1", Glib::ustring(loopbackEnabled ? "source=rtp_monitor loop=1" : "source=rtp_monitor loop=0")); + } else { + char tmp[256]; + + snprintf(tmp, sizeof(tmp), "%s %s", + mikeEnabled ? "source=@DEFAULT_SOURCE@" : "source=@DEFAULT_MONITOR@", + mikeEnabled && loopbackEnabled ? "loop=1" : "loop=0"); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/name0", Glib::ustring("module-rtp-send")); + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args0", Glib::ustring(tmp)); + + changeSet.unset(PA_GCONF_PATH_MODULES"/rtp-send/name1"); + changeSet.unset(PA_GCONF_PATH_MODULES"/rtp-send/args1"); + } + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/enabled", true); + } else + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/enabled", false); + + gconf->change_set_commit(changeSet, true); + + changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/locked", false); + gconf->change_set_commit(changeSet, true); + + gconf->suggest_sync(); +} + +void MainWindow::onGConfChange(const Glib::ustring&, const Gnome::Conf::Value&) { + readFromGConf(); +} + +void MainWindow::readFromGConf() { + Glib::ustring mode; + + ignoreChanges = TRUE; + + remoteAccessCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/remote-access/enabled")); + zeroconfCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/remote-access/zeroconf_enabled")); + anonymousAuthCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/remote-access/anonymous_enabled")); + + rtpReceiveCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-recv/enabled")); + + rtpSendCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-send/enabled")); + rtpLoopbackCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-send/loopback_enabled")); + + mode = gconf->get_string(PA_GCONF_PATH_MODULES"/rtp-send/mode"); + if (mode == "microphone") + rtpMikeRadioButton->set_active(TRUE); + else if (mode == "speaker") + rtpSpeakerRadioButton->set_active(TRUE); + else + rtpNullSinkRadioButton->set_active(TRUE); + + ignoreChanges = FALSE; + + updateSensitive(); +} + +int main(int argc, char *argv[]) { + signal(SIGPIPE, SIG_IGN); + Gtk::Main kit(argc, argv); + + Gnome::Conf::init(); + + Gtk::Window* mainWindow = MainWindow::create(); + + Gtk::Main::run(*mainWindow); + delete mainWindow; +} diff --git a/src/paprefs.desktop b/src/paprefs.desktop new file mode 100644 index 0000000..7de90fb --- /dev/null +++ b/src/paprefs.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=PulseAudio Preferences +GenericName=Sound server Preferences +Comment=View and modify the configuration of the local sound server +Exec=paprefs +Icon=preferences-desktop +StartupNotify=true +Type=Application +Categories=Application;AudioVideo;Audio; diff --git a/src/paprefs.glade b/src/paprefs.glade new file mode 100644 index 0000000..77f9bba --- /dev/null +++ b/src/paprefs.glade @@ -0,0 +1,532 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="mainWindow"> + <property name="title" translatable="yes">PulseAudio Preferences</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="icon_name">preferences-desktop</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkVBox" id="vbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkEventBox" id="titleEventBox"> + <property name="visible">True</property> + <property name="visible_window">True</property> + <property name="above_child">False</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkImage" id="image19"> + <property name="visible">True</property> + <property name="icon_size">6</property> + <property name="icon_name">preferences-desktop</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox22"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="titleLabel"> + <property name="visible">True</property> + <property name="label" translatable="yes"><span size="18000" color="black"><b>PulseAudio Preferences</b></span></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">1</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label4825"> + <property name="visible">True</property> + <property name="label" translatable="yes">View and modify the configuration of the local sound server</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator1"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox20"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkVBox" id="vbox32"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label4829"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Network Access</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox30"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkCheckButton" id="remoteAccessCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable _network access to local sound devices</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="zeroconfCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Allow other machines in LAN to _browse for local sound devices</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="anonymousAuthCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Don't require _authentication</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label4830"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Multicast/RTP</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox31"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkCheckButton" id="rtpReceiveCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable Multicast/RTP _receiver</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="rtpSendCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable Multicast/RTP _sender</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkRadioButton" id="rtpMikeRadioButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Send audio from local _microphone</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkRadioButton" id="rtpSpeakerRadioButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Send audio from local s_peakers</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">rtpMikeRadioButton</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkRadioButton" id="rtpNullSinkRadioButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Create seperate audio _device for Multicast/RTP</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">rtpMikeRadioButton</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment6"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">24</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="rtpLoopbackCheckButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Loopback audio to local speakers</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHButtonBox" id="hbuttonbox1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkButton" id="closeButton"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-close</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> |