[gnome-calendar/calendar-editor] source-dialog: make remove action local to the dialog



commit 0dc6b7eed4329310759ff09186e3c3a52f92b1d8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Apr 9 07:11:07 2015 -0300

    source-dialog: make remove action local to the dialog
    
    Instead of delegating it to GcalWindow, take
    the responsability to manage the source removal
    logic.
    
    This commit expose a problem we were trying to
    avoid: make our widgets sensitive to source
    modifications.

 data/ui/source-dialog.ui | 1247 +++++++++++++++++++++++++---------------------
 src/gcal-source-dialog.c |  196 ++++++++-
 src/gcal-window.c        |   88 +----
 3 files changed, 864 insertions(+), 667 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index db9d794..03a3614 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -26,750 +26,839 @@
           </packing>
         </child>
         <child>
-          <object class="GtkStack" id="stack">
+          <object class="GtkOverlay" id="overlay">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
-            <property name="vhomogeneous">False</property>
-            <property name="transition_type">crossfade</property>
-            <signal name="notify::visible-child-name" handler="stack_visible_child_name_changed" 
object="GcalSourceDialog" swapped="no"/>
-            <child>
-              <object class="GtkScrolledWindow" id="main_scrolledwindow">
+            <child type="overlay">
+              <object class="GtkRevealer" id="notification">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">never</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="valign">start</property>
+                <property name="transition_duration">100</property>
+                <signal name="notify::child-revealed" handler="notification_child_revealed_changed" 
object="GcalSourceDialog" swapped="no"/>
                 <child>
-                  <object class="GtkViewport" id="main_viewport">
+                  <object class="GtkFrame">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="shadow_type">none</property>
                     <child>
-                      <object class="GtkBox" id="main_box">
+                      <object class="GtkGrid">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="border_width">18</property>
-                        <property name="orientation">vertical</property>
-                        <property name="spacing">18</property>
+                        <property name="margin_start">12</property>
+                        <property name="margin_end">12</property>
+                        <property name="margin_top">2</property>
+                        <property name="margin_bottom">2</property>
+                        <property name="column_spacing">12</property>
                         <child>
-                          <object class="GtkGrid" id="online_account_main_grid">
+                          <object class="GtkLabel" id="notification_label">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="row_spacing">12</property>
-                            <property name="column_spacing">12</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="notification_action_button">
+                            <property name="label" translatable="yes">Undo</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="no_show_all">True</property>
+                            <signal name="clicked" handler="undo_remove_action" object="GcalSourceDialog" 
swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                          <style>
+                            <class name="text-button"/>
+                          </style>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="notification_close_button">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="relief">none</property>
+                            <property name="focus_on_click">False</property>
+                            <signal name="clicked" handler="hide_notification" object="GcalSourceDialog" 
swapped="yes"/>
                             <child>
-                              <object class="GtkLabel" id="online_account_label">
+                              <object class="GtkImage">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="label" translatable="yes">Online Accounts</property>
-                                <property name="xalign">0</property>
-                                <attributes>
-                                  <attribute name="weight" value="bold"/>
-                                </attributes>
+                                <property name="icon_name">window-close-symbolic</property>
+                                <property name="icon_size">2</property>
                               </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                              </packing>
                             </child>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="app-notification"/>
+                    </style>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkStack" id="stack">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="vhomogeneous">False</property>
+                <property name="transition_type">crossfade</property>
+                <signal name="notify::visible-child-name" handler="stack_visible_child_name_changed" 
object="GcalSourceDialog" swapped="no"/>
+                <child>
+                  <object class="GtkScrolledWindow" id="main_scrolledwindow">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">never</property>
+                    <child>
+                      <object class="GtkViewport" id="main_viewport">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkBox" id="main_box">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="border_width">18</property>
+                            <property name="orientation">vertical</property>
+                            <property name="spacing">18</property>
                             <child>
-                              <object class="GtkButton" id="online_accounts_settings_button">
+                              <object class="GtkGrid" id="online_account_main_grid">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <property name="tooltip_text" translatable="yes">Open online account 
settings</property>
-                                <signal name="clicked" handler="online_accounts_settings_button_clicked" 
object="GcalSourceDialog" swapped="no" />
+                                <property name="can_focus">False</property>
+                                <property name="row_spacing">12</property>
+                                <property name="column_spacing">12</property>
                                 <child>
