summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2018-01-22 13:04:56 +0100
committerNiels De Graef <nielsdegraef@gmail.com>2018-01-22 13:04:56 +0100
commit8fc224b6549f8aa79b85f05eeb6bd7fd5ea89929 (patch)
treea565cdb251893d378ade4d1988cd48499d75b619 /src
parent5f9bc2c8f399e850c459e2afc42c338ad14ce5af (diff)
downloadgnome-contacts-8fc224b6549f8aa79b85f05eeb6bd7fd5ea89929.tar.gz
ContactDataRow: prevent display name from "twitching".
Every time we hover over a row in the ContactList, it adds a checkbox. However, this made the display name of the contact change position a tiny bit, making it "twitch" a little bit.
Diffstat (limited to 'src')
-rw-r--r--src/contacts-contact-list.vala16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 6253b8c..1c67347 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -29,7 +29,7 @@ public class Contacts.ContactList : ListBox {
private const int LIST_AVATAR_SIZE = 48;
public Contact contact;
- public Label label;
+ private Label label;
private Avatar avatar;
public CheckButton selector_button;
// Whether the selector should always be visible (or only on hover)
@@ -46,10 +46,12 @@ public class Contacts.ContactList : ListBox {
grid.set_column_spacing (10);
this.avatar = new Avatar (LIST_AVATAR_SIZE);
- label = new Label ("");
- label.set_ellipsize (Pango.EllipsizeMode.END);
- label.set_valign (Align.CENTER);
- label.set_halign (Align.START);
+ this.label = new Label (c.display_name);
+ this.label.ellipsize = Pango.EllipsizeMode.END;
+ this.label.valign = Align.CENTER;
+ this.label.halign = Align.START;
+ // Make sure it doesn't "twitch" when the checkbox becomes visible
+ this.label.xalign = 0;
this.selector_button = new CheckButton ();
this.selector_button.visible = false;
@@ -59,8 +61,8 @@ public class Contacts.ContactList : ListBox {
// Make sure it doesn't overlap with the scrollbar
this.selector_button.margin_end = 12;
- grid.attach (this.avatar, 0, 0, 1, 1);
- grid.attach (label, 1, 0, 1, 1);
+ grid.attach (this.avatar, 0, 0);
+ grid.attach (this.label, 1, 0);
grid.attach (this.selector_button, 2, 0);
this.add (grid);
this.show_all ();