[gnome-control-center] cc-sound-panel: Use AdwPreferencesPage and PreferencesGroup



commit e216f7f2db1a8d8fe9e9f147da263719f6fb8cbe
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Jan 4 15:17:36 2022 -0800

    cc-sound-panel: Use AdwPreferencesPage and PreferencesGroup
    
    libadwaita provides nice pre-built widgets for preferences
    pages and groups. We should use them where possible.

 panels/sound/cc-sound-panel.ui | 480 +++++++++++++++++++----------------------
 1 file changed, 220 insertions(+), 260 deletions(-)
---
diff --git a/panels/sound/cc-sound-panel.ui b/panels/sound/cc-sound-panel.ui
index 62d26eb70..7852f338a 100644
--- a/panels/sound/cc-sound-panel.ui
+++ b/panels/sound/cc-sound-panel.ui
@@ -3,186 +3,104 @@
   <!-- interface-requires gtk+ 3.0 -->
   <template class="CcSoundPanel" parent="CcPanel">
     <child>
-      <object class="GtkScrolledWindow">
-        <property name="hscrollbar_policy">never</property>
+      <object class="AdwPreferencesPage">
         <child>
-          <object class="AdwClamp">
-            <property name="margin_top">32</property>
-            <property name="margin_bottom">32</property>
-            <property name="margin_start">12</property>
-            <property name="margin_end">12</property>
+          <object class="AdwPreferencesGroup">
+            <property name="title" translatable="yes">System Volume</property>
             <child>
-              <object class="GtkBox">
-                <property name="orientation">vertical</property>
-                <property name="spacing">12</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkLabel">
-                    <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" />
-                </child>
-                <child>
-                  <object class="GtkLabel">
-                    <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="CcStreamListBox" id="stream_list_box">
-                    <property name="label-size-group">label_size_group</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel">
-                    <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 class="CcVolumeSlider" id="output_volume_slider" />
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwPreferencesGroup">
+            <property name="title" translatable="yes">Volume Levels</property>
+            <child>
+              <object class="CcStreamListBox" id="stream_list_box">
+                <property name="label-size-group">label_size_group</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwPreferencesGroup">
+            <property name="title" translatable="yes">Output</property>
+            <child>
+              <object class="GtkListBox" id="output_list_box">
+                <property name="selection_mode">none</property>
+                <style>
+                  <class name="boxed-list"/>
+                </style>
                 <child>
-                  <object class="GtkListBox" id="output_list_box">
-                    <property name="selection_mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="GtkListBoxRow">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="output_device_label">
-                                <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="orientation">vertical</property>
-                                <property name="hexpand">True</property>
-                                <property name="spacing">9</property>
-                                <child>
-                                  <object class="GtkBox">
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <object class="CcDeviceComboBox" id="output_device_combo_box">
-                                        <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="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" />
-                                </child>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="output_device_label">
+                            <property name="ellipsize">end</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Output Device</property>
                           </object>
                         </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkListBoxRow" id="output_profile_row">
-                        <property name="activatable">False</property>
                         <child>
                           <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="output_configuration_label">
-                                <property name="ellipsize">end</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Configuration</property>
-                              </object>
-                            </child>
+                            <property name="orientation">vertical</property>
+                            <property name="hexpand">True</property>
+                            <property name="spacing">9</property>
                             <child>
                               <object class="GtkBox">
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="CcProfileComboBox" id="output_profile_combo_box">
+                                  <object class="CcDeviceComboBox" id="output_device_combo_box">
                                     <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="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" />
+                            </child>
                           </object>
                         </child>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkListBoxRow" id="output_profile_row">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="output_balance_label">
-                                <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="hexpand">True</property>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="output_configuration_label">
+                            <property name="ellipsize">end</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Configuration</property>
                           </object>
                         </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkListBoxRow" id="fade_row">
-                        <property name="activatable">False</property>
                         <child>
                           <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
+                            <property name="spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="output_fade_label">
-                                <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">
+                              <object class="CcProfileComboBox" id="output_profile_combo_box">
                                 <property name="hexpand">True</property>
                               </object>
                             </child>
