[gnome-calendar] edit-dialog: wrap in a scrolled window



commit 8927e10ae069de602373fd93f03c5eb6d6797434
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 7 14:58:14 2017 -0300

    edit-dialog: wrap in a scrolled window
    
    As we're adding more and more widgets in the Edit dialog,
    it is now growing too tall to fit normal screens. Thus, wrap
    it in a scrolled window, and let the content height cover
    75% of the main window at most.

 data/ui/edit-dialog.ui |  682 ++++++++++++++++++++++++------------------------
 src/gcal-edit-dialog.c |   22 ++
 2 files changed, 368 insertions(+), 336 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index 22455b1..196b984 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -122,194 +122,153 @@
     </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox">
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="visible">true</property>
+        <property name="spacing">0</property>
+        <property name="border_width">0</property>
         <child>
-          <object class="GtkGrid" id="main_grid">
+          <object class="GtkScrolledWindow" id="scrolled_window">
             <property name="visible">True</property>
-            <property name="border_width">18</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">12</property>
-            <child>
-              <object class="GtkLabel" id="summary_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="label" translatable="yes">Title</property>
-                <property name="ellipsize">end</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <signal name="size-allocate" handler="fix_reminders_label_height_cb" 
object="reminders_label" swapped="no" after="yes" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="dates_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="label" translatable="yes">Date</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="label" translatable="yes">Repeat</property>
-                <property name="ellipsize">end</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="reminders_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="valign">start</property>
-                <property name="label" translatable="yes">Reminders</property>
-                <property name="ellipsize">end</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">6</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="notes_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="valign">start</property>
-                <property name="label" translatable="yes">Notes</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">8</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="location_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="margin-top">12</property>
-                <property name="label" translatable="yes">Location</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">7</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="summary_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="activates_default">True</property>
-                <property name="margin-top">12</property>
-                <property name="editable" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <signal name="notify::text" handler="update_summary" object="GcalEditDialog" swapped="no"/>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
+            <property name="can_focus">False</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="min_content_height">400</property>
+            <property name="propagate_natural_height">true</property>
             <child>
-              <object class="GtkBox">
+              <object class="GtkGrid" id="main_grid">
                 <property name="visible">True</property>
-                <property name="hexpand">True</property>
-                <property name="margin-top">12</property>
-                <property name="spacing">6</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                <property name="border_width">18</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">12</property>
                 <child>
-                  <object class="GcalDateSelector" id="start_date_selector">
+                  <object class="GtkLabel" id="summary_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <signal name="notify::date" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="label" translatable="yes">Title</property>
+                    <property name="ellipsize">end</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <signal name="size-allocate" handler="fix_reminders_label_height_cb" 
object="reminders_label" swapped="no" after="yes" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="dates_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="label" translatable="yes">Date</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
                 </child>
                 <child>
                   <object class="GtkLabel">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label">-</property>
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="label" translatable="yes">Repeat</property>
+                    <property name="ellipsize">end</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="reminders_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="valign">start</property>
+                    <property name="label" translatable="yes">Reminders</property>
+                    <property name="ellipsize">end</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="notes_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="valign">start</property>
+                    <property name="label" translatable="yes">Notes</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">8</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="location_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1.0</property>
+                    <property name="margin-top">12</property>
+                    <property name="label" translatable="yes">Location</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">7</property>
+                  </packing>
                 </child>
                 <child>
-                  <object class="GcalDateSelector" id="end_date_selector">
+                  <object class="GtkEntry" id="summary_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <signal name="notify::date" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
+                    <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
+                    <property name="margin-top">12</property>
+                    <property name="editable" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <signal name="notify::text" handler="update_summary" object="GcalEditDialog" 
swapped="no"/>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="times_label">
-                <property name="visible">True</property>
-                <property name="xalign">1.0</property>
-                <property name="label" translatable="yes">Time</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox">
-                <property name="visible">True</property>
                 <child>
                   <object class="GtkBox">
                     <property name="visible">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="margin-top">12</property>
                     <property name="spacing">6</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                     <child>
-                      <object class="GcalTimeSelector" id="start_time_selector">
+                      <object class="GcalDateSelector" id="start_date_selector">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <signal name="notify::time" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
+                        <signal name="notify::date" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
                       </object>
                     </child>
                     <child>
@@ -320,249 +279,300 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GcalTimeSelector" id="end_time_selector">
+                      <object class="GcalDateSelector" id="end_date_selector">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <signal name="notify::time" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
+                        <signal name="notify::date" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
                       </object>
                     </child>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="all_day_check">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="margin-top">12</property>
-                <property name="draw_indicator">True</property>
-                <property name="label" translatable="yes">All Day</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <signal name="toggled" handler="all_day_changed_cb" object="GcalEditDialog" swapped="no"/>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin-top">12</property>
-                <property name="spacing">6</property>
-                <property name="hexpand">True</property>
-                <property name="orientation">vertical</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                 <child>
-                  <object class="GtkListBox" id="alarms_listbox">
-                    <property name="visible">False</property>
-                    <property name="can_focus">False</property>
-                    <property name="selection_mode">none</property>
+                  <object class="GtkLabel" id="times_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1.0</property>
+                    <property name="label" translatable="yes">Time</property>
                     <style>
