[gnome-contacts: 1/2] ContactPane: Update right titlebar after editing contact introduced a signal display_name_changed to



commit 964c790e8e3cee0393fa9fa8ecba944fb3eaa1c0
Author: Frank Zschage <frank reissan de>
Date:   Tue Feb 6 22:02:45 2018 +0100

    ContactPane: Update right titlebar after editing contact
    introduced a signal display_name_changed to notify listeners and especially to update the right titlebar 
after the name of a contact has been changed to fix issue #78

 src/contacts-contact-pane.vala | 6 ++++++
 src/contacts-window.vala       | 3 +++
 2 files changed, 9 insertions(+)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 3f6a443..beb6c1c 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -67,6 +67,11 @@ public class Contacts.ContactPane : Stack {
   /* Signals */
   public signal void contacts_linked (string? main_contact, string linked_contact, LinkOperation operation);
   public signal void will_delete (Contact contact);
+  /**
+   * Passes the changed display name to all listeners after edit mode has been completed.
+   */
+  public signal void display_name_changed (string new_display_name);
+
 
   public void update_sheet () {
     if (on_edit_mode) {
@@ -278,6 +283,7 @@ public class Contacts.ContactPane : Stack {
                                                 (obj, result) => {
                                                   try {
                                                     Contact.set_individual_property.end (result);
+                                                    display_name_changed (v.get_string ());
                                                   } catch (Error e) {
                                                     show_message (e.message);
                                                     /* FIXME: add this back */
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index a43a268..b548b46 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -93,6 +93,9 @@ public class Contacts.Window : Gtk.ApplicationWindow {
         delete_contacts (new ArrayList<Contact>.wrap ({ contact }));
      });
     this.contact_pane.contacts_linked.connect (contact_pane_contacts_linked_cb);
+    this.contact_pane.display_name_changed.connect ((display_name) => {
+      this.right_header.title = display_name;
+    });
     this.contact_pane_container.add (this.contact_pane);
   }
 


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