-                                  <object class="GtkImage" id="online_accounts_settings_button_image">
+                                  <object class="GtkLabel" id="online_account_label">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="icon_name">emblem-system-symbolic</property>
+                                    <property name="hexpand">True</property>
+                                    <property name="label" translatable="yes">Online Accounts</property>
+                                    <property name="xalign">0</property>
+                                    <attributes>
+                                      <attribute name="weight" value="bold"/>
+                                    </attributes>
                                   </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkButton" id="online_accounts_settings_button">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="tooltip_text" translatable="yes">Open online account 
settings</property>
+                                    <signal name="clicked" handler="online_accounts_settings_button_clicked" 
object="GcalSourceDialog" swapped="no" />
+                                    <child>
+                                      <object class="GtkImage" id="online_accounts_settings_button_image">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="icon_name">emblem-system-symbolic</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="top_attach">0</property>
+                                  </packing>
                                 </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkFrame" id="online_accounts_main_frame">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label_xalign">0</property>
                                 <child>
-                                  <object class="GtkListBox" id="online_accounts_listbox">
+                                  <object class="GtkFrame" id="online_accounts_main_frame">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="selection_mode">none</property>
+                                    <property name="label_xalign">0</property>
                                     <child>
-                                      <object class="GtkListBoxRow" id="google_stub_row">
+                                      <object class="GtkListBox" id="online_accounts_listbox">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="selection_mode">none</property>
                                         <child>
-                                          <object class="GtkBox" id="google_stub_box">
+                                          <object class="GtkListBoxRow" id="google_stub_row">
                                             <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="border_width">6</property>
-                                            <property name="spacing">12</property>
-                                            <child>
-                                              <object class="GtkImage" id="google_account_image">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">False</property>
-                                                <property name="pixel_size">32</property>
-                                                <property name="icon_name">goa-account-google</property>
-                                              </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">0</property>
-                                              </packing>
-                                            </child>
+                                            <property name="can_focus">True</property>
                                             <child>
-                                              <object class="GtkLabel" id="google_account_label">
+                                              <object class="GtkBox" id="google_stub_box">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label" translatable="yes">Google</property>
+                                                <property name="border_width">6</property>
+                                                <property name="spacing">12</property>
+                                                <child>
+                                                  <object class="GtkImage" id="google_account_image">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="pixel_size">32</property>
+                                                    <property name="icon_name">goa-account-google</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkLabel" id="google_account_label">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" 
translatable="yes">Google</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
                                               </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">1</property>
-                                              </packing>
                                             </child>
                                           </object>
                                         </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkListBoxRow" id="owncloud_stub_row">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
                                         <child>
-                                          <object class="GtkBox" id="owncloud_stub_box">
+                                          <object class="GtkListBoxRow" id="owncloud_stub_row">
                                             <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="border_width">6</property>
-                                            <property name="spacing">12</property>
-                                            <child>
-                                              <object class="GtkImage" id="owncloud_account_image">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">False</property>
-                                                <property name="pixel_size">32</property>
-                                                <property name="icon_name">goa-account-owncloud</property>
-                                              </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">0</property>
-                                              </packing>
-                                            </child>
+                                            <property name="can_focus">True</property>
                                             <child>
-                                              <object class="GtkLabel" id="owncloud_account_label">
+                                              <object class="GtkBox" id="owncloud_stub_box">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label" translatable="yes">ownCloud</property>
+                                                <property name="border_width">6</property>
+                                                <property name="spacing">12</property>
+                                                <child>
+                                                  <object class="GtkImage" id="owncloud_account_image">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="pixel_size">32</property>
+                                                    <property 
name="icon_name">goa-account-owncloud</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkLabel" id="owncloud_account_label">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" 
translatable="yes">ownCloud</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
                                               </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">1</property>
-                                              </packing>
                                             </child>
                                           </object>
                                         </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkListBoxRow" id="exchange_stub_row">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
                                         <child>
-                                          <object class="GtkBox" id="exchange_stub_box">
+                                          <object class="GtkListBoxRow" id="exchange_stub_row">
                                             <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="border_width">6</property>
