[gnome-contacts] Fix crash if initial-setup == false.



commit c1d8da93898a994ce06d99a51954f6a84b518b5f
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Sep 11 00:07:51 2017 +0200

    Fix crash if initial-setup == false.
    
    As reported by bug 787450.
    
    [1] https://bugzilla.gnome.org/show_bug.cgi?id=787450

 data/ui/contacts-window.ui |   22 +---------------------
 src/contacts-window.vala   |   19 +++++++++++++------
 2 files changed, 14 insertions(+), 27 deletions(-)
---
diff --git a/data/ui/contacts-window.ui b/data/ui/contacts-window.ui
index 83802a6..a799d8d 100644
--- a/data/ui/contacts-window.ui
+++ b/data/ui/contacts-window.ui
@@ -98,7 +98,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkGrid">
+          <object class="GtkGrid" id="setup_view">
             <property name="visible">True</property>
             <property name="border_width">12</property>
             <property name="row_spacing">24</property>
@@ -118,19 +118,6 @@
                 <property name="height">1</property>
               </packing>
             </child>
-            <child>
-              <object class="ContactsAccountsList" id="setup_accounts_list">
-                <property name="visible">True</property>
-                <property name="hexpand">True</property>
-                <property name="halign">center</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="name">setup-view</property>
@@ -333,11 +320,4 @@
       <widget name="loading_box"/>
     </widgets>
   </object>
-  <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="setup_explanation_label"/>
-      <widget name="setup_accounts_list"/>
-    </widgets>
-  </object>
 </interface>
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 25c8364..4076e96 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -53,12 +53,13 @@ public class Contacts.Window : Gtk.ApplicationWindow {
   private Grid  content_header_bar;
 
   [GtkChild]
+  private Grid setup_view;
+  [GtkChild]
   private HeaderBar setup_header_bar;
   [GtkChild]
   private Button setup_done_button;
   [GtkChild]
   private Button setup_cancel_button;
-  [GtkChild]
   private AccountsList setup_accounts_list;
 
   // The 2 panes the window consists of
@@ -144,6 +145,12 @@ public class Contacts.Window : Gtk.ApplicationWindow {
 
     create_contact_pane ();
 
+    this.setup_accounts_list = new AccountsList (this.store);
+    this.setup_accounts_list.hexpand = true;
+    this.setup_accounts_list.halign = Align.CENTER;
+    this.setup_accounts_list.show ();
+    this.setup_view.attach (this.setup_accounts_list, 1, 0);
+
     if (settings.did_initial_setup) {
       view_switcher.visible_child_name = "content-view";
       set_titlebar (content_header_bar);
@@ -153,13 +160,13 @@ public class Contacts.Window : Gtk.ApplicationWindow {
         change_book_action.set_enabled (false);
 
       store.eds_persona_store_changed.connect  ( () => {
-         setup_accounts_list.update_contents (false);
-       });
+          setup_accounts_list.update_contents (false);
+        });
       ulong id2 = 0;
       id2 = setup_accounts_list.account_selected.connect (() => {
-         setup_done_button.set_sensitive (true);
-         setup_accounts_list.disconnect (id2);
-       });
+          setup_done_button.set_sensitive (true);
+          setup_accounts_list.disconnect (id2);
+        });
 
       view_switcher.visible_child_name = "setup-view";
       set_titlebar (setup_header_bar);


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