From a20742c57995b3dc4cc264585ab3b79ca142261b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 23 Jun 2010 03:38:37 +0200 Subject: Show resource in tooltip --- src/gui/Ephraim.vala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/Ephraim.vala') diff --git a/src/gui/Ephraim.vala b/src/gui/Ephraim.vala index 0b50ff4..998439d 100644 --- a/src/gui/Ephraim.vala +++ b/src/gui/Ephraim.vala @@ -24,6 +24,30 @@ public class Ephraim { unowned Gtk.TreeView rosterView = builder.get_object("Roster") as Gtk.TreeView; rosterView.set_model(roster); + rosterView.query_tooltip.connect((x, y, keyboard_tip, tooltip) => { + Gtk.TreeIter iter; + + if(!rosterView.get_tooltip_context(out x, out y, keyboard_tip, null, null, out iter)) + return false; + + Value value; + roster.get_value(iter, 0, out value); + + Contact? c = value.get_object() as Contact; + if(c == null) + return false; + + Gee.Map.Entry? r = c.get_resource_with_highest_priority(); + + if(r == null) + return false; + + tooltip.set_text("Resource: " + r.key); + + return true; + }); + rosterView.has_tooltip = true; + rosterView.append_column(new Gtk.TreeViewColumn.with_attributes("Contact", new CellRendererContact(), "contact", 0, null)); window.visible = true; -- cgit v1.2.3