-                                            <property name="spacing">12</property>
+                                            <property name="can_focus">True</property>
                                             <child>
-                                              <object class="GtkImage" id="exchange_account_image">
+                                              <object class="GtkBox" id="exchange_stub_box">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="pixel_size">32</property>
-                                                <property name="icon_name">goa-account</property>
+                                                <property name="border_width">6</property>
+                                                <property name="spacing">12</property>
+                                                <child>
+                                                  <object class="GtkImage" id="exchange_account_image">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="pixel_size">32</property>
+                                                    <property name="icon_name">goa-account</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkLabel" id="exchange_account_label">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" translatable="yes">Microsoft 
Exchange</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
                                               </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">0</property>
-                                              </packing>
-                                            </child>
-                                            <child>
-                                              <object class="GtkLabel" id="exchange_account_label">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">False</property>
-                                                <property name="label" translatable="yes">Microsoft 
Exchange</property>
-                                              </object>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">True</property>
-                                                <property name="position">1</property>
-                                              </packing>
                                             </child>
                                           </object>
                                         </child>
                                       </object>
                                     </child>
                                   </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="width">2</property>
+                                  </packing>
                                 </child>
                               </object>
                               <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">2</property>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
                               </packing>
                             </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkGrid" id="other_calendars_main_grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="row_spacing">12</property>
-                            <property name="column_spacing">12</property>
                             <child>
-                              <object class="GtkLabel" id="calendars_header_label">
+                              <object class="GtkGrid" id="other_calendars_main_grid">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="label" translatable="yes">Calendars</property>
-                                <property name="xalign">0</property>
-                                <attributes>
-                                  <attribute name="weight" value="bold"/>
-                                </attributes>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkFrame" id="other_calendars_main_frame">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label_xalign">0</property>
+                                <property name="row_spacing">12</property>
+                                <property name="column_spacing">12</property>
                                 <child>
-                                  <object class="GtkListBox" id="calendars_listbox">
+                                  <object class="GtkLabel" id="calendars_header_label">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="selection_mode">none</property>
-                                    <signal name="row-activated" handler="calendar_listbox_row_activated" 
object="GcalSourceDialog" swapped="no" />
+                                    <property name="hexpand">True</property>
+                                    <property name="label" translatable="yes">Calendars</property>
+                                    <property name="xalign">0</property>
+                                    <attributes>
+                                      <attribute name="weight" value="bold"/>
+                                    </attributes>
                                   </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">0</property>
+                                  </packing>
                                 </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkMenuButton" id="add_calendar_menu_button">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
                                 <child>
-                                  <object class="GtkBox" id="add_calendar_button_box">
+                                  <object class="GtkFrame" id="other_calendars_main_frame">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">6</property>
+                                    <property name="label_xalign">0</property>
                                     <child>
-                                      <object class="GtkLabel" id="add_calendar_button">
+                                      <object class="GtkListBox" id="calendars_listbox">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes">Add</property>
+                                        <property name="selection_mode">none</property>
+                                        <signal name="row-activated" 
handler="calendar_listbox_row_activated" object="GcalSourceDialog" swapped="no" />
                                       </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
                                     </child>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="width">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkMenuButton" id="add_calendar_menu_button">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
                                     <child>
-                                      <object class="GtkImage" id="add_calendar_button_image">
+                                      <object class="GtkBox" id="add_calendar_button_box">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="icon_name">pan-down-symbolic</property>
+                                        <property name="spacing">6</property>
+                                        <child>
+                                          <object class="GtkLabel" id="add_calendar_button">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">Add</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkImage" id="add_calendar_button_image">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="icon_name">pan-down-symbolic</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
                                       </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">1</property>
-                                      </packing>
                                     </child>
                                   </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="top_attach">0</property>
+                                  </packing>
                                 </child>
                               </object>
                               <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                       </object>
                     </child>
                   </object>
