[gnome-calendar/calendar-editor] source-dialog: remove needless fields



commit 86d2d2b672900db4467043ef522910e1f5621d6e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Apr 7 23:55:26 2015 -0300

    source-dialog: remove needless fields
    
    Some fields became obsolete with the
    latest mockups. This commit removes
    them partially.

 data/ui/source-dialog.ui |  526 +++++++++++++++-------------------------------
 src/gcal-source-dialog.c |  101 +--------
 2 files changed, 173 insertions(+), 454 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index 06234e5..e0bb7d4 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -14,6 +14,7 @@
       <object class="GtkBox" id="vbox">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
+        <property name="border_width">0</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -555,406 +556,208 @@
               </packing>
             </child>
             <child>
-              <object class="GtkNotebook" id="notebook">
+              <object class="GtkGrid" id="web_source_grid">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="vexpand">True</property>
-                <property name="show_border">False</property>
-                <signal name="switch-page" handler="notebook_page_switched" object="GcalSourceDialog" 
swapped="no"/>
+                <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="GtkGrid" id="web_source_grid">
+                  <object class="GtkLabel" id="web_description_label">
                     <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>
-                            <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>
-                          </object>
-                        </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">
-                            <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>
-                            <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>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                          </object>
-                        </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>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
+                    <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 type="tab">
-                  <object class="GtkLabel" id="web_page_title_label">
+                <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>
-                    <property name="label" translatable="yes">Web</property>
+                    <signal name="notify::text" handler="url_entry_text_changed" object="GcalSourceDialog" 
swapped="no"/>
                   </object>
                   <packing>
-                    <property name="tab_fill">False</property>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkGrid" id="local_source_grid">
+                  <object class="GtkRevealer" id="web_sources_revealer">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="border_width">18</property>
-                    <property name="row_spacing">12</property>
                     <child>
-                      <object class="GtkFileChooserButton" id="select_file_button">
+                      <object class="GtkScrolledWindow" id="web_list_scrolledwindow">
+                        <property name="height_request">100</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
                         <property name="hexpand">True</property>
-                        <signal name="file-set" handler="calendar_file_selected" object="GcalSourceDialog" 
swapped="no"/>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkFrame" id="local_details_frame">
-                        <property name="can_focus">False</property>
-                        <property name="label_xalign">0</property>
-                        <property name="shadow_type">none</property>
+                        <property name="vexpand">True</property>
+                        <property name="shadow_type">etched-in</property>
                         <child>
-                          <object class="GtkGrid" id="details_grid">
+                          <object class="GtkViewport" id="viewport">
                             <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="shadow_type">none</property>
                             <child>
-                              <object class="GtkLabel" id="title_label">
+                              <object class="GtkListBox" id="web_sources_listbox">
                                 <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>
+                                <property name="activate_on_single_click">False</property>
                               </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="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="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="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="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="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="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>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
                             </child>
                           </object>
                         </child>
-                        <style>
-                          <class name="details-frame"/>
-                        </style>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <placeholder/>
                     </child>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">2</property>
                   </packing>
                 </child>
-                <child type="tab">
-                  <object class="GtkLabel" id="local_file_page_title_label">
-                    <property name="visible">True</property>
+                <child>
+                  <object class="GtkFrame" id="web_details_frame">
                     <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="label" translatable="yes">Local File</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkGrid" id="web_details_grid">
+                        <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>
+                        <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>
+                    </child>
+                    <style>
+                      <class name="details-frame"/>
+                    </style>
                   </object>
                   <packing>
-                    <property name="position">1</property>
-                    <property name="tab_fill">False</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">2</property>
                   </packing>
                 </child>
               </object>
@@ -978,6 +781,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="title">Calendar Settings</property>
+        <property name="has_subtitle">True</property>
         <property name="show_close_button">True</property>
         <child>
           <object class="GtkButton" id="back_button">
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 721bb05..6c0a2c3 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -35,15 +35,11 @@ typedef struct
   GtkWidget          *name_entry;
   GtkWidget          *notebook;
   GtkWidget          *remove_button;
-  GtkWidget          *select_file_button;
   GtkWidget          *stack;
 
   /* new source details */
   GtkWidget          *author_label;
   GtkWidget          *calendar_address_entry;
-  GtkWidget          *local_details_frame;
-  GtkWidget          *local_source_grid;
-  GtkWidget          *new_calendar_name_entry;
   GtkWidget          *web_author_label;
   GtkWidget          *web_details_frame;
   GtkWidget          *web_new_calendar_name_entry;
@@ -62,7 +58,6 @@ typedef struct
   /* flags */
   GcalSourceDialogMode mode;
   ESource            *source;
-  ESource            *local_source;
   ESource            *remote_source;
   ESource            *old_default_source;
   GBinding           *title_bind;
@@ -118,11 +113,6 @@ static void       new_name_entry_text_changed           (GObject             *ob
                                                          GParamSpec          *pspec,
                                                          gpointer             user_data);
 
-static void       notebook_page_switched               (GtkWidget            *notebook,
-                                                        GtkWidget            *page,
-                                                        guint                 page_num,
-                                                        gpointer              user_data);
-
 static void       response_signal                       (GtkDialog           *dialog,
                                                          gint                 response_id,
                                                          gpointer             user_data);
@@ -213,7 +203,6 @@ clear_pages (GcalSourceDialog *dialog)
   gtk_revealer_set_reveal_child (GTK_REVEALER (priv->web_sources_revealer), FALSE);
 
   gtk_widget_hide (priv->web_details_frame);
-  gtk_widget_hide (priv->local_details_frame);
 }
 
 static void
