Commit 4024b6de authored by Julian Sparber's avatar Julian Sparber

contact-editor: reuse the avatar picker popover

parent ec0d9f51
......@@ -75,6 +75,8 @@ public class Contacts.ContactEditor : ContactForm {
private Entry name_entry;
private AvatarSelector avatar_selector = null;
private Avatar avatar;
[GtkChild]
......@@ -952,8 +954,10 @@ public class Contacts.ContactEditor : ContactForm {
// Show the avatar popover when the avatar is clicked
private void on_avatar_button_clicked (Button avatar_button) {
var popover = new AvatarSelector (avatar_button, this.contact);
popover.set_avatar.connect ( (icon) => {
if (this.avatar_selector == null)
this.avatar_selector = new AvatarSelector (avatar_button, this.contact);
this.avatar_selector.set_avatar.connect ( (icon) => {
this.avatar.set_data ("value", icon);
this.avatar.set_data ("changed", true);
......@@ -966,7 +970,7 @@ public class Contacts.ContactEditor : ContactForm {
this.avatar.set_pixbuf (a_pixbuf);
});
popover.show();
this.avatar_selector.show();
}
public bool avatar_changed () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment