summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/ephraim_roster.erl2
-rw-r--r--src/gui/CMakeLists.txt1
-rw-r--r--src/gui/CellRendererPresence.vala55
-rw-r--r--src/gui/Ephraim.vala1
4 files changed, 59 insertions, 0 deletions
diff --git a/src/core/ephraim_roster.erl b/src/core/ephraim_roster.erl
index 9cc91f8..bfc40b1 100644
--- a/src/core/ephraim_roster.erl
+++ b/src/core/ephraim_roster.erl
@@ -40,6 +40,8 @@ updateResource(Roster, JID, Priority, Type, Show, Status) ->
available ->
ResourceEntry = #resource_entry{priority=Priority,show=Show,status=Status},
dict:store(Resource, ResourceEntry, RosterEntry#roster_entry.resources);
+ unavailable ->
+ dict:erase(Resource, RosterEntry#roster_entry.resources);
_ ->
RosterEntry#roster_entry.resources
end,
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;