diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-06-23 04:09:55 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-06-23 04:09:55 +0200 |
commit | 04a0f989a71a83114fe1f58b2ebe1af2f56cb87b (patch) | |
tree | 9665036d8cef3d04832d41f04ce3cc6f3dec93f0 /src/gui/CellRendererPresence.vala | |
parent | a20742c57995b3dc4cc264585ab3b79ca142261b (diff) | |
download | ephraim-04a0f989a71a83114fe1f58b2ebe1af2f56cb87b.tar ephraim-04a0f989a71a83114fe1f58b2ebe1af2f56cb87b.zip |
Show presence icons
Diffstat (limited to 'src/gui/CellRendererPresence.vala')
-rw-r--r-- | src/gui/CellRendererPresence.vala | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/gui/CellRendererPresence.vala b/src/gui/CellRendererPresence.vala new file mode 100644 index 0000000..0a93b51 --- /dev/null +++ b/src/gui/CellRendererPresence.vala @@ -0,0 +1,55 @@ +public class CellRendererPresence : Gtk.CellRendererPixbuf { + private static Gdk.Pixbuf online; + private static Gdk.Pixbuf away; + private static Gdk.Pixbuf dnd; + private static Gdk.Pixbuf xa; + private static Gdk.Pixbuf undefined; + private static Gdk.Pixbuf offline; + + private Contact _contact; + + static construct { + try { + online = new Gdk.Pixbuf.from_file("icons/16x16/online.png"); + away = new Gdk.Pixbuf.from_file("icons/16x16/away.png"); + dnd = new Gdk.Pixbuf.from_file("icons/16x16/dnd.png"); + xa = new Gdk.Pixbuf.from_file("icons/16x16/xa.png"); + undefined = new Gdk.Pixbuf.from_file("icons/16x16/requested.png"); + offline = new Gdk.Pixbuf.from_file("icons/16x16/offline.png"); + } catch(Error e) { + } + } + + public Contact contact { + get { + return _contact; + } + set { + _contact = value; + + Gee.Map.Entry<string, Contact.Resource>? r = value.get_resource_with_highest_priority(); + if(r == null) { + pixbuf = offline; + return; + } + + switch(r.value.show) { + case Contact.Show.ONLINE: + pixbuf = online; + break; + case Contact.Show.AWAY: + pixbuf = away; + break; + case Contact.Show.DND: + pixbuf = dnd; + break; + case Contact.Show.XA: + pixbuf = xa; + break; + case Contact.Show.UNDEFINED: + pixbuf = undefined; + break; + } + } + } +} |