summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 04:09:55 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 04:09:55 +0200
commit04a0f989a71a83114fe1f58b2ebe1af2f56cb87b (patch)
tree9665036d8cef3d04832d41f04ce3cc6f3dec93f0 /src/gui
parenta20742c57995b3dc4cc264585ab3b79ca142261b (diff)
downloadephraim-04a0f989a71a83114fe1f58b2ebe1af2f56cb87b.tar
ephraim-04a0f989a71a83114fe1f58b2ebe1af2f56cb87b.zip
Show presence icons
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/CMakeLists.txt1
-rw-r--r--src/gui/CellRendererPresence.vala55
-rw-r--r--src/gui/Ephraim.vala1
3 files changed, 57 insertions, 0 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index d2a464c..def009b 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -3,6 +3,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ephraim_BINARY_DIR})
vala_precompile(VALA_C
"Ephraim.vala"
"CellRendererContact.vala"
+ "CellRendererPresence.vala"
"Contact.vala"
"CoreConnector.vala"
"Roster.vala"
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;
+ }
+ }
+ }
+}
diff --git a/src/gui/Ephraim.vala b/src/gui/Ephraim.vala
index 998439d..6474482 100644
--- a/src/gui/Ephraim.vala
+++ b/src/gui/Ephraim.vala
@@ -48,6 +48,7 @@ public class Ephraim {
});
rosterView.has_tooltip = true;
+ rosterView.append_column(new Gtk.TreeViewColumn.with_attributes("Presence", new CellRendererPresence(), "contact", 0, null));
rosterView.append_column(new Gtk.TreeViewColumn.with_attributes("Contact", new CellRendererContact(), "contact", 0, null));
window.visible = true;