@@ -190,28 +108,28 @@
                         </child>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkListBoxRow">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow" id="subwoofer_row">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="output_subwoofer_label">
-                                <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="hexpand">True</property>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="output_balance_label">
+                            <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="hexpand">True</property>
                           </object>
                         </child>
                       </object>
@@ -219,108 +137,129 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
-                    <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>
+                  <object class="GtkListBoxRow" id="fade_row">
+                    <property name="activatable">False</property>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="output_fade_label">
+                            <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="hexpand">True</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkListBox" id="input_list_box">
-                    <property name="selection_mode">none</property>
-                    <style>
-                      <class name="boxed-list"/>
-                    </style>
+                  <object class="GtkListBoxRow" id="subwoofer_row">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkBox">
-                            <property name="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="input_device_label">
-                                <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="orientation">vertical</property>
-                                <property name="hexpand">True</property>
-                                <property name="spacing">9</property>
-                                <child>
-                                  <object class="CcDeviceComboBox" id="input_device_combo_box">
-                                    <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" />
-                                </child>
-                              </object>
-                            </child>
+                          <object class="GtkLabel" id="output_subwoofer_label">
+                            <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="hexpand">True</property>
                           </object>
                         </child>
                       </object>
                     </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="AdwPreferencesGroup">
+            <property name="title" translatable="yes">Input</property>
+            <child>
+              <object class="GtkListBox" id="input_list_box">
+                <property name="selection_mode">none</property>
+                <style>
+                  <class name="boxed-list"/>
+                </style>
+                <child>
+                  <object class="GtkListBoxRow">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow" id="input_profile_row">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="input_device_label">
+                            <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="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
+                            <property name="orientation">vertical</property>
+                            <property name="hexpand">True</property>
+                            <property name="spacing">9</property>
                             <child>
-                              <object class="GtkLabel" id="input_configuration_label">
-                                <property name="ellipsize">end</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Configuration</property>
+                              <object class="CcDeviceComboBox" id="input_device_combo_box">
+                                <property name="hexpand">True</property>
+                                <signal name="changed" handler="input_device_changed_cb" 
object="CcSoundPanel" swapped="yes"/>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox">
-                                <property name="spacing">6</property>
-                                <child>
-                                  <object class="CcProfileComboBox" id="input_profile_combo_box">
-                                    <property name="hexpand">True</property>
-                                  </object>
-                                </child>
-                              </object>
+                              <object class="CcLevelBar" id="input_level_bar" />
                             </child>
                           </object>
                         </child>
                       </object>
                     </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkListBoxRow" id="input_profile_row">
+                    <property name="activatable">False</property>
                     <child>
-                      <object class="GtkListBoxRow">
-                        <property name="activatable">False</property>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="input_configuration_label">
+                            <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="margin-top">12</property>
-                            <property name="margin-bottom">12</property>
-                            <property name="margin-start">12</property>
-                            <property name="margin-end">12</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkLabel" id="input_volume_label">
-                                <property name="ellipsize">end</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Volume</property>
-                              </object>
-                            </child>
+                            <property name="spacing">6</property>
                             <child>
-                              <object class="CcVolumeSlider" id="input_volume_slider">
+                              <object class="CcProfileComboBox" id="input_profile_combo_box">
                                 <property name="hexpand">True</property>
                               </object>
                             </child>
@@ -331,24 +270,45 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
-                    <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>
-                  </object>
-                </child>
-                <child>
-                  <object class="CcAlertChooser">
-                    <property name="hexpand">True</property>
+                  <object class="GtkListBoxRow">
+                    <property name="activatable">False</property>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="margin-top">12</property>
+                        <property name="margin-bottom">12</property>
+                        <property name="margin-start">12</property>
+                        <property name="margin-end">12</property>
+                        <property name="spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="input_volume_label">
+                            <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="hexpand">True</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
             </child>
           </object>
         </child>
+        <child>
+          <object class="AdwPreferencesGroup">
+            <property name="title" translatable="yes">Alert Sound</property>
+            <child>
+              <object class="CcAlertChooser">
+                <property name="hexpand">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
       </object>
     </child>
   </template>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]