* change scale behaviour to be more resposive

* make "Streams" page the default


git-svn-id: file:///home/lennart/svn/public/pavucontrol/trunk@13 c17c95f2-f111-0410-90bf-f30a9569010c
This commit is contained in:
Lennart Poettering 2006-05-16 21:13:41 +00:00
parent 96cc4d1a45
commit 2e1bf7e600
3 changed files with 112 additions and 98 deletions

View File

@ -39,7 +39,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 ]) PKG_CHECK_MODULES(GUILIBS, [ gtkmm-2.4 libglademm-2.4 sigc++-2.0 ])
AC_SUBST(GUILIBS_CFLAGS) AC_SUBST(GUILIBS_CFLAGS)
AC_SUBST(GUILIBS_LIBS) AC_SUBST(GUILIBS_LIBS)

View File

@ -74,6 +74,12 @@ public:
ChannelWidget *channelWidgets[PA_CHANNELS_MAX]; ChannelWidget *channelWidgets[PA_CHANNELS_MAX];
virtual void onMuteToggleButton(); virtual void onMuteToggleButton();
sigc::connection timeoutConnection;
bool timeoutEvent();
virtual void executeVolumeUpdate();
}; };
class SinkWidget : public StreamWidget { class SinkWidget : public StreamWidget {
@ -81,9 +87,9 @@ public:
SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x);
static SinkWidget* create(); static SinkWidget* create();
virtual void updateChannelVolume(int channel, pa_volume_t v);
virtual void onMuteToggleButton(); virtual void onMuteToggleButton();
uint32_t index; uint32_t index;
virtual void executeVolumeUpdate();
}; };
class SourceWidget : public StreamWidget { class SourceWidget : public StreamWidget {
@ -91,9 +97,9 @@ public:
SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x);
static SourceWidget* create(); static SourceWidget* create();
virtual void updateChannelVolume(int channel, pa_volume_t v);
virtual void onMuteToggleButton(); virtual void onMuteToggleButton();
uint32_t index; uint32_t index;
virtual void executeVolumeUpdate();
}; };
class SinkInputWidget : public StreamWidget { class SinkInputWidget : public StreamWidget {
@ -101,8 +107,8 @@ public:
SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x); SinkInputWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x);
static SinkInputWidget* create(); static SinkInputWidget* create();
virtual void updateChannelVolume(int channel, pa_volume_t v);
uint32_t index; uint32_t index;
virtual void executeVolumeUpdate();
}; };
class MainWindow : public Gtk::Window { class MainWindow : public Gtk::Window {
@ -169,7 +175,7 @@ void ChannelWidget::setVolume(pa_volume_t volume) {
volumeLabel->set_text(txt); volumeLabel->set_text(txt);
if (v > 100) if (v > 100)
v = 1000; v = 100;
volumeScaleEnabled = false; volumeScaleEnabled = false;
volumeScale->set_value(v); volumeScale->set_value(v);
@ -242,6 +248,11 @@ void StreamWidget::updateChannelVolume(int channel, pa_volume_t v) {
volume.values[i] = v; volume.values[i] = v;
} else } else
volume.values[channel] = v; volume.values[channel] = v;
setVolume(volume);
if (timeoutConnection.empty())
timeoutConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &StreamWidget::timeoutEvent), 50);
} }
void StreamWidget::onMuteToggleButton() { void StreamWidget::onMuteToggleButton() {
@ -251,6 +262,14 @@ void StreamWidget::onMuteToggleButton() {
channelWidgets[i]->set_sensitive(!muteToggleButton->get_active()); channelWidgets[i]->set_sensitive(!muteToggleButton->get_active());
} }
bool StreamWidget::timeoutEvent() {
executeVolumeUpdate();
return false;
}
void StreamWidget::executeVolumeUpdate() {
}
SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
StreamWidget(cobject, x) { StreamWidget(cobject, x) {
} }
@ -262,10 +281,9 @@ SinkWidget* SinkWidget::create() {
return w; return w;
} }
void SinkWidget::updateChannelVolume(int channel, pa_volume_t v) { void SinkWidget::executeVolumeUpdate() {
StreamWidget::updateChannelVolume(channel, v);
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;
@ -284,7 +302,6 @@ void SinkWidget::onMuteToggleButton() {
} }
pa_operation_unref(o); pa_operation_unref(o);
} }
SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) : SourceWidget::SourceWidget(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& x) :
@ -298,17 +315,15 @@ SourceWidget* SourceWidget::create() {
return w; return w;
} }
void SourceWidget::updateChannelVolume(int channel, pa_volume_t v) { void SourceWidget::executeVolumeUpdate() {
StreamWidget::updateChannelVolume(channel, v);
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;
} }
pa_operation_unref(o); pa_operation_unref(o);
return;
} }
void SourceWidget::onMuteToggleButton() { void SourceWidget::onMuteToggleButton() {
@ -319,7 +334,7 @@ void SourceWidget::onMuteToggleButton() {
show_error("pa_context_set_source_mute_by_index() failed"); show_error("pa_context_set_source_mute_by_index() failed");
return; return;
} }
pa_operation_unref(o); pa_operation_unref(o);
} }
@ -334,10 +349,9 @@ SinkInputWidget* SinkInputWidget::create() {
return w; return w;
} }
void SinkInputWidget::updateChannelVolume(int channel, pa_volume_t v) { void SinkInputWidget::executeVolumeUpdate() {
StreamWidget::updateChannelVolume(channel, v);
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;

View File

@ -126,86 +126,6 @@
<property name="scrollable">False</property> <property name="scrollable">False</property>
<property name="enable_popup">False</property> <property name="enable_popup">False</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow8">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkViewport" id="viewport4">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkVBox" id="sinksVBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="noSinksLabel">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">&lt;i&gt;No Sinks Available&lt;/i&gt;</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">16</property>
<property name="ypad">16</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>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4711">
<property name="visible">True</property>
<property name="label" translatable="yes">_Sinks</property>
<property name="use_underline">True</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.5</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">270</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow5"> <widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="border_width">12</property> <property name="border_width">12</property>
@ -286,6 +206,86 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow8">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkViewport" id="viewport4">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkVBox" id="sinksVBox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="noSinksLabel">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">&lt;i&gt;No Sinks Available&lt;/i&gt;</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">16</property>
<property name="ypad">16</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>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4711">
<property name="visible">True</property>
<property name="label" translatable="yes">_Sinks</property>
<property name="use_underline">True</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.5</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">270</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow7"> <widget class="GtkScrolledWindow" id="scrolledwindow7">
<property name="border_width">12</property> <property name="border_width">12</property>
@ -701,7 +701,7 @@
<property name="draw_value">False</property> <property name="draw_value">False</property>
<property name="value_pos">GTK_POS_TOP</property> <property name="value_pos">GTK_POS_TOP</property>
<property name="digits">0</property> <property name="digits">0</property>
<property name="update_policy">GTK_UPDATE_DELAYED</property> <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property> <property name="inverted">False</property>
<property name="adjustment">44.2408370972 0 100 5 0 0</property> <property name="adjustment">44.2408370972 0 100 5 0 0</property>
</widget> </widget>