From e7a638ec13b3d0202d52afdb0ccf39467eb8ebaf Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Mon, 2 Apr 2018 17:23:49 +0200 Subject: ContactPane: move constructor before methods. This is to finally have some convention that we can follow. --- src/contacts-contact-pane.vala | 60 ++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala index 1ca6d15..50de345 100644 --- a/src/contacts-contact-pane.vala +++ b/src/contacts-contact-pane.vala @@ -75,6 +75,32 @@ public class Contacts.ContactPane : Stack { public signal void display_name_changed (string new_display_name); + public ContactPane (Window parent_window, Store contacts_store) { + this.parent_window = parent_window; + this.store = contacts_store; + + this.edit_contact_actions.add_action_entries (action_entries, this); + + // Contact editor + this.editor = new ContactEditor (this.store, this.edit_contact_actions); + this.editor.linked_button.clicked.connect (linked_accounts); + this.editor.remove_button.clicked.connect (delete_contact); + this.contact_editor_page.add (this.editor); + + /* enable/disable actions*/ + var birthday_action = this.edit_contact_actions.lookup_action ("add.birthday") as SimpleAction; + this.editor.bind_property ("has-birthday-row", birthday_action, "enabled", + BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN); + + var nickname_action = this.edit_contact_actions.lookup_action ("add.nickname") as SimpleAction; + this.editor.bind_property ("has-nickname-row", nickname_action, "enabled", + BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN); + + var notes_action = this.edit_contact_actions.lookup_action ("add.notes") as SimpleAction; + this.editor.bind_property ("has-notes-row", notes_action, "enabled", + BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN); + } + public void add_suggestion (Contact c) { var parent_overlay = this.get_parent () as Overlay; @@ -112,40 +138,6 @@ public class Contacts.ContactPane : Stack { } } - public ContactPane (Window parent_window, Store contacts_store) { - this.parent_window = parent_window; - this.store = contacts_store; - - this.edit_contact_actions.add_action_entries (action_entries, this); - - // Contact editor - this.editor = new ContactEditor (this.store, this.edit_contact_actions); - this.editor.linked_button.clicked.connect (linked_accounts); - this.editor.remove_button.clicked.connect (delete_contact); - this.contact_editor_page.add (this.editor); - - /* enable/disable actions*/ - var birthday_action = this.edit_contact_actions.lookup_action ("add.birthday") as SimpleAction; - this.editor.bind_property ("has-birthday-row", - birthday_action, "enabled", - BindingFlags.SYNC_CREATE | - BindingFlags.INVERT_BOOLEAN); - - var nickname_action = this.edit_contact_actions.lookup_action ("add.nickname") as SimpleAction; - this.editor.bind_property ("has-nickname-row", - nickname_action, "enabled", - BindingFlags.DEFAULT | - BindingFlags.SYNC_CREATE | - BindingFlags.INVERT_BOOLEAN); - - var notes_action = this.edit_contact_actions.lookup_action ("add.notes") as SimpleAction; - this.editor.bind_property ("has-notes-row", - notes_action, "enabled", - BindingFlags.DEFAULT | - BindingFlags.SYNC_CREATE | - BindingFlags.INVERT_BOOLEAN); - } - private void show_contact_sheet () { assert (this.contact != null); -- cgit v1.2.1