blob: 0a93b512a697ddbd51c7908f7baa3472df4f9dfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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;
}
}
}
}
|