[gnome-contacts] Switch to non-symbolic presence icons by default



commit 7f557f0f561aa7087bd98960ddb9a9966706b97d
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Dec 20 22:55:33 2011 +0100

    Switch to non-symbolic presence icons by default

 data/gnome-contacts.css               |   16 --------------
 src/contacts-cell-renderer-shape.vala |   11 +--------
 src/contacts-contact.vala             |   37 +++++++++++++++++++++++++++++++-
 3 files changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/data/gnome-contacts.css b/data/gnome-contacts.css
index 1945371..52ff730 100644
--- a/data/gnome-contacts.css
+++ b/data/gnome-contacts.css
@@ -97,22 +97,6 @@ ContactsViewWidget {
     background-color: @bg_color;
 }
 
-.presence-icon-available {
-    color: #4e9a06;
-}
-
-.presence-icon-offline {
-    color: #2e3436;
-}
-
-.presence-icon-away {
-    color: #babdb6;
-}
-
-.presence-icon-busy {
-    color: #f57900;
-}
-
 .notification {
     border-style: solid;
     border-color: #949486;
diff --git a/src/contacts-cell-renderer-shape.vala b/src/contacts-cell-renderer-shape.vala
index 9896f3c..4fdb123 100644
--- a/src/contacts-cell-renderer-shape.vala
+++ b/src/contacts-cell-renderer-shape.vala
@@ -33,10 +33,9 @@ public class Contacts.CellRendererShape : Gtk.CellRenderer {
 
   private struct IconShape {
     string icon;
-    bool colorize;
   }
 
-  Gdk.Pixbuf? create_symbolic_pixbuf (Widget widget, string icon_name, bool colorize, int size) {
+  Gdk.Pixbuf? create_symbolic_pixbuf (Widget widget, string icon_name, int size) {
     var screen = widget. get_screen ();
     var icon_theme = Gtk.IconTheme.get_for_screen (screen);
 
@@ -48,8 +47,6 @@ public class Contacts.CellRendererShape : Gtk.CellRenderer {
 
     context.save ();
     bool is_symbolic;
-    if (colorize)
-      context.add_class (Contact.presence_to_class (presence));
     Gdk.Pixbuf? pixbuf = null;
     try {
       pixbuf = info.load_symbolic_for_context (context,
@@ -58,9 +55,6 @@ public class Contacts.CellRendererShape : Gtk.CellRenderer {
     }
     context.restore ();
 
-    if (!is_symbolic)
-      pixbuf = null;
-
     return pixbuf;
   }
 
@@ -133,7 +127,6 @@ public class Contacts.CellRendererShape : Gtk.CellRenderer {
       str += "*";
       IconShape icon_shape = IconShape();
       icon_shape.icon = iconname;
-      icon_shape.colorize = true;
       var a = new Pango.AttrShape<IconShape?>.with_data (r, r, icon_shape, (s) => { return s;} );
       a.start_index = 0;
       a.end_index = 1;
@@ -317,7 +310,7 @@ public class Contacts.CellRendererShape : Gtk.CellRenderer {
 
   public void render_shape (Cairo.Context cr, Pango.AttrShape attr, bool do_path) {
     unowned Pango.AttrShape<IconShape?> sattr = (Pango.AttrShape<IconShape?>)attr;
-    var pixbuf = create_symbolic_pixbuf (current_widget, sattr.data.icon, sattr.data.colorize, IMAGE_SIZE);
+    var pixbuf = create_symbolic_pixbuf (current_widget, sattr.data.icon, IMAGE_SIZE);
     if (pixbuf != null) {
       double x, y;
       cr.get_current_point (out x, out y);
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 1354db0..71973e8 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -462,7 +462,7 @@ public class Contacts.Contact : GLib.Object  {
     }
   }
 
-  public static string presence_to_icon (PresenceType presence) {
+  public static string presence_to_icon_symbolic (PresenceType presence) {
     string? iconname = null;
     switch (presence) {
     default:
@@ -488,11 +488,44 @@ public class Contacts.Contact : GLib.Object  {
     return iconname;
   }
 
+  public static string presence_to_icon_symbolic_full (PresenceType presence) {
+    string? iconname = presence_to_icon_symbolic (presence);
+    if (iconname != null)
+      return iconname;
+    return "user-offline-symbolic";
+  }
+
+  public static string presence_to_icon (PresenceType presence) {
+    string? iconname = null;
+    switch (presence) {
+    default:
+    case PresenceType.OFFLINE:
+    case PresenceType.UNSET:
+    case PresenceType.ERROR:
+      break;
+    case PresenceType.AVAILABLE:
+    case PresenceType.UNKNOWN:
+      iconname = "user-available";
+      break;
+    case PresenceType.AWAY:
+    case PresenceType.EXTENDED_AWAY:
+      iconname = "user-away";
+      break;
+    case PresenceType.BUSY:
+      iconname = "user-busy";
+      break;
+    case PresenceType.HIDDEN:
+      iconname = "user-invisible";
+      break;
+    }
+    return iconname;
+  }
+
   public static string presence_to_icon_full (PresenceType presence) {
     string? iconname = presence_to_icon (presence);
     if (iconname != null)
       return iconname;
-    return "user-offline-symbolic";
+    return "user-offline";
   }
 
   public static string presence_to_class (PresenceType presence) {



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