Merge branch 'master' of git://git.0pointer.de/pavucontrol

This commit is contained in:
Diego 'Flameeyes' Pettenò 2008-08-26 19:43:03 +02:00
commit 1e5ac41308
7 changed files with 468 additions and 60 deletions

View File

@ -38,7 +38,7 @@ AC_PROG_LN_S
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_HEADER_STDC AC_HEADER_STDC
PKG_CHECK_MODULES(GUILIBS, [ gtkmm-2.4 libglademm-2.4 sigc++-2.0 ]) PKG_CHECK_MODULES(GUILIBS, [ gtkmm-2.4 libglademm-2.4 sigc++-2.0 libcanberra-gtk ])
AC_SUBST(GUILIBS_CFLAGS) AC_SUBST(GUILIBS_CFLAGS)
AC_SUBST(GUILIBS_LIBS) AC_SUBST(GUILIBS_LIBS)

2
po/.gitignore vendored
View File

@ -10,3 +10,5 @@ insert-header.sin
pavucontrol.pot pavucontrol.pot
quot.sed quot.sed
remove-potcdate.sin remove-potcdate.sin
*.gmo
*.mo

1
po/LINGUAS Normal file
View File

@ -0,0 +1 @@
de

298
po/de.po Normal file
View File

@ -0,0 +1,298 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-08-05 20:39+0200\n"
"PO-Revision-Date: 2008-08-05 20:49+0100\n"
"Last-Translator: Lennart Poettering <lennart@poettering.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/pavucontrol.desktop.in.h:1
msgid "Adjust the volume level"
msgstr "Lautstärke anpassen"
#: ../src/pavucontrol.desktop.in.h:2
#: ../src/pavucontrol.cc:1966
msgid "PulseAudio Volume Control"
msgstr "PulseAudio Lautstärkeregler"
#: ../src/pavucontrol.desktop.in.h:3
#: ../src/pavucontrol.glade.h:27
msgid "Volume Control"
msgstr "Lautstärkeregler"
#: ../src/pavucontrol.glade.h:2
#, no-c-format
msgid "50%"
msgstr ""
#: ../src/pavucontrol.glade.h:3
msgid "<b>S_how:</b>"
msgstr ""
#: ../src/pavucontrol.glade.h:4
msgid "<b>Sho_w:</b>"
msgstr ""
#: ../src/pavucontrol.glade.h:5
msgid "<b>_Show:</b>"
msgstr ""
#: ../src/pavucontrol.glade.h:6
msgid "<b>left-front</b>"
msgstr ""
#: ../src/pavucontrol.glade.h:7
msgid "<i>No application is currently playing audio.</i>"
msgstr "<i>Keine Applikation gibt zur Zeit Ton wieder.</i>"
#: ../src/pavucontrol.glade.h:8
msgid "<i>No application is currently recording audio.</i>"
msgstr "<i>Keine Applikation nimmt zur Zeit Ton auf.</i>"
#: ../src/pavucontrol.glade.h:9
msgid "<i>No input devices available</i>"
msgstr "<i>Keine Eingabegeräte verfügbar.</i>"
#: ../src/pavucontrol.glade.h:10
msgid "<i>No output devices available</i>"
msgstr "<i>Keine Ausgabegeräte verfügbar</i>"
#: ../src/pavucontrol.glade.h:11
msgid ""
"All Input Devices\n"
"All Except Monitors\n"
"Hardware Input Devices\n"
"Virtual Input Devices\n"
"Monitors"
msgstr ""
#: ../src/pavucontrol.glade.h:16
msgid ""
"All Output Devices\n"
"Hardware Output Devices\n"
"Virtual Output Devices"
msgstr ""
#. Applications All streams
#: ../src/pavucontrol.glade.h:20
msgid ""
"All Streams\n"
"Applications\n"
"Virtual Streams"
msgstr ""
#: ../src/pavucontrol.glade.h:23
msgid "Lock channels together"
msgstr ""
#: ../src/pavucontrol.glade.h:24
msgid "Mute audio"
msgstr ""
#: ../src/pavucontrol.glade.h:25
msgid "Open menu"
msgstr ""
#: ../src/pavucontrol.glade.h:26
msgid "Stream Title"
msgstr ""
#: ../src/pavucontrol.glade.h:28
msgid "_Input Devices"
msgstr "_Eingabegeräte"
#: ../src/pavucontrol.glade.h:29
msgid "_Output Devices"
msgstr "_Ausgabegeräte"
#: ../src/pavucontrol.glade.h:30
msgid "_Playback"
msgstr "_Wiedergabe"
#: ../src/pavucontrol.glade.h:31
msgid "_Recording"
msgstr "_Aufnahme"
#: ../src/pavucontrol.cc:606
msgid "pa_context_set_sink_volume_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:621
msgid "pa_context_set_sink_mute_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:635
msgid "pa_context_set_default_sink() failed"
msgstr ""
#: ../src/pavucontrol.cc:643
msgid "_Default"
msgstr ""
#: ../src/pavucontrol.cc:664
msgid "pa_context_set_source_volume_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:679
msgid "pa_context_set_source_mute_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:693
msgid "pa_context_set_default_source() failed"
msgstr ""
#: ../src/pavucontrol.cc:702
#: ../src/pavucontrol.cc:805
msgid "_Move Stream..."
msgstr "_Verschiebe Strom..."
#: ../src/pavucontrol.cc:703
#: ../src/pavucontrol.cc:806
msgid "_Terminate Stream"
msgstr "_Beende Strom"
#: ../src/pavucontrol.cc:729
msgid "pa_context_set_sink_input_volume() failed"
msgstr ""
#: ../src/pavucontrol.cc:744
msgid "pa_context_set_sink_input_mute() failed"
msgstr ""
#: ../src/pavucontrol.cc:778
msgid "pa_context_kill_sink_input() failed"
msgstr ""
#: ../src/pavucontrol.cc:795
msgid "pa_context_move_sink_input_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:831
msgid "pa_context_kill_source_output() failed"
msgstr ""
#: ../src/pavucontrol.cc:872
msgid "pa_context_move_source_output_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:914
msgid "pa_ext_stream_restore_write() failed"
msgstr ""
#: ../src/pavucontrol.cc:1035
msgid "Failed to read data from stream"
msgstr ""
#: ../src/pavucontrol.cc:1069
#: ../src/pavucontrol.cc:1105
msgid "Peak detect"
msgstr ""
#: ../src/pavucontrol.cc:1070
#: ../src/pavucontrol.cc:1106
msgid "Failed to create monitoring stream"
msgstr ""
#: ../src/pavucontrol.cc:1078
#: ../src/pavucontrol.cc:1115
msgid "Failed to connect monitoring stream"
msgstr ""
#: ../src/pavucontrol.cc:1355
msgid "System Sounds"
msgstr ""
#: ../src/pavucontrol.cc:1634
msgid "Sink callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1650
msgid "Source callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1666
msgid "Sink input callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1682
msgid "Source output callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1713
msgid "Client callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1729
msgid "Server info callback failure"
msgstr ""
#: ../src/pavucontrol.cc:1746
#: ../src/pavucontrol.cc:1931
#, c-format
msgid "Failed to initialized stream_restore extension: %s"
msgstr ""
#: ../src/pavucontrol.cc:1766
msgid "pa_ext_stream_restore_read() failed"
msgstr ""
#: ../src/pavucontrol.cc:1783
msgid "pa_context_get_sink_info_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:1796
msgid "pa_context_get_source_info_by_index() failed"
msgstr ""
#: ../src/pavucontrol.cc:1809
#: ../src/pavucontrol.cc:1822
msgid "pa_context_get_sink_input_info() failed"
msgstr ""
#: ../src/pavucontrol.cc:1835
msgid "pa_context_get_client_info() failed"
msgstr ""
#: ../src/pavucontrol.cc:1845
#: ../src/pavucontrol.cc:1883
msgid "pa_context_get_server_info() failed"
msgstr ""
#: ../src/pavucontrol.cc:1877
msgid "pa_context_subscribe() failed"
msgstr ""
#: ../src/pavucontrol.cc:1889
msgid "pa_context_client_info_list() failed"
msgstr ""
#: ../src/pavucontrol.cc:1895
msgid "pa_context_get_sink_info_list() failed"
msgstr ""
#: ../src/pavucontrol.cc:1901
msgid "pa_context_get_source_info_list() failed"
msgstr ""
#: ../src/pavucontrol.cc:1907
msgid "pa_context_get_sink_input_info_list() failed"
msgstr ""
#: ../src/pavucontrol.cc:1913
msgid "pa_context_get_source_output_info_list() failed"
msgstr ""
#: ../src/pavucontrol.cc:1937
#: ../src/pavucontrol.cc:1979
msgid "Connection failed"
msgstr "Verbindung fehlgeschlagen"

