private void OnTreeEvent (object sender, WidgetEventArgs args) { // probs: // - only works when moving from tree row to tree row.. // not from other widget to tree row // - hiding due to leavenotify only works first time // because "we never get to enter again?" // - it crashes when moving over my gizmo contact if (args.Event.Type == Gdk.EventType.MotionNotify) { Gdk.EventMotion ev = (Gdk.EventMotion) args.Event; TreePath old_over_path = over_path; buddy_tree.GetPathAtPos ((int) ev.X, (int) ev.Y, out over_path); TreeIter iter; buddy_tree.Model.GetIter (out iter, over_path); // The iters are first legal after the treeview has been build if (over_path.Compare (old_over_path) != 0 && iter.Stamp != 0) { popup.Hide (); Buddy info = (Buddy) buddy_tree.Model.GetValue (iter, COL_BUDDY); if (info != null) { if (info.Name != null) { popup.DisplayLabel = info.Name; popup.StatusLabel = "Available"; if (info.VCard.Photo != null) { popup.Avatar = info.VCard.Photo; } else { popup.Avatar = GtkUtil.LoadPixbuf ("default-user.png"); } Gdk.Rectangle rec = buddy_tree.GetCellArea(over_path, col_expander); int x_value; int y_value; int popup_size = 300; int offset = 12; buddy_tree.ParentWindow.GetPosition(out x_value, out y_value); buddy_tree.GdkWindow.GetOrigin(out x_value, out y_value); if (x_value + rec.Right - offset + popup_size < Gdk.Screen.Default.Width) { popup.Move(x_value + rec.Right - offset, y_value + rec.Top); } else { popup.Move(x_value - popup_size - offset, y_value + rec.Top); } popup.Show (); } } } }