[gnome-contacts] Add colors to presence widgets
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Add colors to presence widgets
- Date: Fri, 17 Jun 2011 14:07:57 +0000 (UTC)
commit e54d42409dfe35a206a05a6ee0fbbe6d3deca8a5
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 16 19:22:30 2011 +0200
Add colors to presence widgets
data/gnome-contacts.css | 16 ++++++++++++++++
src/contacts-contact.vala | 26 ++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/data/gnome-contacts.css b/data/gnome-contacts.css
index c20a01c..74e3399 100644
--- a/data/gnome-contacts.css
+++ b/data/gnome-contacts.css
@@ -14,3 +14,19 @@ ContactsApp > GtkFrame.frame {
.contact-pane {
background-color: #ffffff;
}
+
+.presence-icon-available {
+ color: #4e9a06;
+}
+
+.presence-icon-offline {
+ color: #2e3436;
+}
+
+.presence-icon-away {
+ color: #babdb6;
+}
+
+.presence-icon-busy {
+ color: #f57900;
+}
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index a6e213e..beeeb39 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -76,6 +76,7 @@ public class Contacts.ContactPresence : Grid {
}
image.set_from_icon_name (Contact.presence_to_icon_full (type), IconSize.MENU);
+ image.get_style_context ().add_class (Contact.presence_to_class (type));
image.show ();
label.show ();
if (message.length == 0)
@@ -262,6 +263,31 @@ public class Contacts.Contact : GLib.Object {
return "user-offline-symbolic";
}
+ public static string presence_to_class (PresenceType presence) {
+ string? classname = null;
+ switch (presence) {
+ default:
+ case PresenceType.HIDDEN:
+ case PresenceType.OFFLINE:
+ case PresenceType.UNSET:
+ case PresenceType.ERROR:
+ classname = "presence-icon-offline";
+ break;
+ case PresenceType.AVAILABLE:
+ case PresenceType.UNKNOWN:
+ classname = "presence-icon-available";
+ break;
+ case PresenceType.AWAY:
+ case PresenceType.EXTENDED_AWAY:
+ classname = "presence-icon-away";
+ break;
+ case PresenceType.BUSY:
+ classname = "presence-icon-busy";
+ break;
+ }
+ return classname;
+ }
+
static string? get_first_string (Collection<string> collection) {
var i = collection.iterator();
if (i.next())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]