[gnome-control-center/wip/cdavis/40-consistency: 2/3] sound: Use libhandy preferences styling
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/cdavis/40-consistency: 2/3] sound: Use libhandy preferences styling
- Date: Fri, 12 Feb 2021 03:28:06 +0000 (UTC)
commit 237b56a6a793d8cedbc4260200f4c1bde6855d2e
Author: Christopher Davis <brainblasted disroot org>
Date: Tue Feb 9 23:26:41 2021 -0800
sound: Use libhandy preferences styling
libhandy provides a nice pre-built widget to use
for preference styling. We should use that where possible.
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1190
panels/sound/cc-sound-panel.c | 10 -
panels/sound/cc-sound-panel.ui | 546 +++++++++++++++++++----------------------
2 files changed, 249 insertions(+), 307 deletions(-)
---
diff --git a/panels/sound/cc-sound-panel.c b/panels/sound/cc-sound-panel.c
index 200df4388..2d8840fbf 100644
--- a/panels/sound/cc-sound-panel.c
+++ b/panels/sound/cc-sound-panel.c
@@ -258,16 +258,6 @@ cc_sound_panel_init (CcSoundPanel *self)
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_list_box_set_header_func (self->input_list_box,
- cc_list_box_update_header_func,
- NULL, NULL);
- gtk_list_box_set_header_func (self->output_list_box,
- cc_list_box_update_header_func,
- NULL, NULL);
- gtk_list_box_set_header_func (GTK_LIST_BOX (self->stream_list_box),
- cc_list_box_update_header_func,
- NULL, NULL);
-
self->sound_settings = g_settings_new (KEY_SOUNDS_SCHEMA);
g_signal_connect_object (self->sound_settings,
"changed::allow-volume-above-100-percent",
diff --git a/panels/sound/cc-sound-panel.ui b/panels/sound/cc-sound-panel.ui
index 140feaa96..4887c517b 100644
--- a/panels/sound/cc-sound-panel.ui
+++ b/panels/sound/cc-sound-panel.ui
@@ -4,241 +4,121 @@
<template class="CcSoundPanel" parent="CcPanel">
<property name="visible">True</property>
<child>
- <object class="GtkScrolledWindow">
+ <object class="HdyPreferencesPage">
<property name="visible">True</property>
- <property name="hscrollbar_policy">never</property>
<child>
- <object class="HdyClamp">
+ <object class="HdyPreferencesGroup">
<property name="visible">True</property>
- <property name="margin_top">32</property>
- <property name="margin_bottom">32</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
+ <property name="title" translatable="yes">System Volume</property>
<child>
- <object class="GtkBox">
+ <object class="CcVolumeSlider" id="output_volume_slider">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <property name="hexpand">True</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">System Volume</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="CcVolumeSlider" id="output_volume_slider">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="margin-top">18</property>
- <property name="label" translatable="yes">Volume Levels</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <child>
- <object class="CcStreamListBox" id="stream_list_box">
- <property name="visible">True</property>
- <property name="label-size-group">label_size_group</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="margin-top">18</property>
- <property name="label" translatable="yes">Output</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="HdyPreferencesGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Volume Levels</property>
+ <child>
+ <object class="CcStreamListBox" id="stream_list_box">
+ <property name="visible">True</property>
+ <property name="label-size-group">label_size_group</property>
+ <style>
+ <class name="content"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="HdyPreferencesGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Output</property>
+ <child>
+ <object class="GtkListBox" id="output_list_box">
+ <property name="visible">True</property>
+ <property name="selection_mode">none</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkListBoxRow">
<property name="visible">True</property>
+ <property name="activatable">False</property>
<child>
- <object class="GtkListBox" id="output_list_box">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="selection_mode">none</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkListBoxRow">
+ <object class="GtkLabel" id="output_device_label">
<property name="visible">True</property>
- <property name="activatable">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="output_device_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Output Device</property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="hexpand">True</property>
- <property name="spacing">9</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="CcDeviceComboBox" id="output_device_combo_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <signal name="changed" handler="output_device_changed_cb"
object="CcSoundPanel" swapped="yes"/>
- </object>
- </child>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Test</property>
- <signal name="clicked"
handler="test_output_configuration_button_clicked_cb" object="CcSoundPanel" swapped="yes"/>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="CcLevelBar" id="output_level_bar">
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Output Device</property>
</object>
</child>
<child>
- <object class="GtkListBoxRow" id="output_profile_row">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="activatable">False</property>
+ <property name="orientation">vertical</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">9</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="output_configuration_label">
+ <object class="CcDeviceComboBox" id="output_device_combo_box">
<property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Configuration</property>
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="output_device_changed_cb"
object="CcSoundPanel" swapped="yes"/>
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkButton">
<property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="CcProfileComboBox" id="output_profile_combo_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Test</property>
+ <signal name="clicked"
handler="test_output_configuration_button_clicked_cb" object="CcSoundPanel" swapped="yes"/>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow">
- <property name="visible">True</property>
- <property name="activatable">False</property>
<child>
- <object class="GtkBox">
+ <object class="CcLevelBar" id="output_level_bar">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="output_balance_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Balance</property>
- </object>
- </child>
- <child>
- <object class="CcBalanceSlider" id="balance_slider">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
</object>
</child>
</object>
</child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="output_profile_row">
+ <property name="visible">True</property>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkListBoxRow" id="fade_row">
+ <object class="GtkLabel" id="output_configuration_label">
<property name="visible">True</property>
- <property name="activatable">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="output_fade_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Fade</property>
- </object>
- </child>
- <child>
- <object class="CcFadeSlider" id="fade_slider">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
- </object>
- </child>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Configuration</property>
</object>
</child>
<child>
- <object class="GtkListBoxRow" id="subwoofer_row">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="activatable">False</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox">
+ <object class="CcProfileComboBox" id="output_profile_combo_box">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="output_subwoofer_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Subwoofer</property>
- </object>
- </child>
- <child>
- <object class="CcSubwooferSlider" id="subwoofer_slider">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
+ <property name="hexpand">True</property>
</object>
</child>
</object>
@@ -248,120 +128,134 @@
</object>
</child>
<child>
- <object class="GtkLabel">
+ <object class="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="output_balance_label">
+ <property name="visible">True</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Balance</property>
+ </object>
+ </child>
+ <child>
+ <object class="CcBalanceSlider" id="balance_slider">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="fade_row">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="margin-top">18</property>
- <property name="label" translatable="yes">Input</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="output_fade_label">
+ <property name="visible">True</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Fade</property>
+ </object>
+ </child>
+ <child>
+ <object class="CcFadeSlider" id="fade_slider">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
- <object class="GtkFrame">
+ <object class="GtkListBoxRow" id="subwoofer_row">
<property name="visible">True</property>
+ <property name="activatable">False</property>
<child>
- <object class="GtkListBox" id="input_list_box">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="selection_mode">none</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkListBoxRow">
+ <object class="GtkLabel" id="output_subwoofer_label">
<property name="visible">True</property>
- <property name="activatable">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="input_device_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Input Device</property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="hexpand">True</property>
- <property name="spacing">9</property>
- <child>
- <object class="CcDeviceComboBox" id="input_device_combo_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <signal name="changed" handler="input_device_changed_cb"
object="CcSoundPanel" swapped="yes"/>
- </object>
- </child>
- <child>
- <object class="CcLevelBar" id="input_level_bar">
- <property name="visible">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Subwoofer</property>
</object>
</child>
<child>
- <object class="GtkListBoxRow" id="input_profile_row">
+ <object class="CcSubwooferSlider" id="subwoofer_slider">
<property name="visible">True</property>
- <property name="activatable">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="input_configuration_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Configuration</property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="CcProfileComboBox" id="input_profile_combo_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="content"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="HdyPreferencesGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Input</property>
+ <child>
+ <object class="GtkListBox" id="input_list_box">
+ <property name="visible">True</property>
+ <property name="selection_mode">none</property>
+ <child>
+ <object class="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="input_device_label">
+ <property name="visible">True</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Input Device</property>
</object>
</child>
<child>
- <object class="GtkListBoxRow">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="activatable">False</property>
+ <property name="orientation">vertical</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">9</property>
<child>
- <object class="GtkBox">
+ <object class="CcDeviceComboBox" id="input_device_combo_box">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <signal name="changed" handler="input_device_changed_cb"
object="CcSoundPanel" swapped="yes"/>
+ </object>
+ </child>
+ <child>
+ <object class="CcLevelBar" id="input_level_bar">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="input_volume_label">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Volume</property>
- </object>
- </child>
- <child>
- <object class="CcVolumeSlider" id="input_volume_slider">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- </child>
</object>
</child>
</object>
@@ -371,22 +265,80 @@
</object>
</child>
<child>
- <object class="GtkLabel">
+ <object class="GtkListBoxRow" id="input_profile_row">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="margin-top">18</property>
- <property name="label" translatable="yes">Alert Sound</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="input_configuration_label">
+ <property name="visible">True</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Configuration</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="CcProfileComboBox" id="input_profile_combo_box">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
- <object class="CcAlertChooser">
+ <object class="GtkListBoxRow">
<property name="visible">True</property>
- <property name="hexpand">True</property>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="input_volume_label">
+ <property name="visible">True</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Volume</property>
+ </object>
+ </child>
+ <child>
+ <object class="CcVolumeSlider" id="input_volume_slider">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
+ <style>
+ <class name="content"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="HdyPreferencesGroup">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Alert Sound</property>
+ <child>
+ <object class="CcAlertChooser">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]