-                </child>
-              </object>
-              <packing>
-                <property name="name">main</property>
-                <property name="title" translatable="yes">Overview</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkGrid" id="edit_grid">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
-                <property name="border_width">18</property>
-                <property name="row_spacing">12</property>
-                <property name="column_spacing">12</property>
-                <child>
-                  <object class="GtkCheckButton" id="default_check">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="notify::active" handler="default_check_toggled" object="GcalSourceDialog" 
swapped="no"/>
-                    <child>
-                      <object class="GtkLabel" id="default_check_label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Add new events to this calendar by 
default</property>
-                        <property name="xalign">0</property>
-                      </object>
-                    </child>
-                  </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">5</property>
-                    <property name="width">2</property>
+                    <property name="name">main</property>
+                    <property name="title" translatable="yes">Overview</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="remove_button">
-                    <property name="label" translatable="yes">Remove Calendar</property>
+                  <object class="GtkGrid" id="edit_grid">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="halign">end</property>
-                    <property name="valign">end</property>
-                    <property name="margin_top">6</property>
+                    <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <signal name="clicked" handler="action_widget_activated" object="GcalSourceDialog" 
swapped="no"/>
-                    <style>
-                      <class name="destructive-action"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">6</property>
-                    <property name="width">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkCheckButton" id="calendar_visible_check">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="notify::active" handler="calendar_visible_check_toggled" 
object="GcalSourceDialog" swapped="no"/>
+                    <property name="border_width">18</property>
+                    <property name="row_spacing">12</property>
+                    <property name="column_spacing">12</property>
                     <child>
-                      <object class="GtkLabel" id="display_calendar_check_label">
+                      <object class="GtkCheckButton" id="default_check">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Display calendar</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0.5</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="notify::active" handler="default_check_toggled" 
object="GcalSourceDialog" swapped="no"/>
+                        <child>
+                          <object class="GtkLabel" id="default_check_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Add new events to this calendar by 
default</property>
+                            <property name="xalign">0</property>
+                          </object>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">5</property>
+                        <property name="width">2</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">4</property>
-                    <property name="width">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkColorButton" id="calendar_color_button">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="halign">start</property>
-                    <signal name="color-set" handler="color_set" object="GcalSourceDialog" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="name_entry">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <signal name="notify::text" handler="name_entry_text_changed" object="GcalSourceDialog" 
swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="calendar_dim_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Calendar name</property>
-                    <property name="xalign">1</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="GtkLabel" id="color_dim_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Color</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">3</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="account_dim_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Account</property>
-                    <property name="xalign">1</property>
-                    <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="location_dim_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Location</property>
-                    <property name="xalign">1</property>
-                    <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="GtkBox" id="account_box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">12</property>
                     <child>
-                      <object class="GtkLabel" id="account_label">
+                      <object class="GtkButton" id="remove_button">
+                        <property name="label" translatable="yes">Remove Calendar</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">end</property>
+                        <property name="margin_top">6</property>
                         <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <signal name="clicked" handler="remove_button_clicked" object="GcalSourceDialog" 
swapped="no"/>
+                        <style>
+                          <class name="destructive-action"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">6</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="calendar_visible_check">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
                         <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="notify::active" handler="calendar_visible_check_toggled" 
object="GcalSourceDialog" swapped="no"/>
+                        <child>
+                          <object class="GtkLabel" id="display_calendar_check_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Display calendar</property>
+                          </object>
+                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">2</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="settings_button">
-                        <property name="label" translatable="yes">Settings</property>
+                      <object class="GtkColorButton" id="calendar_color_button">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
+                        <property name="halign">start</property>
+                        <signal name="color-set" handler="color_set" object="GcalSourceDialog" swapped="no"/>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLinkButton" id="calendar_url_button">
-                    <property name="label" translatable="yes">button</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="relief">none</property>
-                    <property name="xalign">0</property>
-                    <property name="uri">http://glade.gnome.org</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="name">edit</property>
-                <property name="title" translatable="yes">Edit Calendar</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkGrid" id="web_source_grid">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">18</property>
-                <property name="row_spacing">16</property>
-                <property name="column_spacing">12</property>
-                <child>
-                  <object class="GtkLabel" id="web_description_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Enter the address of the calendar that you 
want to add. If the calendar belongs to one of you online accounts, you can add it through the &lt;a 
href="GOA"&gt;online account settings&lt;/a&gt;.</property>
-                    <property name="use_markup">True</property>
-                    <property name="wrap">True</property>
-                    <property name="xalign">0</property>
-                    <signal name="activate-link" handler="description_label_link_activated" 
object="GcalSourceDialog" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="calendar_address_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Calendar Address</property>
-                    <property name="xalign">1</property>
-                    <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="GtkEntry" id="calendar_address_entry">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <signal name="notify::text" handler="url_entry_text_changed" object="GcalSourceDialog" 
swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkRevealer" id="web_sources_revealer">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkScrolledWindow" id="web_list_scrolledwindow">
-                        <property name="height_request">100</property>
+                      <object class="GtkEntry" id="name_entry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="shadow_type">etched-in</property>
-                        <child>
-                          <object class="GtkViewport" id="viewport">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="shadow_type">none</property>
-                            <child>
-                              <object class="GtkListBox" id="web_sources_listbox">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="activate_on_single_click">False</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
+                        <signal name="notify::text" handler="name_entry_text_changed" 
object="GcalSourceDialog" swapped="no"/>
                       </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkFrame" id="web_details_frame">
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">none</property>
                     <child>
