[pulseaudio-discuss] [PATCH pavucontrol] ellipsize labels to fix window resizing
Alexander E. Patrakov
patrakov at gmail.com
Fri Dec 6 06:02:04 PST 2013
2013/12/5 Sebastian Wick <sebastian at sebastianwick.net>:
> ellipsize labels to make the window resizable even with long label text
> and add tooltips to provide a way to read the full text
> ---
> src/mainwindow.cc | 6 ++++++
> src/pavucontrol.glade | 2 ++
> 2 files changed, 8 insertions(+)
>
> diff --git a/src/mainwindow.cc b/src/mainwindow.cc
> index 6d629ad..5a19302 100644
> --- a/src/mainwindow.cc
> +++ b/src/mainwindow.cc
> @@ -294,6 +294,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
> w->boldNameLabel->set_text("");
> gchar *txt;
> w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s", info.description));
> + w->nameLabel->set_tooltip_text(info.description);
> g_free(txt);
>
> icon = pa_proplist_gets(info.proplist, PA_PROP_DEVICE_ICON_NAME);
> @@ -433,6 +434,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
> w->boldNameLabel->set_text("");
> gchar *txt;
> w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s", info.description));
> + w->nameLabel->set_tooltip_text(info.description);
> g_free(txt);
>
> icon = pa_proplist_gets(info.proplist, PA_PROP_DEVICE_ICON_NAME);
> @@ -549,6 +551,8 @@ void MainWindow::updateSinkInput(const pa_sink_input_info &info) {
> w->nameLabel->set_label(info.name);
> }
>
> + w->nameLabel->set_tooltip_text(info.name);
> +
> setIconFromProplist(w->iconImage, info.proplist, "audio-card");
>
> w->setVolume(info.volume);
> @@ -596,6 +600,8 @@ void MainWindow::updateSourceOutput(const pa_source_output_info &info) {
> w->nameLabel->set_label(info.name);
> }
>
> + w->nameLabel->set_tooltip_text(info.name);
> +
> setIconFromProplist(w->iconImage, info.proplist, "audio-input-microphone");
>
> w->updating = false;
> diff --git a/src/pavucontrol.glade b/src/pavucontrol.glade
> index 3077a88..ae8f09f 100644
> --- a/src/pavucontrol.glade
> +++ b/src/pavucontrol.glade
> @@ -254,6 +254,7 @@
> <property name="xalign">0</property>
> <property name="label" translatable="yes">Device Title</property>
> <property name="use_markup">True</property>
> + <property name="ellipsize">end</property>
> </object>
> <packing>
> <property name="expand">False</property>
> @@ -1199,6 +1200,7 @@
> <property name="xalign">0</property>
> <property name="label" translatable="yes">Stream Title</property>
> <property name="use_markup">True</property>
> + <property name="ellipsize">end</property>
> </object>
> <packing>
> <property name="expand">False</property>
> --
> 1.8.4.3
I have tested the patch. It does what it says, but I found an ugly
effect. I don't know GTK+ enough to decide whether this is fixable.
To reproduce:
1. Configure pulseaudio to use Built-In Audio Analog Stereo as the
fallback device.
2. Load module-echo-cancel (just for a sink with a long name).
3. Play something. It should go through "Built-In Audio Analog Stereo"
by default.
4. Start pavucontrol, shrink its window.
5. Using pavucontrol, move that stream to "Built-in Audio Analog
Stereo (echo cancelled with Built-in Audio Analog Stereo)".
Result: the stream title ellipsized to just "...", and the combo box
that allows to select the device becomes wider than the window. I'd
argue that it either should be initially as wide as its widest item
(i.e. the widest sink name in this case), or that the sink names
should also be ellipsized.
--
Alexander E. Patrakov
More information about the pulseaudio-discuss
mailing list