View File

@ -24,10 +24,10 @@ glade_DATA=pavucontrol.glade
desktop_in_files=pavucontrol.desktop.in desktop_in_files=pavucontrol.desktop.in
desktop_DATA=$(desktop_in_files:.desktop.in=.desktop) desktop_DATA=$(desktop_in_files:.desktop.in=.desktop)
pavucontrol_SOURCES=pavucontrol.cc pavucontrol_SOURCES=pavucontrol.cc i18n.h
pavucontrol_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) $(PULSE_LIBS) pavucontrol_LDADD=$(AM_LDADD) $(GUILIBS_LIBS) $(PULSE_LIBS)
pavucontrol_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) $(PULSE_CFLAGS) pavucontrol_CXXFLAGS=$(AM_CXXFLAGS) $(GUILIBS_CFLAGS) $(PULSE_CFLAGS) -DLOCALEDIR=\"$(localedir)\"
pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/pavucontrol.glade\" pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"$(gladedir)/pavucontrol.glade\"
#pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"pavucontrol.glade\" #pavucontrol_CXXFLAGS+=-DGLADE_FILE=\"pavucontrol.glade\"

51
src/i18n.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef fooi18nhfoo
#define fooi18nhfoo
/***
This file is part of pavucontrol.
Copyright 2006-2008 Lennart Poettering
pavucontrol 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.
pavucontrol 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 pavucontrol. If not, see <http://www.gnu.org/licenses/>.
***/
#if !defined(GETTEXT_PACKAGE)
#error "Something is very wrong here, config.h needs to be included first"
#endif
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(String) dgettext(GETTEXT_PACKAGE, String)
#ifdef gettext_noop
#define N_(String) gettext_noop(String)
#else
#define N_(String) (String)
#endif
#else /* NLS is disabled */
#define _(String) (String)
#define N_(String) (String)
#define textdomain(String) (String)
#define gettext(String) (String)
#define dgettext(Domain,String) (String)
#define dcgettext(Domain,String,Type) (String)
#define bindtextdomain(Domain,Directory) (Domain)
#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
#endif /* ENABLE_NLS */
#endif