-                      <object class="GtkGrid" id="web_details_grid">
+                      <object class="GtkLabel" id="calendar_dim_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="margin_bottom">18</property>
-                        <property name="row_spacing">12</property>
-                        <property name="column_spacing">12</property>
+                        <property name="label" translatable="yes">Calendar name</property>
+                        <property name="xalign">1</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="GtkLabel" id="color_dim_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Color</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="account_dim_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Account</property>
+                        <property name="xalign">1</property>
+                        <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="location_dim_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Location</property>
+                        <property name="xalign">1</property>
+                        <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="GtkBox" id="account_box">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkLabel" id="web_title_label">
+                          <object class="GtkLabel" id="account_label">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_bottom">6</property>
                             <property name="hexpand">True</property>
-                            <property name="label" translatable="yes">Calendar Details</property>
                             <property name="xalign">0</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="web_name_dim_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Name</property>
-                            <property name="xalign">1</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkEntry" id="web_new_calendar_name_entry">
+                          <object class="GtkButton" id="settings_button">
+                            <property name="label" translatable="yes">Settings</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="hexpand">True</property>
-                            <signal name="notify::text" handler="new_name_entry_text_changed" 
object="GcalSourceDialog" swapped="no"/>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="web_author_dim_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Author</property>
-                            <property name="xalign">1</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
+                            <property name="receives_default">True</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="web_author_label">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">2</property>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLinkButton" id="calendar_url_button">
+                        <property name="label" translatable="yes">button</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="relief">none</property>
+                        <property name="xalign">0</property>
+                        <property name="uri">http://glade.gnome.org</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="name">edit</property>
+                    <property name="title" translatable="yes">Edit Calendar</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkGrid" id="web_source_grid">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">18</property>
+                    <property name="row_spacing">16</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="web_description_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Enter the address of the calendar that you 
want to add. If the calendar belongs to one of you online accounts, you can add it through the &lt;a 
href="GOA"&gt;online account settings&lt;/a&gt;.</property>
+                        <property name="use_markup">True</property>
+                        <property name="wrap">True</property>
+                        <property name="xalign">0</property>
+                        <signal name="activate-link" handler="description_label_link_activated" 
object="GcalSourceDialog" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="calendar_address_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Calendar Address</property>
+                        <property name="xalign">1</property>
+                        <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="GtkEntry" id="calendar_address_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <signal name="notify::text" handler="url_entry_text_changed" 
object="GcalSourceDialog" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRevealer" id="web_sources_revealer">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <child>
-                          <object class="GtkLabel" id="web_events_label">
+                          <object class="GtkScrolledWindow" id="web_list_scrolledwindow">
+                            <property name="height_request">100</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
+                            <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
+                            <property name="vexpand">True</property>
+                            <property name="shadow_type">etched-in</property>
+                            <child>
+                              <object class="GtkViewport" id="viewport">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="shadow_type">none</property>
+                                <child>
+                                  <object class="GtkListBox" id="web_sources_listbox">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="activate_on_single_click">False</property>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
                           </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">3</property>
-                          </packing>
                         </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkFrame" id="web_details_frame">