-                      <class name="background" />
+                      <class name="dim-label"/>
                     </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                  </packing>
                 </child>
                 <child>
-                  <object class="GtkMenuButton" id="alarms_button">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="popover">alarms_popover</property>
                     <child>
                       <object class="GtkBox">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="orientation">horizontal</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GcalTimeSelector" id="start_time_selector">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <signal name="notify::time" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
+                          </object>
+                        </child>
                         <child>
                           <object class="GtkLabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="xalign">0.0</property>
-                            <property name="label" translatable="yes">Add reminder…</property>
+                            <property name="label">-</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GcalTimeSelector" id="end_time_selector">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <signal name="notify::time" handler="sync_datetimes" object="GcalEditDialog" 
swapped="yes" />
                           </object>
                         </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="all_day_check">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="margin-top">12</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="label" translatable="yes">All Day</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <signal name="toggled" handler="all_day_changed_cb" object="GcalEditDialog" 
swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin-top">12</property>
+                    <property name="spacing">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="orientation">vertical</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <child>
+                      <object class="GtkListBox" id="alarms_listbox">
+                        <property name="visible">False</property>
+                        <property name="can_focus">False</property>
+                        <property name="selection_mode">none</property>
+                        <style>
+                          <class name="background" />
+                        </style>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkMenuButton" id="alarms_button">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="popover">alarms_popover</property>
                         <child>
-                          <object class="GtkImage">
+                          <object class="GtkBox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="icon_name">pan-down-symbolic</property>
+                            <property name="orientation">horizontal</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0.0</property>
+                                <property name="label" translatable="yes">Add reminder…</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="icon_name">pan-down-symbolic</property>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
                     </child>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">6</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">6</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <!-- combo-box with options to define the recurrence-rules !-->
-            <child>
-              <object class="GtkComboBoxText" id="repeat_combo">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin-top">12</property>
-                <property name="hexpand">True</property>
-                <signal name="changed" handler="repeat_type_changed" object="GcalEditDialog" swapped="no"/>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <items>
-                  <item translatable="yes" id="no_repeat">No Repeat</item>
-                  <item translatable="yes" id="daily">Daily</item>
-                  <item translatable="yes" id="mon_fri">Monday – Friday</item>
-                  <item translatable="yes" id="weekly">Weekly</item>
-                  <item translatable="yes" id="monthly">Monthly</item>
-                  <item translatable="yes" id="yearly">Yearly</item>
-                </items>
-                <property name="active_id">no_repeat</property>
-                <style>
-                  <class name="background" />
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">4</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="repeat_limits_box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <property name="hexpand">True</property>
-                <property name="orientation">horizontal</property>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                <!-- combo-box with options to define the recurrence-rules !-->
                 <child>
-                  <object class="GtkComboBoxText" id="repeat_duration_combo">
+                  <object class="GtkComboBoxText" id="repeat_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="margin-top">12</property>
                     <property name="hexpand">True</property>
-                    <signal name="changed" handler="repeat_duration_changed" object="GcalEditDialog" 
swapped="no"/>
+                    <signal name="changed" handler="repeat_type_changed" object="GcalEditDialog" 
swapped="no"/>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                     <items>
-                      <item translatable="yes" id="forever">Forever</item>
-                      <item translatable="yes" id="number_of_occurrences_spin">No. of occurrences</item>
-                      <item translatable="yes" id="until_date">Until Date</item>
+                      <item translatable="yes" id="no_repeat">No Repeat</item>
+                      <item translatable="yes" id="daily">Daily</item>
+                      <item translatable="yes" id="mon_fri">Monday – Friday</item>
+                      <item translatable="yes" id="weekly">Weekly</item>
+                      <item translatable="yes" id="monthly">Monthly</item>
+                      <item translatable="yes" id="yearly">Yearly</item>
                     </items>
-                    <property name="active_id">forever</property>
+                    <property name="active_id">no_repeat</property>
                     <style>
                       <class name="background" />
                     </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
                 <child>
-                  <object class="GtkStack" id="repeat_duration_stack">
+                  <object class="GtkBox" id="repeat_limits_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">end</property>
-
+                    <property name="spacing">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="orientation">horizontal</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                     <child>
-                      <object class = "GtkSpinButton" id="number_of_occurrences_spin">
+                      <object class="GtkComboBoxText" id="repeat_duration_combo">
                         <property name="visible">True</property>
-                        <property name="input_purpose">number</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <signal name="changed" handler="repeat_duration_changed" object="GcalEditDialog" 
swapped="no"/>
+                        <items>
+                          <item translatable="yes" id="forever">Forever</item>
+                          <item translatable="yes" id="number_of_occurrences_spin">No. of occurrences</item>
+                          <item translatable="yes" id="until_date">Until Date</item>
+                        </items>
+                        <property name="active_id">forever</property>
+                        <style>
+                          <class name="background" />
+                        </style>
                       </object>
                     </child>
-
                     <child>
