From 76b9ed1d5e425e18b15918f7ece040bfe2ae947d Mon Sep 17 00:00:00 2001
From: Julian Sparber <julian@sparber.net>
Date: Mon, 14 Dec 2020 17:56:13 +0100
Subject: [PATCH 1/5] alarm-setup-dialog: Allow much smaller heights useing a
 ScrolledWindow

---
 data/ui/alarm-setup-dialog.ui | 298 ++++++++++++++++++----------------
 1 file changed, 154 insertions(+), 144 deletions(-)

diff --git a/data/ui/alarm-setup-dialog.ui b/data/ui/alarm-setup-dialog.ui
index f332c4a..2429ce5 100644
--- a/data/ui/alarm-setup-dialog.ui
+++ b/data/ui/alarm-setup-dialog.ui
@@ -17,187 +17,197 @@
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
     <property name="destroy_with_parent">True</property>
-    <property name="default-height">350</property>
-    <property name="height-request">350</property>
     <property name="type_hint">dialog</property>
     <property name="gravity">center</property>
     <property name="title" translatable="yes">New Alarm</property>
     <child internal-child="vbox">
       <object class="GtkBox">
         <property name="visible">True</property>
+        <property name="border-width">0</property>
         <child>
-          <object class="HdyClamp">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
-            <property name="maximum-size">450</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="hscrollbar-policy">never</property>
+            <property name="propagate-natural-height">True</property>
+            <property name="propagate-natural-width">True</property>
             <child>
-              <object class="GtkBox">
+              <object class="HdyClamp">
                 <property name="visible">True</property>
-                <property name="spacing">12</property>
-                <property name="orientation">vertical</property>
+                <property name="maximum-size">450</property>
                 <child>
-                  <object class="GtkGrid" id="time_grid">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="halign">center</property>
-                    <property name="margin_top">12</property>
-                    <property name="column_spacing">6</property>
+                    <property name="orientation">vertical</property>
+                    <property name="margin">12</property>
                     <child>
-                      <object class="GtkLabel" id="dummy_label1">
+                      <object class="GtkGrid" id="time_grid">
                         <property name="visible">True</property>
-                        <property name="margin_start">6</property>
-                        <property name="margin_end">6</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="label">∶</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">2</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="m_spinbutton">
-                        <property name="visible">True</property>
-                        <property name="max_length">2</property>
-                        <property name="activates_default">False</property>
-                        <property name="text">0</property>
-                        <property name="xalign">0.5</property>
-                        <property name="input_purpose">number</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">m_adjustment</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <property name="width-request">60</property>
-                        <signal name="changed" handler="spinbuttons_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
-                        <signal name="output" handler="show_leading_zeros" object="ClocksAlarmSetupDialog" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="left_attach">3</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkStack" id="am_pm_stack">
-                        <property name="visible">True</property>
-                        <property name="margin_start">6</property>
-                        <property name="margin_end">6</property>
+                        <property name="halign">center</property>
+                        <property name="column_spacing">6</property>
                         <child>
-                          <object class="GtkLabel" id="dummy_label2">
+                          <object class="GtkLabel" id="dummy_label1">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
+                            <property name="margin_start">6</property>
+                            <property name="margin_end">6</property>
                           </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="label">∶</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="m_spinbutton">
+                            <property name="visible">True</property>
+                            <property name="max_length">2</property>
+                            <property name="activates_default">False</property>
+                            <property name="text">0</property>
+                            <property name="xalign">0.5</property>
+                            <property name="input_purpose">number</property>
+                            <property name="orientation">vertical</property>
+                            <property name="adjustment">m_adjustment</property>
+                            <property name="numeric">True</property>
+                            <property name="wrap">True</property>
+                            <property name="width-request">60</property>
+                            <signal name="changed" handler="spinbuttons_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
+                            <signal name="output" handler="show_leading_zeros" object="ClocksAlarmSetupDialog" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="top_attach">0</property>
+                          </packing>
                         </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">4</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="h_spinbutton">
-                        <property name="visible">True</property>
-                        <property name="max_length">2</property>
-                        <property name="activates_default">False</property>
-                        <property name="text">0</property>
-                        <property name="xalign">0.5</property>
-                        <property name="input_purpose">number</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">h_adjustment</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <property name="width-request">60</property>
-                        <signal name="changed" handler="spinbuttons_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
-                        <signal name="output" handler="show_leading_zeros" object="ClocksAlarmSetupDialog" swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <style>
-                      <class name="clocks-alarm-setup-time"/>
-                    </style>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkListBox" id="listbox">
-                    <property name="visible">True</property>
-                    <property name="selection_mode">none</property>
-                    <child>
-                      <object class="ClocksAlarmDayPickerRow" id="repeats">
-                        <property name="visible">True</property>
-                        <signal name="days_changed" handler="days_changed" swapped="no" />
-                      </object>
-                    </child>
-                    <child>
-                      <object class="HdyActionRow">
-                        <property name="visible">True</property>
-                        <property name="activatable">False</property>
-                        <property name="selectable">False</property>
-                        <property name="title" translatable="yes">Name</property>
-                        <property name="subtitle" translatable="yes">Optional</property>
                         <child>