+                        <property name="can_focus">False</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkLabel" id="web_last_edited_label">
+                          <object class="GtkGrid" id="web_details_grid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
+                            <property name="margin_bottom">18</property>
+                            <property name="row_spacing">12</property>
+                            <property name="column_spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="web_title_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="margin_bottom">6</property>
+                                <property name="hexpand">True</property>
+                                <property name="label" translatable="yes">Calendar Details</property>
+                                <property name="xalign">0</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="web_name_dim_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Name</property>
+                                <property name="xalign">1</property>
+                                <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="GtkEntry" id="web_new_calendar_name_entry">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="hexpand">True</property>
+                                <signal name="notify::text" handler="new_name_entry_text_changed" 
object="GcalSourceDialog" swapped="no"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="web_author_dim_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Author</property>
+                                <property name="xalign">1</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="GtkLabel" id="web_author_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="web_events_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="web_last_edited_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">4</property>
+                              </packing>
+                            </child>
                           </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">4</property>
-                          </packing>
                         </child>
+                        <style>
+                          <class name="details-frame"/>
+                        </style>
                       </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">2</property>
+                      </packing>
                     </child>
-                    <style>
-                      <class name="details-frame"/>
-                    </style>
                   </object>
                   <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">4</property>
-                    <property name="width">2</property>
+                    <property name="name">create</property>
+                    <property name="title" translatable="yes">Add Calendar</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
-              <packing>
-                <property name="name">create</property>
-                <property name="title" translatable="yes">Add Calendar</property>
-                <property name="position">2</property>
-              </packing>
             </child>
           </object>
           <packing>
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index ba118ff..9574f7e 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -38,6 +38,17 @@ typedef struct
   GtkWidget          *remove_button;
   GtkWidget          *stack;
 
+  /* notification */
+  GtkWidget          *notification;
+  GtkWidget          *notification_label;
+
+  /* edit page widgets */
+  GtkWidget          *account_box;
+  GtkWidget          *account_label;
+  GtkWidget          *account_dim_label;
+  GtkWidget          *calendar_url_button;
+  GtkWidget          *location_dim_label;
+
   /* new source details */
   GtkWidget          *author_label;
   GtkWidget          *calendar_address_entry;
@@ -48,8 +59,9 @@ typedef struct
   GtkWidget          *web_sources_listbox;
   GtkWidget          *web_sources_revealer;
 
-  gint                validate_url_resource_id;
   gint                calendar_address_id;
+  gint                validate_url_resource_id;
+  gint                notification_timeout_id;
 
   /* overview widgets */
   GtkWidget          *add_calendar_menu_button;
@@ -60,6 +72,7 @@ typedef struct
   GcalSourceDialogMode mode;
   ESource            *source;
   ESource            *remote_source;
+  ESource            *removed_source;
   ESource            *old_default_source;
   GBinding           *title_bind;
   gboolean           *prompt_password;
@@ -1314,6 +1327,177 @@ remove_source (GcalManager *manager,
   g_list_free (children);
 }
 