@@ -407,37 +396,11 @@ new_name_entry_text_changed (GObject    *object,
   if (GTK_WIDGET (object) == priv->web_new_calendar_name_entry)
     source = priv->remote_source;
 
-  if (GTK_WIDGET (object) == priv->new_calendar_name_entry)
-    source = priv->local_source;
-
   if (source != NULL)
     e_source_set_display_name (source, gtk_entry_get_text (GTK_ENTRY (object)));
 }
 
 /**
- * notebook_page_switched:
- *
- * Validates the current state of
- * the dialog according to the current
- * page.
- *
- * Returns:
- */
-static void
-notebook_page_switched (GtkWidget *notebook,
-                        GtkWidget *page,
-                        guint      page_num,
-                        gpointer   user_data)
-{
-  GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
-
-  if (page_num == 0)
-    gtk_widget_set_sensitive (priv->add_button, (priv->remote_source != NULL));
-  else
-    gtk_widget_set_sensitive (priv->add_button, (priv->local_source != NULL));
-}
-
-/**
  * response_signal:
  *
  * Save the source when the dialog
@@ -461,29 +424,14 @@ response_signal (GtkDialog *dialog,
   /* commit the new source */
   if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_APPLY)
     {
-      ESource *current_source, *other_source;
-      gint page;
-
-      page = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
-      current_source = (page == 0 ? priv->remote_source : priv->local_source);
-      other_source = (page == 1 ? priv->remote_source : priv->local_source);
-
       /* save the current page's source */
-      if (current_source != NULL)
-        gcal_manager_save_source (priv->manager, current_source);
-
-      /* destory the leftover source */
-      if (other_source != NULL)
-        g_object_unref (other_source);
-
+      if (priv->remote_source != NULL)
+        gcal_manager_save_source (priv->manager, priv->remote_source);
     }
 
   /* Destroy the source when the operation is cancelled */
   if (priv->mode == GCAL_SOURCE_DIALOG_MODE_NORMAL && response_id == GTK_RESPONSE_CANCEL)
     {
-      if (priv->local_source != NULL)
-        g_clear_object (&(priv->local_source));
-
       if (priv->remote_source != NULL)
         g_clear_object (&(priv->remote_source));
     }
@@ -506,19 +454,12 @@ calendar_file_selected (GtkFileChooserButton *button,
   ESource *source;
   GFile *file;
 
-  file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (priv->select_file_button));
+  //file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (priv->select_file_button));
 
   if (file == NULL)
     return;
 
   /**
-   * Remove any reminescent ESources
-   * cached before.
-   */
-  if (priv->local_source != NULL)
-    g_clear_pointer (&(priv->local_source), g_object_unref);
-
-  /**
    * Create the new source and add the needed
    * extensions.
    */
@@ -534,13 +475,8 @@ calendar_file_selected (GtkFileChooserButton *button,
   /* update the source properties */
   e_source_set_display_name (source, g_file_get_basename (file));
 
-  /* Set the private source so it saves at closing */
-  priv->local_source = source;
-
   /* Update buttons */
   gtk_widget_set_sensitive (priv->add_button, source != NULL);
-
-  setup_source_details (GCAL_SOURCE_DIALOG (user_data), source);
 }
 
 /**
@@ -556,41 +492,27 @@ setup_source_details (GcalSourceDialog *dialog,
                       ESource          *source)
 {
   GcalSourceDialogPrivate *priv = dialog->priv;
-  GtkWidget *name_entry, *author_label, *frame;
   gchar *email;
 
-  if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook)) == 0)
-    {
-      frame = priv->web_details_frame;
-      name_entry = priv->web_new_calendar_name_entry;
-      author_label = priv->web_author_label;
-    }
-  else
-    {
-      frame = priv->local_details_frame;
-      name_entry = priv->new_calendar_name_entry;
-      author_label = priv->author_label;
-    }
-
   /* Calendar name */
-  gtk_entry_set_text (GTK_ENTRY (name_entry), e_source_get_display_name (source));
+  gtk_entry_set_text (GTK_ENTRY (priv->web_new_calendar_name_entry), e_source_get_display_name (source));
 
   /* Email field */
   email = gcal_manager_query_client_data (priv->manager, source, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS);
 
   if (email != NULL)
     {
-      gtk_label_set_markup (GTK_LABEL (author_label), email);
+      gtk_label_set_markup (GTK_LABEL (priv->web_author_label), email);
     }
   else
     {
       gchar *text = g_strdup_printf ("<i><small>%s</small></i>", _("No author"));
-      gtk_label_set_markup (GTK_LABEL (author_label), text);
+      gtk_label_set_markup (GTK_LABEL (priv->web_author_label), text);
 
       g_free (text);
     }
 
-  gtk_widget_show_all (frame);
+  gtk_widget_show_all (priv->web_details_frame);
 }
 
 /**
@@ -1051,7 +973,7 @@ gcal_source_dialog_constructed (GObject *object)
   gtk_file_filter_set_name (filter, _("Calendar files"));
   gtk_file_filter_add_mime_type (filter, "text/calendar");
 
-  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (priv->select_file_button), filter);
+  //gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (priv->select_file_button), filter);
 
   /* setup titlebar */
   gtk_window_set_titlebar (GTK_WINDOW (object), priv->headerbar);
@@ -1079,7 +1001,6 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
 
   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, author_label);
   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, calendars_listbox);
@@ -1087,14 +1008,9 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
   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, local_details_frame);
-  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, local_source_grid);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, name_entry);
-  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, new_calendar_name_entry);
-  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, notebook);
   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, select_file_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_details_frame);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_new_calendar_name_entry);
@@ -1109,7 +1025,6 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
   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, notebook_page_switched);
   gtk_widget_class_bind_template_callback (widget_class, response_signal);
   gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);
 }



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