View File

@ -27,11 +27,16 @@
#include <gtkmm.h> #include <gtkmm.h>
#include <libglademm.h> #include <libglademm.h>
#include <libintl.h>
#include <canberra-gtk.h>
#include <pulse/pulseaudio.h> #include <pulse/pulseaudio.h>
#include <pulse/glib-mainloop.h> #include <pulse/glib-mainloop.h>
#include <pulse/ext-stream-restore.h> #include <pulse/ext-stream-restore.h>
#include "i18n.h"
#ifndef GLADE_FILE #ifndef GLADE_FILE
#define GLADE_FILE "pavucontrol.glade" #define GLADE_FILE "pavucontrol.glade"
#endif #endif
@ -88,6 +93,8 @@ public:
bool can_decibel; bool can_decibel;
bool volumeScaleEnabled; bool volumeScaleEnabled;
Glib::ustring beepDevice;
virtual void set_sensitive(bool enabled); virtual void set_sensitive(bool enabled);
}; };
@ -115,6 +122,8 @@ public:
void enableVolumeMeter(); void enableVolumeMeter();
void updatePeak(double v); void updatePeak(double v);
Glib::ustring beepDevice;
protected: protected:
virtual bool on_button_press_event(GdkEventButton* event); virtual bool on_button_press_event(GdkEventButton* event);
}; };
@ -373,13 +382,15 @@ void ChannelWidget::setVolume(pa_volume_t volume) {
if (dB > PA_DECIBEL_MININFTY) { if (dB > PA_DECIBEL_MININFTY) {
snprintf(txt, sizeof(txt), "%0.2f dB", dB); snprintf(txt, sizeof(txt), "%0.2f dB", dB);
volumeLabel->set_text(txt); volumeLabel->set_tooltip_text(txt);
} else } else
volumeLabel->set_markup("-&#8734;dB"); volumeLabel->set_tooltip_markup("-&#8734;dB");
} else { volumeLabel->set_has_tooltip(TRUE);
} else
volumeLabel->set_has_tooltip(FALSE);
snprintf(txt, sizeof(txt), "%0.0f%%", v); snprintf(txt, sizeof(txt), "%0.0f%%", v);
volumeLabel->set_text(txt); volumeLabel->set_text(txt);
}
volumeScaleEnabled = false; volumeScaleEnabled = false;
volumeScale->set_value(v > 100 ? 100 : v); volumeScale->set_value(v > 100 ? 100 : v);
@ -396,6 +407,26 @@ void ChannelWidget::onVolumeScaleValueChanged() {
pa_volume_t volume = (pa_volume_t) ((volumeScale->get_value() * PA_VOLUME_NORM) / 100); pa_volume_t volume = (pa_volume_t) ((volumeScale->get_value() * PA_VOLUME_NORM) / 100);
streamWidget->updateChannelVolume(channel, volume); streamWidget->updateChannelVolume(channel, volume);
if (beepDevice != "") {
g_debug("blah: %s", beepDevice.c_str());
ca_context_change_device(ca_gtk_context_get(), beepDevice.c_str());
ca_context_cancel(ca_gtk_context_get(), 2);
int r = ca_gtk_play_for_widget(GTK_WIDGET(volumeScale->gobj()),
2,
CA_PROP_EVENT_DESCRIPTION, _("Volume Control Feedback Sound"),
CA_PROP_EVENT_ID, "audio-volume-change",
CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
CA_PROP_CANBERRA_VOLUME, "0",
CA_PROP_CANBERRA_ENABLE, "1",
NULL);
g_debug("%i = %s", r, ca_strerror(r));
ca_context_change_device(ca_gtk_context_get(), NULL);
}
} }
void ChannelWidget::set_sensitive(bool enabled) { void ChannelWidget::set_sensitive(bool enabled) {
@ -521,6 +552,7 @@ void StreamWidget::setChannelMap(const pa_channel_map &m, bool can_decibel) {
for (int i = 0; i < m.channels; i++) { for (int i = 0; i < m.channels; i++) {
ChannelWidget *cw = channelWidgets[i] = ChannelWidget::create(); ChannelWidget *cw = channelWidgets[i] = ChannelWidget::create();
cw->beepDevice = beepDevice;
cw->channel = i; cw->channel = i;
cw->can_decibel = can_decibel; cw->can_decibel = can_decibel;
cw->streamWidget = this; cw->streamWidget = this;
@ -600,7 +632,7 @@ void SinkWidget::executeVolumeUpdate() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_sink_volume_by_index(context, index, &volume, NULL, NULL))) { if (!(o = pa_context_set_sink_volume_by_index(context, index, &volume, NULL, NULL))) {
show_error("pa_context_set_sink_volume_by_index() failed"); show_error(_("pa_context_set_sink_volume_by_index() failed"));
return; return;
} }
@ -615,7 +647,7 @@ void SinkWidget::onMuteToggleButton() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_sink_mute_by_index(context, index, muteToggleButton->get_active(), NULL, NULL))) { if (!(o = pa_context_set_sink_mute_by_index(context, index, muteToggleButton->get_active(), NULL, NULL))) {
show_error("pa_context_set_sink_mute_by_index() failed"); show_error(_("pa_context_set_sink_mute_by_index() failed"));
return; return;
} }
@ -629,7 +661,7 @@ void SinkWidget::onDefaultToggle() {
return; return;
if (!(o = pa_context_set_default_sink(context, name.c_str(), NULL, NULL))) { if (!(o = pa_context_set_default_sink(context, name.c_str(), NULL, NULL))) {
show_error("pa_context_set_default_sink() failed"); show_error(_("pa_context_set_default_sink() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -637,7 +669,7 @@ void SinkWidget::onDefaultToggle() {
SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x), StreamWidget(cobject, x),
defaultMenuItem("_Default", true){ defaultMenuItem(_("_Default"), true){
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
@ -658,7 +690,7 @@ void SourceWidget::executeVolumeUpdate() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_source_volume_by_index(context, index, &volume, NULL, NULL))) { if (!(o = pa_context_set_source_volume_by_index(context, index, &volume, NULL, NULL))) {
show_error("pa_context_set_source_volume_by_index() failed"); show_error(_("pa_context_set_source_volume_by_index() failed"));
return; return;
} }
@ -673,7 +705,7 @@ void SourceWidget::onMuteToggleButton() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_source_mute_by_index(context, index, muteToggleButton->get_active(), NULL, NULL))) { if (!(o = pa_context_set_source_mute_by_index(context, index, muteToggleButton->get_active(), NULL, NULL))) {
show_error("pa_context_set_source_mute_by_index() failed"); show_error(_("pa_context_set_source_mute_by_index() failed"));
return; return;
} }
@ -687,7 +719,7 @@ void SourceWidget::onDefaultToggle() {
return; return;
if (!(o = pa_context_set_default_source(context, name.c_str(), NULL, NULL))) { if (!(o = pa_context_set_default_source(context, name.c_str(), NULL, NULL))) {
show_error("pa_context_set_default_source() failed"); show_error(_("pa_context_set_default_source() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -696,8 +728,8 @@ void SourceWidget::onDefaultToggle() {
SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SinkInputWidget::SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x), StreamWidget(cobject, x),
mainWindow(NULL), mainWindow(NULL),
titleMenuItem("_Move Stream...", true), titleMenuItem(_("_Move Stream..."), true),
killMenuItem("_Terminate Stream", true) { killMenuItem(_("_Terminate Stream"), true) {
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
@ -723,7 +755,7 @@ void SinkInputWidget::executeVolumeUpdate() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_sink_input_volume(context, index, &volume, NULL, NULL))) { if (!(o = pa_context_set_sink_input_volume(context, index, &volume, NULL, NULL))) {
show_error("pa_context_set_sink_input_volume() failed"); show_error(_("pa_context_set_sink_input_volume() failed"));
return; return;
} }
@ -738,7 +770,7 @@ void SinkInputWidget::onMuteToggleButton() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_set_sink_input_mute(context, index, muteToggleButton->get_active(), NULL, NULL))) { if (!(o = pa_context_set_sink_input_mute(context, index, muteToggleButton->get_active(), NULL, NULL))) {
show_error("pa_context_set_sink_input_mute() failed"); show_error(_("pa_context_set_sink_input_mute() failed"));
return; return;
} }
@ -772,7 +804,7 @@ void SinkInputWidget::buildMenu() {
void SinkInputWidget::onKill() { void SinkInputWidget::onKill() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_kill_sink_input(context, index, NULL, NULL))) { if (!(o = pa_context_kill_sink_input(context, index, NULL, NULL))) {
show_error("pa_context_kill_sink_input() failed"); show_error(_("pa_context_kill_sink_input() failed"));
return; return;
} }
@ -789,7 +821,7 @@ void SinkInputWidget::SinkMenuItem::onToggle() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_move_sink_input_by_index(context, widget->index, index, NULL, NULL))) { if (!(o = pa_context_move_sink_input_by_index(context, widget->index, index, NULL, NULL))) {
show_error("pa_context_move_sink_input_by_index() failed"); show_error(_("pa_context_move_sink_input_by_index() failed"));
return; return;
} }
@ -799,8 +831,8 @@ void SinkInputWidget::SinkMenuItem::onToggle() {
SourceOutputWidget::SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SourceOutputWidget::SourceOutputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
MinimalStreamWidget(cobject, x), MinimalStreamWidget(cobject, x),
mainWindow(NULL), mainWindow(NULL),
titleMenuItem("_Move Stream...", true), titleMenuItem(_("_Move Stream..."), true),
killMenuItem("_Terminate Stream", true) { killMenuItem(_("_Terminate Stream"), true) {
add_events(Gdk::BUTTON_PRESS_MASK); add_events(Gdk::BUTTON_PRESS_MASK);
@ -825,7 +857,7 @@ SourceOutputWidget* SourceOutputWidget::create() {
void SourceOutputWidget::onKill() { void SourceOutputWidget::onKill() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_kill_source_output(context, index, NULL, NULL))) { if (!(o = pa_context_kill_source_output(context, index, NULL, NULL))) {
show_error("pa_context_kill_source_output() failed"); show_error(_("pa_context_kill_source_output() failed"));
return; return;
} }
@ -866,7 +898,7 @@ void SourceOutputWidget::SourceMenuItem::onToggle() {
pa_operation* o; pa_operation* o;
if (!(o = pa_context_move_source_output_by_index(context, widget->index, index, NULL, NULL))) { if (!(o = pa_context_move_source_output_by_index(context, widget->index, index, NULL, NULL))) {
show_error("pa_context_move_source_output_by_index() failed"); show_error(_("pa_context_move_source_output_by_index() failed"));
return; return;
} }
@ -908,7 +940,7 @@ void RoleWidget::executeVolumeUpdate() {
pa_operation* o; pa_operation* o;
if (!(o = pa_ext_stream_restore_write(context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) { if (!(o = pa_ext_stream_restore_write(context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
show_error("pa_ext_stream_restore_write() failed"); show_error(_("pa_ext_stream_restore_write() failed"));
return; return;
} }
@ -985,6 +1017,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w = sinkWidgets[info.index]; w = sinkWidgets[info.index];
else { else {
sinkWidgets[info.index] = w = SinkWidget::create(); sinkWidgets[info.index] = w = SinkWidget::create();
w->beepDevice = info.name;
w->setChannelMap(info.channel_map, !!(info.flags & PA_SINK_DECIBEL_VOLUME)); w->setChannelMap(info.channel_map, !!(info.flags & PA_SINK_DECIBEL_VOLUME));
sinksVBox->pack_start(*w, false, false, 0); sinksVBox->pack_start(*w, false, false, 0);
w->index = info.index; w->index = info.index;
@ -1029,7 +1062,7 @@ static void read_callback(pa_stream *s, size_t length, void *userdata) {
double v; double v;
if (pa_stream_peek(s, &data, &length) < 0) { if (pa_stream_peek(s, &data, &length) < 0) {
show_error("Failed to read data from stream"); show_error(_("Failed to read data from stream"));
return; return;
} }
@ -1063,8 +1096,8 @@ void MainWindow::createMonitorStreamForSource(uint32_t source_idx) {
snprintf(t, sizeof(t), "%u", source_idx); snprintf(t, sizeof(t), "%u", source_idx);
if (!(s = pa_stream_new(context, "Peak detect", &ss, NULL))) { if (!(s = pa_stream_new(context, _("Peak detect"), &ss, NULL))) {
show_error("Failed to create monitoring stream"); show_error(_("Failed to create monitoring stream"));
return; return;
} }
@ -1072,7 +1105,7 @@ void MainWindow::createMonitorStreamForSource(uint32_t source_idx) {
pa_stream_set_suspended_callback(s, suspended_callback, this); pa_stream_set_suspended_callback(s, suspended_callback, this);
if (pa_stream_connect_record(s, t, &attr, (pa_stream_flags_t) (PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY)) < 0) { if (pa_stream_connect_record(s, t, &attr, (pa_stream_flags_t) (PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY)) < 0) {
show_error("Failed to connect monitoring stream"); show_error(_("Failed to connect monitoring stream"));
pa_stream_unref(s); pa_stream_unref(s);
return; return;
} }
@ -1099,8 +1132,8 @@ void MainWindow::createMonitorStreamForSinkInput(uint32_t sink_input_idx, uint32
snprintf(t, sizeof(t), "%u", monitor_source_idx); snprintf(t, sizeof(t), "%u", monitor_source_idx);
if (!(s = pa_stream_new(context, "Peak detect", &ss, NULL))) { if (!(s = pa_stream_new(context, _("Peak detect"), &ss, NULL))) {
show_error("Failed to create monitoring stream"); show_error(_("Failed to create monitoring stream"));
return; return;
} }
@ -1109,7 +1142,7 @@ void MainWindow::createMonitorStreamForSinkInput(uint32_t sink_input_idx, uint32
pa_stream_set_suspended_callback(s, suspended_callback, this); pa_stream_set_suspended_callback(s, suspended_callback, this);
if (pa_stream_connect_record(s, t, &attr, (pa_stream_flags_t) (PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY)) < 0) { if (pa_stream_connect_record(s, t, &attr, (pa_stream_flags_t) (PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY)) < 0) {
show_error("Failed to connect monitoring stream"); show_error(_("Failed to connect monitoring stream"));
pa_stream_unref(s); pa_stream_unref(s);
return; return;
} }
@ -1349,7 +1382,7 @@ bool MainWindow::createEventRoleWidget() {
eventRoleWidget->setChannelMap(cm, true); eventRoleWidget->setChannelMap(cm, true);
eventRoleWidget->boldNameLabel->set_text(""); eventRoleWidget->boldNameLabel->set_text("");
eventRoleWidget->nameLabel->set_label("System Sounds"); eventRoleWidget->nameLabel->set_label(_("System Sounds"));
eventRoleWidget->iconImage->set_from_icon_name("multimedia-volume-control", Gtk::ICON_SIZE_SMALL_TOOLBAR); eventRoleWidget->iconImage->set_from_icon_name("multimedia-volume-control", Gtk::ICON_SIZE_SMALL_TOOLBAR);
@ -1628,7 +1661,10 @@ void sink_cb(pa_context *, const pa_sink_info *i, int eol, void *userdata) {
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
show_error("Sink callback failure"); if (pa_context_errno(context) == PA_ERR_NOENTITY)
return;
show_error(_("Sink callback failure"));
return; return;
} }
@ -1644,7 +1680,10 @@ void source_cb(pa_context *, const pa_source_info *i, int eol, void *userdata) {
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
show_error("Source callback failure"); if (pa_context_errno(context) == PA_ERR_NOENTITY)
return;
show_error(_("Source callback failure"));
return; return;
} }
@ -1660,7 +1699,10 @@ void sink_input_cb(pa_context *, const pa_sink_input_info *i, int eol, void *use
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
show_error("Sink input callback failure"); if (pa_context_errno(context) == PA_ERR_NOENTITY)
return;
show_error(_("Sink input callback failure"));
return; return;
} }
@ -1676,7 +1718,10 @@ void source_output_cb(pa_context *, const pa_source_output_info *i, int eol, voi
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
show_error("Source output callback failure"); if (pa_context_errno(context) == PA_ERR_NOENTITY)
return;
show_error(_("Source output callback failure"));
return; return;
} }
@ -1707,7 +1752,10 @@ void client_cb(pa_context *, const pa_client_info *i, int eol, void *userdata) {
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
show_error("Client callback failure"); if (pa_context_errno(context) == PA_ERR_NOENTITY)
return;
show_error(_("Client callback failure"));
return; return;
} }
@ -1723,7 +1771,7 @@ void server_info_cb(pa_context *, const pa_server_info *i, void *userdata) {
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (!i) { if (!i) {
show_error("Server info callback failure"); show_error(_("Server info callback failure"));
return; return;
} }
@ -1740,7 +1788,7 @@ void ext_stream_restore_read_cb(
MainWindow *w = static_cast<MainWindow*>(userdata); MainWindow *w = static_cast<MainWindow*>(userdata);
if (eol < 0) { if (eol < 0) {
g_debug("Failed to initialized stream_restore extension: %s", pa_strerror(pa_context_errno(context))); g_debug(_("Failed to initialized stream_restore extension: %s"), pa_strerror(pa_context_errno(context)));
w->deleteEventRoleWidget(); w->deleteEventRoleWidget();
return; return;
} }
@ -1760,7 +1808,7 @@ static void ext_stream_restore_subscribe_cb(pa_context *c, void *userdata) {
pa_operation *o; pa_operation *o;
if (!(o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, w))) { if (!(o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, w))) {
show_error("pa_ext_stream_restore_read() failed"); show_error(_("pa_ext_stream_restore_read() failed"));
return; return;
} }
@ -1777,7 +1825,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
else { else {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_sink_info_by_index(c, index, sink_cb, w))) { if (!(o = pa_context_get_sink_info_by_index(c, index, sink_cb, w))) {
show_error("pa_context_get_sink_info_by_index() failed"); show_error(_("pa_context_get_sink_info_by_index() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1790,7 +1838,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
else { else {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_source_info_by_index(c, index, source_cb, w))) { if (!(o = pa_context_get_source_info_by_index(c, index, source_cb, w))) {
show_error("pa_context_get_source_info_by_index() failed"); show_error(_("pa_context_get_source_info_by_index() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1803,7 +1851,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
else { else {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, w))) { if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, w))) {
show_error("pa_context_get_sink_input_info() failed"); show_error(_("pa_context_get_sink_input_info() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1816,7 +1864,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
else { else {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, w))) { if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, w))) {
show_error("pa_context_get_sink_input_info() failed"); show_error(_("pa_context_get_sink_input_info() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1829,7 +1877,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
else { else {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_client_info(c, index, client_cb, w))) { if (!(o = pa_context_get_client_info(c, index, client_cb, w))) {
show_error("pa_context_get_client_info() failed"); show_error(_("pa_context_get_client_info() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1839,7 +1887,7 @@ void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,
case PA_SUBSCRIPTION_EVENT_SERVER: { case PA_SUBSCRIPTION_EVENT_SERVER: {
pa_operation *o; pa_operation *o;
if (!(o = pa_context_get_server_info(c, server_info_cb, w))) { if (!(o = pa_context_get_server_info(c, server_info_cb, w))) {
show_error("pa_context_get_server_info() failed"); show_error(_("pa_context_get_server_info() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1871,43 +1919,43 @@ void context_state_callback(pa_context *c, void *userdata) {
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT|
PA_SUBSCRIPTION_MASK_CLIENT| PA_SUBSCRIPTION_MASK_CLIENT|
PA_SUBSCRIPTION_MASK_SERVER), NULL, NULL))) { PA_SUBSCRIPTION_MASK_SERVER), NULL, NULL))) {
show_error("pa_context_subscribe() failed"); show_error(_("pa_context_subscribe() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_server_info(c, server_info_cb, w))) { if (!(o = pa_context_get_server_info(c, server_info_cb, w))) {
show_error("pa_context_get_server_info() failed"); show_error(_("pa_context_get_server_info() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_client_info_list(c, client_cb, w))) { if (!(o = pa_context_get_client_info_list(c, client_cb, w))) {
show_error("pa_context_client_info_list() failed"); show_error(_("pa_context_client_info_list() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_sink_info_list(c, sink_cb, w))) { if (!(o = pa_context_get_sink_info_list(c, sink_cb, w))) {
show_error("pa_context_get_sink_info_list() failed"); show_error(_("pa_context_get_sink_info_list() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_source_info_list(c, source_cb, w))) { if (!(o = pa_context_get_source_info_list(c, source_cb, w))) {
show_error("pa_context_get_source_info_list() failed"); show_error(_("pa_context_get_source_info_list() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, w))) { if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, w))) {
show_error("pa_context_get_sink_input_info_list() failed"); show_error(_("pa_context_get_sink_input_info_list() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, w))) { if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, w))) {
show_error("pa_context_get_source_output_info_list() failed"); show_error(_("pa_context_get_source_output_info_list() failed"));
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
@ -1925,13 +1973,13 @@ void context_state_callback(pa_context *c, void *userdata) {
pa_operation_unref(o); pa_operation_unref(o);
} else } else
g_debug("Failed to initialized stream_restore extension: %s", pa_strerror(pa_context_errno(context))); g_debug(_("Failed to initialized stream_restore extension: %s"), pa_strerror(pa_context_errno(context)));
break; break;
} }
case PA_CONTEXT_FAILED: case PA_CONTEXT_FAILED:
show_error("Connection failed"); show_error(_("Connection failed"));
return; return;
case PA_CONTEXT_TERMINATED: case PA_CONTEXT_TERMINATED:
@ -1942,10 +1990,18 @@ void context_state_callback(pa_context *c, void *userdata) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
/* Initialize the i18n stuff */
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
Gtk::Main kit(argc, argv); Gtk::Main kit(argc, argv);
ca_context_set_driver(ca_gtk_context_get(), "pulse");
Gtk::Window* mainWindow = MainWindow::create(); Gtk::Window* mainWindow = MainWindow::create();
pa_glib_mainloop *m = pa_glib_mainloop_new(g_main_context_default()); pa_glib_mainloop *m = pa_glib_mainloop_new(g_main_context_default());
@ -1954,7 +2010,7 @@ int main(int argc, char *argv[]) {
g_assert(api); g_assert(api);
pa_proplist *proplist = pa_proplist_new(); pa_proplist *proplist = pa_proplist_new();
pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "PulseAudio Volume Control"); pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, _("PulseAudio Volume Control"));
pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "org.PulseAudio.pavucontrol"); pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "org.PulseAudio.pavucontrol");
pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "audio-card"); pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "audio-card");
pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION);
@ -1967,7 +2023,7 @@ int main(int argc, char *argv[]) {
pa_context_set_state_callback(context, context_state_callback, mainWindow); pa_context_set_state_callback(context, context_state_callback, mainWindow);
if (pa_context_connect(context, NULL, (pa_context_flags_t) 0, NULL) < 0) { if (pa_context_connect(context, NULL, (pa_context_flags_t) 0, NULL) < 0) {
show_error("Connection failed"); show_error(_("Connection failed"));
goto finish; goto finish;
} }