+/**
+ * notification_child_revealed_changed:
+ *
+ * Remove the source after the notification
+ * is hidden.
+ *
+ * Returns:
+ */
+static void
+notification_child_revealed_changed (GtkWidget  *notification,
+                                     GParamSpec *spec,
+                                     gpointer    user_data)
+{
+  GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+
+  if (gtk_revealer_get_child_revealed (GTK_REVEALER (notification)))
+      return;
+
+  /* If we have any removed source, delete it */
+  if (priv->removed_source != NULL)
+    {
+      GError *error = NULL;
+
+      /* We don't really want to remove non-removable sources */
+      if (!e_source_get_removable (priv->removed_source))
+        return;
+
+      // Enable the source again to remove it's name from disabled list
+      gcal_manager_enable_source (priv->manager, priv->removed_source);
+
+      e_source_remove_sync (priv->removed_source, NULL, &error);
+
+      /**
+       * If something goes wrong, throw
+       * an alert and add the source back.
+       */
+      if (error != NULL)
+        {
+          g_warning ("[source-dialog] Error removing source: %s", error->message);
+
+          add_source (priv->manager, priv->removed_source,
+                      gcal_manager_source_enabled (priv->manager, priv->removed_source), user_data);
+
+          gcal_manager_enable_source (priv->manager, priv->removed_source);
+
+          g_error_free (error);
+        }
+    }
+}
+
+/**
+ * undo_remove_action:
+ *
+ * Readd the removed source.
+ *
+ * Returns:
+ */
+static void
+undo_remove_action (GtkButton *button,
+                    gpointer   user_data)
+{
+  GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+
+  /* if there's any set source, unremove it */
+  if (priv->removed_source != NULL)
+    {
+      // Enable the source before adding it again
+      gcal_manager_enable_source (priv->manager, priv->removed_source);
+
+      add_source (priv->manager, priv->removed_source,
+                  gcal_manager_source_enabled (priv->manager, priv->removed_source), user_data);
+
+      /*
+       * Don't clear the pointer, since we don't
+       * want to erase the source at all.
+       */
+      priv->removed_source = NULL;
+
+      // Hide notification
+      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->notification), FALSE);
+    }
+}
+
+/**
+ * hide_notification:
+ *
+ * Helper function that hides the
+ * notification, causing the removal
+ * of the source (when valid).
+ *
+ * Returns:
+ */
+static void
+hide_notification (GcalSourceDialog *dialog,
+                   GtkWidget        *button)
+{
+  GcalSourceDialogPrivate *priv = dialog->priv;
+  gtk_revealer_set_reveal_child (GTK_REVEALER (priv->notification), FALSE);
+  priv->notification_timeout_id = 0;
+}
+
+/**
+ * hide_notification_scheduled:
+ *
+ * Limit the ammount of time that
+ * the notification is shown.
+ *
+ * Returns: %FALSE
+ */
+static gboolean
+hide_notification_scheduled (gpointer dialog)
+{
+  hide_notification (GCAL_SOURCE_DIALOG (dialog), NULL);
+  return FALSE;
+}
+
+/**
+ * remove_button_clicked:
+ *
+ * Trigger the source removal
+ * logic.
+ *
+ * Returns:
+ */
+static void
+remove_button_clicked (GtkWidget *button,
+                       gpointer   user_data)
+{
+  GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+
+  if (priv->source != NULL)
+    {
+      GList *children, *l;
+      gchar *str;
+
+      priv->removed_source = priv->source;
+      priv->source = NULL;
+      children = gtk_container_get_children (GTK_CONTAINER (priv->calendars_listbox));
+
+      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->notification), TRUE);
+
+      // Remove the listbox entry (if any)
+      for (l = children; l != NULL; l = l->next)
+        {
+          if (g_object_get_data (l->data, "source") == priv->removed_source)
+            {
+              gtk_widget_destroy (l->data);
+              break;
+            }
+        }
+
+      // Update notification label
+      str = g_strdup_printf (_("Calendar <b>%s</b> removed"), e_source_get_display_name 
(priv->removed_source));
+      gtk_label_set_markup (GTK_LABEL (priv->notification_label), str);
+
+      // Remove old notifications
+      if (priv->notification_timeout_id != 0)
+        g_source_remove (priv->notification_timeout_id);
+
+      priv->notification_timeout_id = g_timeout_add_seconds (5, hide_notification_scheduled, user_data);
+
+      // Disable the source, so it gets hidden
+      gcal_manager_disable_source (priv->manager, priv->removed_source);
+
+      g_list_free (children);
+      g_free (str);
+    }
+
+  gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
+}
+
 GcalSourceDialog *
 gcal_source_dialog_new (void)
 {
@@ -1377,18 +1561,24 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
   /* bind things for/from the template class */
   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 
"/org/gnome/calendar/source-dialog.ui");
 
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, account_box);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, account_label);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, add_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, add_calendar_menu_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, back_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendar_address_entry);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendar_color_button);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendar_url_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendar_visible_check);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendars_listbox);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, cancel_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, default_check);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, edit_grid);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, headerbar);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, location_dim_label);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, name_entry);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, notification);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, notification_label);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, online_accounts_listbox);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, remove_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
@@ -1408,11 +1598,15 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, color_set);
   gtk_widget_class_bind_template_callback (widget_class, default_check_toggled);
   gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
+  gtk_widget_class_bind_template_callback (widget_class, hide_notification);
   gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
   gtk_widget_class_bind_template_callback (widget_class, new_name_entry_text_changed);