-                          <object class="GtkEntry" id="name_entry">
+                          <object class="GtkStack" id="am_pm_stack">
                             <property name="visible">True</property>
-                            <property name="valign">center</property>
-                            <property name="hexpand">True</property>
-                            <property name="activates_default">True</property>
-                            <signal name="changed" handler="entry_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
+                            <property name="margin_start">6</property>
+                            <property name="margin_end">6</property>
+                            <child>
+                              <object class="GtkLabel" id="dummy_label2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                            </child>
                           </object>
+                          <packing>
+                            <property name="left_attach">4</property>
+                            <property name="top_attach">0</property>
+                          </packing>
                         </child>
+                        <child>
+                          <object class="GtkSpinButton" id="h_spinbutton">
+                            <property name="visible">True</property>
+                            <property name="max_length">2</property>
+                            <property name="activates_default">False</property>
+                            <property name="text">0</property>
+                            <property name="xalign">0.5</property>
+                            <property name="input_purpose">number</property>
+                            <property name="orientation">vertical</property>
+                            <property name="adjustment">h_adjustment</property>
+                            <property name="numeric">True</property>
+                            <property name="wrap">True</property>
+                            <property name="width-request">60</property>
+                            <signal name="changed" handler="spinbuttons_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
+                            <signal name="output" handler="show_leading_zeros" object="ClocksAlarmSetupDialog" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <style>
+                          <class name="clocks-alarm-setup-time"/>
+                        </style>
                       </object>
                     </child>
                     <child>
-                      <object class="HdyComboRow" id="ring_duration">
+                      <object class="GtkListBox" id="listbox">
                         <property name="visible">True</property>
-                        <property name="activatable">False</property>
-                        <property name="selectable">False</property>
-                        <property name="title" translatable="yes">Ring Duration</property>
+                        <property name="selection_mode">none</property>
+                        <property name="margin_top">12</property>
+                        <child>
+                          <object class="ClocksAlarmDayPickerRow" id="repeats">
+                            <property name="visible">True</property>
+                            <signal name="days_changed" handler="days_changed" swapped="no" />
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyActionRow">
+                            <property name="visible">True</property>
+                            <property name="activatable">False</property>
+                            <property name="selectable">False</property>
+                            <property name="title" translatable="yes">Name</property>
+                            <property name="subtitle" translatable="yes">Optional</property>
+                            <child>
+                              <object class="GtkEntry" id="name_entry">
+                                <property name="visible">True</property>
+                                <property name="valign">center</property>
+                                <property name="hexpand">True</property>
+                                <property name="activates_default">True</property>
+                                <signal name="changed" handler="entry_changed" object="ClocksAlarmSetupDialog" swapped="no"/>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyComboRow" id="ring_duration">
+                            <property name="visible">True</property>
+                            <property name="activatable">False</property>
+                            <property name="selectable">False</property>
+                            <property name="title" translatable="yes">Ring Duration</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="HdyComboRow" id="snooze_duration">
+                            <property name="visible">True</property>
+                            <property name="activatable">False</property>
+                            <property name="selectable">False</property>
+                            <property name="title" translatable="yes">Snooze Duration</property>
+                          </object>
+                        </child>
+                        <style>
+                          <class name="content"/>
+                        </style>
                       </object>
                     </child>
                     <child>
-                      <object class="HdyComboRow" id="snooze_duration">
+                      <object class="GtkButton" id="delete_button">
                         <property name="visible">True</property>
-                        <property name="activatable">False</property>
-                        <property name="selectable">False</property>
-                        <property name="title" translatable="yes">Snooze Duration</property>
+                        <property name="label" translatable="yes">R_emove Alarm</property>
+                        <property name="use-underline">True</property>
+                        <property name="margin_top">12</property>
+                        <property name="halign">start</property>
+                        <signal name="clicked" handler="delete" swapped="no" />
+                        <style>
+                          <class name="destructive-action"/>
+                        </style>
                       </object>
                     </child>
-                    <style>
-                      <class name="content"/>
-                      <class name="clocks-list"/>
-                    </style>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="delete_button">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">R_emove Alarm</property>
-                    <property name="use-underline">True</property>
-                    <property name="margin">6</property>
-                    <property name="halign">start</property>
-                    <signal name="clicked" handler="delete" swapped="no" />
-                    <style>
-                      <class name="destructive-action"/>
-                    </style>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkRevealer" id="label_revealer">
-                    <property name="visible">True</property>
                     <child>
-                      <object class="GtkLabel" id="warn_label">
+                      <object class="GtkRevealer" id="label_revealer">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">You already have an alarm for this time.</property>
+                        <child>
+                          <object class="GtkLabel" id="warn_label">
+                            <property name="margin_top">12</property>
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">You already have an alarm for this time.</property>
+                          </object>
+                        </child>
                       </object>
                     </child>
                   </object>
+
                 </child>
               </object>
             </child>
-- 
2.29.2