summaryrefslogtreecommitdiffstats
path: root/src/gui/Ephraim.vala
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 03:38:37 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 03:38:37 +0200
commita20742c57995b3dc4cc264585ab3b79ca142261b (patch)
tree982a8e5ebc73576188d3e72d045eda0f74a28910 /src/gui/Ephraim.vala
parent942602b35337c5df91f61001e46970c59ddcfc15 (diff)
downloadephraim-a20742c57995b3dc4cc264585ab3b79ca142261b.tar
ephraim-a20742c57995b3dc4cc264585ab3b79ca142261b.zip
Show resource in tooltip
Diffstat (limited to 'src/gui/Ephraim.vala')
-rw-r--r--src/gui/Ephraim.vala24
1 files changed, 24 insertions, 0 deletions
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<string, Contact.Resource>? 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;