+  gtk_widget_class_bind_template_callback (widget_class, notification_child_revealed_changed);
   gtk_widget_class_bind_template_callback (widget_class, online_accounts_settings_button_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, remove_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, response_signal);
   gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_name_changed);
+  gtk_widget_class_bind_template_callback (widget_class, undo_remove_action);
   gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
 }
 
diff --git a/src/gcal-window.c b/src/gcal-window.c
index e5e73f5..dda396a 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -115,8 +115,6 @@ typedef struct
   gint                 refresh_timeout;
   gint                 refresh_timeout_id;
 
-  ESource             *removed_source;
-
   /* temp to keep event_creation */
   gboolean             open_edit_dialog;
 } GcalWindowPrivate;
@@ -873,9 +871,7 @@ source_row_activated (GtkListBox    *listbox,
                       gpointer       user_data)
 {
   GcalWindowPrivate *priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
-  GtkWidget *new_row;
   ESource *source;
-  gint response;
 
   source = g_object_get_data (G_OBJECT (row), "source");
 
@@ -887,34 +883,9 @@ source_row_activated (GtkListBox    *listbox,
 
   gtk_widget_hide (priv->calendar_popover);
 
-  response = gtk_dialog_run (GTK_DIALOG (priv->source_dialog));
+  gtk_dialog_run (GTK_DIALOG (priv->source_dialog));
 
   gtk_widget_hide (priv->source_dialog);
-
-  /* remove the row */
-  gtk_widget_destroy (GTK_WIDGET (row));
-
-  if (response == GCAL_RESPONSE_REMOVE_SOURCE)
-    {
-      gchar *str;
-
-      str = g_strdup_printf (_("Calendar <b>%s</b> removed"), e_source_get_display_name (source));
-      priv->removed_source = source;
-
-      create_notification (GCAL_WINDOW (user_data), str, _("Undo"));
-      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->notification), TRUE);
-
-      gcal_manager_disable_source (priv->manager, source);
-
-      g_free (str);
-    }
-  else
-    {
-      new_row = make_row_from_source (GCAL_WINDOW (user_data), source);
-      g_object_set_data (G_OBJECT (new_row), "source", source);
-
-      gtk_container_add (GTK_CONTAINER (priv->calendar_listbox), new_row);
-    }
 }
 
 static void
@@ -1229,36 +1200,6 @@ remove_event (GtkWidget  *notification,
 
       g_clear_pointer (&(priv->event_to_delete), g_free);
     }
-
-  /* If we have any removed source, finally delete it */
-  if (priv->removed_source != NULL)
-    {
-      GError *error = NULL;
-
-      /* We don't really want to remove non-removable sources */
-      if (!e_source_get_removable (priv->removed_source))
-        return;
-
-      e_source_remove_sync (priv->removed_source, NULL, &error);
-
-      /**
-       * If something goes wrong, throw
-       * an alert and add the source back.
-       */
-      if (error != NULL)
-        {
-          g_warning ("Error removing source: %s", error->message);
-
-          add_source (priv->manager, priv->removed_source,
-                      gcal_manager_source_enabled (priv->manager, priv->removed_source), user_data);
-
-          gcal_manager_enable_source (priv->manager, priv->removed_source);
-
-          g_error_free (error);
-        }
-    }
-
-
 }
 
 static void
@@ -1282,33 +1223,6 @@ undo_remove_action (GtkButton *button,
       g_list_free (widgets);
       g_free (uuid);
     }
-
-  /* if there's any set source, unremove it */
-  if (priv->removed_source != NULL)
-    {
-      /**
-       * Enable the source before adding it again to
-       * avoid an enabled source with unchecked check
-       * button.
-       */
-      gcal_manager_enable_source (priv->manager, priv->removed_source);
-
-      add_source (priv->manager, priv->removed_source,
-                  gcal_manager_source_enabled (priv->manager, priv->removed_source), user_data);
-
-      /**
-       * Don't clear the pointer, since we don't
-       * want to erase the source at all.
-       */
-      priv->removed_source = NULL;
-    }
-
-  if (priv->event_to_delete != NULL || priv->removed_source != NULL)
-    {
-      g_source_remove (priv->notification_timeout);
-      hide_notification (GCAL_WINDOW (user_data), NULL);
-    }
-
 }
 
 static gboolean


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