-                      <object class = "GcalDateSelector" id="until_date_selector">
+                      <object class="GtkStack" id="repeat_duration_stack">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+
+                        <child>
+                          <object class = "GtkSpinButton" id="number_of_occurrences_spin">
+                            <property name="visible">True</property>
+                            <property name="input_purpose">number</property>
+                          </object>
+                        </child>
+
+                        <child>
+                          <object class = "GcalDateSelector" id="until_date_selector">
+                            <property name="visible">True</property>
+                          </object>
+                        </child>
+                        <style>
+                          <class name="background" />
+                        </style>
                       </object>
                     </child>
-                    <style>
-                      <class name="background" />
-                    </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">5</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">5</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="location_entry">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="margin-top">12</property>
-                <property name="secondary_icon_name">find-location-symbolic</property>
-                <property name="editable" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                <signal name="notify::text" handler="update_location" object="GcalEditDialog" swapped="no"/>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">7</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolled_window">
-                <property name="height_request">120</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="margin-top">12</property>
-                <property name="vexpand">True</property>
-                <property name="shadow_type">in</property>
                 <child>
-                  <object class="GtkTextView" id="notes_text">
+                  <object class="GtkEntry" id="location_entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="top_margin">6</property>
-                    <property name="bottom_margin">6</property>
-                    <property name="left_margin">6</property>
-                    <property name="right_margin">6</property>
-                    <property name="sensitive">True</property>
+                    <property name="margin-top">12</property>
+                    <property name="secondary_icon_name">find-location-symbolic</property>
                     <property name="editable" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                    <property name="cursor_visible" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                    <property name="wrap_mode">GTK_WRAP_WORD_CHAR</property>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <signal name="notify::text" handler="update_location" object="GcalEditDialog" 
swapped="no"/>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">7</property>
+                    <property name="width">4</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">8</property>
-                <property name="width">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="delete_button">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="margin-top">12</property>
-                <signal name="clicked" handler="action_button_clicked" object="GcalEditDialog" swapped="no"/>
-                <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
                 <child>
-                  <object class="GtkLabel" id="delete_label">
+                  <object class="GtkScrolledWindow">
+                    <property name="min_content_height">120</property>
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">Delete Event</property>
+                    <property name="can_focus">True</property>
+                    <property name="margin-top">12</property>
+                    <property name="vexpand">True</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTextView" id="notes_text">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="top_margin">6</property>
+                        <property name="bottom_margin">6</property>
+                        <property name="left_margin">6</property>
+                        <property name="right_margin">6</property>
+                        <property name="sensitive">True</property>
+                        <property name="editable" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                        <property name="cursor_visible" bind-source="GcalEditDialog" 
bind-property="writable" bind-flags="default" />
+                        <property name="wrap_mode">GTK_WRAP_WORD_CHAR</property>
+                      </object>
+                    </child>
                   </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">8</property>
+                    <property name="width">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="delete_button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="margin-top">12</property>
+                    <signal name="clicked" handler="action_button_clicked" object="GcalEditDialog" 
swapped="no"/>
+                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <child>
+                      <object class="GtkLabel" id="delete_label">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Delete Event</property>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="destructive-action"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">9</property>
+                  </packing>
                 </child>
-                <style>
-                  <class name="destructive-action"/>
-                </style>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">9</property>
+                <property name="expand">True</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 5a70d39..f9ecbfb 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -56,6 +56,8 @@ struct _GcalEditDialog
   GtkWidget        *title_label;
   GtkWidget        *subtitle_label;
 
+  GtkWidget        *scrolled_window;
+
   GtkWidget        *lock;
   GtkWidget        *source_image;
   GtkWidget        *source_label;
@@ -301,6 +303,19 @@ remove_recurrence_properties (GcalEvent *event)
 }
 
 static void
+transient_size_allocate_cb (GcalEditDialog *self)
+{
+  GtkAllocation alloc;
+  GtkWindow *transient;
+
+  transient = gtk_window_get_transient_for (GTK_WINDOW (self));
+  gtk_widget_get_allocation (GTK_WIDGET (transient), &alloc);
+
+  gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window),
+                                              MAX (400, (gint) (0.75 * alloc.height)));
+}
+
+static void
 update_location (GtkEntry   *entry,
                  GParamSpec *pspec,
                  gpointer    user_data)
@@ -659,6 +674,12 @@ gcal_edit_dialog_constructed (GObject* object)
   gtk_widget_insert_action_group (GTK_WIDGET (self),
                                   "edit",
                                   G_ACTION_GROUP (self->action_group));
+
+  /* Watch the main window and adapt the maximum size */
+  g_signal_connect_swapped (gtk_window_get_transient_for (GTK_WINDOW (self)),
+                            "size-allocate",
+                            G_CALLBACK (transient_size_allocate_cb),
+                            self);
 }
 
 static void
@@ -801,6 +822,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_duration_combo);
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_duration_stack);
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, repeat_limits_box);
+  gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, scrolled_window);
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, source_image);
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, sources_popover);
   gtk_widget_class_bind_template_child (widget_class, GcalEditDialog, until_date_selector);



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