summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-10-29 21:18:29 +0000
committerLennart Poettering <lennart@poettering.net>2007-10-29 21:18:29 +0000
commit6295cd95c95b29c17c34cae47e0e212f7e6e54d3 (patch)
tree807fbee543ef90bc98689bede246c21fbc2591a7 /src
parentf14e0ffa4697077b7d57ac510f6c83fad6aeb665 (diff)
add new option to toggle zeroconf discovery
git-svn-id: file:///home/lennart/svn/public/paprefs/trunk@30 54a58c19-9419-0410-9bbb-d8fa3e5d54ff
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am7
-rw-r--r--src/paprefs.cc120
-rw-r--r--src/paprefs.glade32
3 files changed, 106 insertions, 53 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f304f2d..761c5d4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,14 +26,15 @@ localedir = $(datadir)/locale
bin_PROGRAMS=paprefs
glade_DATA=paprefs.glade
-desktop_in_files=paprefs.desktop.in
-desktop_DATA=$(desktop_in_files:.desktop.in=.desktop)
+desktop_in_files=paprefs.desktop.in
+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=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS)
paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" -DMODULESDIR=\""${libdir}/pulse-0.9/modules/"\" -DSHREXT=\"$(SHREXT)\"
+#paprefs_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/paprefs.glade\" -DLOCALEDIR=\"$(localedir)\" -DMODULESDIR=\""/usr/local/lib/pulse-0.9/modules/"\" -DSHREXT=\"$(SHREXT)\"
EXTRA_DIST = $(glade_DATA) $(desktop_in_files)
diff --git a/src/paprefs.cc b/src/paprefs.cc
index b671671..55fd0b5 100644
--- a/src/paprefs.cc
+++ b/src/paprefs.cc
@@ -2,17 +2,17 @@
/***
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
@@ -42,7 +42,8 @@ public:
Gtk::CheckButton
*remoteAccessCheckButton,
- *zeroconfCheckButton,
+ *zeroconfPublishCheckButton,
+ *zeroconfDiscoverCheckButton,
*anonymousAuthCheckButton,
*rtpReceiveCheckButton,
*rtpSendCheckButton,
@@ -57,22 +58,24 @@ public:
Glib::RefPtr<Gnome::Conf::Client> gconf;
bool ignoreChanges;
-
+
void onCloseButtonClicked();
void updateSensitive();
void onChangeRemoteAccess();
+ void onChangeZeroconfDiscover();
void onChangeRtpReceive();
void onChangeRtpSend();
void onChangeCombine();
void readFromGConf();
void checkForModules();
void writeToGConfRemoteAccess();
+ void writeToGConfZeroconfDiscover();
void writeToGConfRtpReceive();
void writeToGConfRtpSend();
void writeToGConfCombine();
void onGConfChange(const Glib::ustring& key, const Gnome::Conf::Value& value);
- bool rtpRecvAvailable, rtpSendAvailable, zeroconfAvailable, remoteAvailable;
+ bool rtpRecvAvailable, rtpSendAvailable, zeroconfPublishAvailable, zeroconfDiscoverAvailable, remoteAvailable;
};
MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
@@ -82,13 +85,14 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
x->get_widget("closeButton", closeButton);
x->get_widget("remoteAccessCheckButton", remoteAccessCheckButton);
- x->get_widget("zeroconfCheckButton", zeroconfCheckButton);
+ x->get_widget("zeroconfDiscoverCheckButton", zeroconfDiscoverCheckButton);
+ x->get_widget("zeroconfBrowseCheckButton", zeroconfPublishCheckButton);
x->get_widget("anonymousAuthCheckButton", anonymousAuthCheckButton);
x->get_widget("rtpReceiveCheckButton", rtpReceiveCheckButton);
x->get_widget("rtpSendCheckButton", rtpSendCheckButton);
x->get_widget("rtpLoopbackCheckButton", rtpLoopbackCheckButton);
x->get_widget("combineCheckButton", combineCheckButton);
-
+
x->get_widget("rtpMikeRadioButton", rtpMikeRadioButton);
x->get_widget("rtpSpeakerRadioButton", rtpSpeakerRadioButton);
x->get_widget("rtpNullSinkRadioButton", rtpNullSinkRadioButton);
@@ -97,7 +101,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
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);
@@ -106,13 +110,15 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
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));
+ zeroconfPublishCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRemoteAccess));
anonymousAuthCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRemoteAccess));
+ zeroconfDiscoverCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeZeroconfDiscover));
+
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));
@@ -138,9 +144,11 @@ void MainWindow::updateSensitive() {
remoteAccessCheckButton->set_sensitive(remoteAvailable);
b = remoteAccessCheckButton->get_active();
- zeroconfCheckButton->set_sensitive(b && zeroconfAvailable);
+ zeroconfPublishCheckButton->set_sensitive(b && zeroconfPublishAvailable);
anonymousAuthCheckButton->set_sensitive(b && remoteAvailable);
+ zeroconfDiscoverCheckButton->set_sensitive(zeroconfDiscoverAvailable);
+
rtpReceiveCheckButton->set_sensitive(rtpRecvAvailable);
rtpSendCheckButton->set_sensitive(rtpSendAvailable);
b = rtpSendCheckButton->get_active();
@@ -154,15 +162,24 @@ void MainWindow::onChangeRemoteAccess() {
if (ignoreChanges)
return;
-
+
updateSensitive();
writeToGConfRemoteAccess();
}
+void MainWindow::onChangeZeroconfDiscover() {
+
+ if (ignoreChanges)
+ return;
+
+ updateSensitive();
+ writeToGConfZeroconfDiscover();
+}
+
void MainWindow::onChangeRtpReceive() {
if (ignoreChanges)
return;
-
+
updateSensitive();
writeToGConfRtpReceive();
writeToGConfRtpSend();
@@ -171,7 +188,7 @@ void MainWindow::onChangeRtpReceive() {
void MainWindow::onChangeRtpSend() {
if (ignoreChanges)
return;
-
+
updateSensitive();
writeToGConfRtpSend();
}
@@ -189,7 +206,7 @@ void MainWindow::writeToGConfCombine() {
Gnome::Conf::ChangeSet changeSet;
changeSet.set(PA_GCONF_PATH_MODULES"/combine/locked", true);
gconf->change_set_commit(changeSet, true);
-
+
if (combineCheckButton->get_active()) {
changeSet.set(PA_GCONF_PATH_MODULES"/combine/name0", Glib::ustring("module-combine"));
changeSet.set(PA_GCONF_PATH_MODULES"/combine/args0", Glib::ustring(""));
@@ -213,9 +230,9 @@ void MainWindow::writeToGConfRemoteAccess() {
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/zeroconf_enabled", zeroconfEnabled = zeroconfPublishCheckButton->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"));
@@ -248,6 +265,28 @@ void MainWindow::writeToGConfRemoteAccess() {
gconf->suggest_sync();
}
+void MainWindow::writeToGConfZeroconfDiscover() {
+ Gnome::Conf::ChangeSet changeSet;
+
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/locked", true);
+ gconf->change_set_commit(changeSet, true);
+
+ if (zeroconfDiscoverCheckButton->get_active()) {
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/name0", Glib::ustring("module-zeroconf-discover"));
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/args0", Glib::ustring(""));
+
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/enabled", true);
+ } else
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/enabled", false);
+
+ gconf->change_set_commit(changeSet, true);
+
+ changeSet.set(PA_GCONF_PATH_MODULES"/zeroconf-discover/locked", false);
+ gconf->change_set_commit(changeSet, true);
+
+ gconf->suggest_sync();
+}
+
void MainWindow::writeToGConfRtpReceive() {
Gnome::Conf::ChangeSet changeSet;
@@ -257,11 +296,11 @@ void MainWindow::writeToGConfRtpReceive() {
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);
@@ -282,7 +321,7 @@ void MainWindow::writeToGConfRtpSend() {
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"));
@@ -296,18 +335,18 @@ void MainWindow::writeToGConfRtpSend() {
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);
@@ -317,18 +356,20 @@ void MainWindow::writeToGConfRtpSend() {
}
void MainWindow::onGConfChange(const Glib::ustring&, const Gnome::Conf::Value&) {
- readFromGConf();
+ 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"));
+ zeroconfPublishCheckButton->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"));
-
+
+ zeroconfDiscoverCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/zeroconf-discover/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"));
@@ -343,7 +384,7 @@ void MainWindow::readFromGConf() {
rtpNullSinkRadioButton->set_active(TRUE);
combineCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/combine/enabled"));
-
+
ignoreChanges = FALSE;
updateSensitive();
@@ -354,8 +395,9 @@ 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;
+
+ zeroconfPublishAvailable = access(MODULESDIR "module-zeroconf-publish" SHREXT, F_OK) == 0;
+ zeroconfDiscoverAvailable = access(MODULESDIR "module-zeroconf-discover" SHREXT, F_OK) == 0;
rtpRecvAvailable = access(MODULESDIR "module-rtp-recv" SHREXT, F_OK) == 0;
rtpSendAvailable = access(MODULESDIR "module-rtp-send" SHREXT, F_OK) == 0;
@@ -363,19 +405,19 @@ void MainWindow::checkForModules() {
int main(int argc, char *argv[]) {
- /* Initialize the i18n stuff */
- bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
- textdomain(GETTEXT_PACKAGE);
-
+ /* Initialize the i18n stuff */
+ bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+
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.glade b/src/paprefs.glade
index 666ebd6..0e9b50b 100644
--- a/src/paprefs.glade
+++ b/src/paprefs.glade
@@ -114,10 +114,10 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton" id="zeroconfCheckButton">
+ <widget class="GtkCheckButton" id="zeroconfBrowseCheckButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Allow other machines on LAN to _browse for local sound devices</property>
+ <property name="label" translatable="yes">Allow other machines on the LAN to _discover local sound devices</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
@@ -146,13 +146,28 @@
</child>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="zeroconfDiscoverCheckButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">_Make discoverable network sound devices available locally</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="tab_expand">False</property>
- </packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
@@ -163,7 +178,6 @@
</widget>
<packing>
<property name="type">tab</property>
- <property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -280,7 +294,6 @@
</widget>
<packing>
<property name="position">1</property>
- <property name="tab_expand">False</property>
</packing>
</child>
<child>
@@ -293,7 +306,6 @@
<packing>
<property name="type">tab</property>
<property name="position">1</property>
- <property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -306,7 +318,7 @@
<widget class="GtkCheckButton" id="combineCheckButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Add _virtual output device for simultaneous output on all sound cards</property>
+ <property name="label" translatable="yes">Add _virtual output device for simultaneous output on all local sound cards</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
@@ -319,7 +331,6 @@
</widget>
<packing>
<property name="position">2</property>
- <property name="tab_expand">False</property>
</packing>
</child>
<child>
@@ -332,7 +343,6 @@
<packing>
<property name="type">tab</property>
<property name="position">2</property>
- <property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>