[gnome-contacts] Simplify Avatar styling



commit c2df6816d04c2493bbe94f2a571c57926ea215a4
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Jan 16 21:57:30 2018 +0100

    Simplify Avatar styling

 data/ui/style.css               |   23 ++++-------------------
 src/contacts-avatar.vala        |    4 +++-
 src/contacts-contact-list.vala  |    2 --
 src/contacts-contact-sheet.vala |    2 --
 4 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/data/ui/style.css b/data/ui/style.css
index 6a75863..07fc3a5 100644
--- a/data/ui/style.css
+++ b/data/ui/style.css
@@ -55,29 +55,14 @@ row.contact-data-row {
   border-top-left-radius: 0;
 }
 
-.contacts-avatar-frame.frame {
- border-width: 1px 1px 1px 1px;
- border-style: solid;
- border-color: @borders;
- border-image: none;
- border-radius: 0;
- padding: 0;
-}
-
-.main-avatar-frame.frame {
- border-width: 1px;
- border-style: solid;
- border-color: @borders;
- border-radius: 6px;
-}
-
-.main-avatar-frame border {
- border-radius: 5px;
+/* Draw a border around the avatar */
+.contacts-avatar border {
+  border-radius: 5px;
 }
 
 /* Give the avatar in the ContactSheet some margin,
  * so it doesn't jump when switching to the editor. */
-.contacts-contact-sheet .main-avatar-frame {
+.contacts-contact-sheet .contacts-avatar {
   margin: 4px 8px;
 }
 
diff --git a/src/contacts-avatar.vala b/src/contacts-avatar.vala
index efd2170..23ca495 100644
--- a/src/contacts-avatar.vala
+++ b/src/contacts-avatar.vala
@@ -33,6 +33,8 @@ public class Contacts.Avatar : Frame {
   public Avatar (int size, bool with_button = false) {
     this.size = size;
 
+    get_style_context ().add_class ("contacts-avatar");
+
     var image = new Image ();
     image.set_size_request (size, size);
 
@@ -49,6 +51,7 @@ public class Contacts.Avatar : Frame {
        });
 
       this.add (button);
+      this.shadow_type = ShadowType.NONE;
     } else {
       this.add (image);
     }
@@ -56,7 +59,6 @@ public class Contacts.Avatar : Frame {
     image.show ();
     image.draw.connect (draw_image);
 
-    set_shadow_type (ShadowType.NONE);
   }
 
   public void set_pixbuf (Gdk.Pixbuf a_pixbuf) {
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 5a055f4..6e654b7 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -41,8 +41,6 @@ public class Contacts.ContactList : ListBox {
       grid.margin = 6;
       grid.set_column_spacing (10);
       this.avatar = new Avatar (Contact.LIST_AVATAR_SIZE);
-      this.avatar.set_shadow_type (ShadowType.IN);
-      this.avatar.get_style_context ().add_class ("main-avatar-frame");
 
       label = new Label ("");
       label.set_ellipsize (Pango.EllipsizeMode.END);
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 985982b..2d27463 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -97,8 +97,6 @@ public class Contacts.ContactSheet : Grid {
 
   public void update (Contact c) {
     var image_frame = new Avatar (PROFILE_SIZE);
-    image_frame.get_style_context ().add_class ("main-avatar-frame");
-    image_frame.set_shadow_type (ShadowType.IN);
     image_frame.set_vexpand (false);
     image_frame.set_valign (Align.START);
     c.keep_widget_uptodate (image_frame,  (w) => {


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