[Vala] Custom tooltip query function for a treeview
- From: ilya korchemkin <gm illifant gmail com>
- To: vala-list gnome org
- Subject: [Vala] Custom tooltip query function for a treeview
- Date: Mon, 6 Feb 2012 00:23:02 +0200
Hi everyone.
I'm trying to make a tooltip for a treeview that displays treemodel
row. I looked into examples for C [1] and Python [2] and made the
following callback (I added some printfs):
private bool cb_query_tooltip(int x, int y, bool
keyboard_tooltip, Gtk.Tooltip tooltip) {
Gtk.TreeModel model;
Gtk.TreePath path = null;
Gtk.TreeIter iter;
string text;
stdout.printf("%d %d\n", x, y);
if (!this.treeview.get_tooltip_context (out x, out y,
keyboard_tooltip, out model, out path, out iter))
return false;
model.get (iter, Columns.COLUMN_SONG, out text, -1);
stdout.printf("%d %d\t%s\n", x, y, text);
tooltip.set_text (text);
this.treeview.set_tooltip_row (tooltip, path);
return true;
}
Now the problem is, tooltip is not shown. The first printf gives
reasonable x and y coords, but the second always outputs zeros and the
string from the top visible (sometimes partly visible) row.
In the get_tooltip_context x and y have to be of type 'out', but as I
clearly see from Python example, x and y are passed as input
parameters. Are they defined correctly as 'out' in Vala? The only
thing I found about this is a bug #586487 [3]. If it's correct, could
you point me to the solution?
I'm using gtk 2.24.8 and vala 0.14.0.
P.S. I know about TreeView.set_tooltip_column, but the text in the
treemodel is not escaped, so '&' characters break tooltips.
[1] http://git.gnome.org/browse/gtk+/tree/tests/testtooltips.c
[2] http://mcs.une.edu.au/doc/pygtk2-2.24.0/examples/pygtk-demo/demos/tooltip.py
[3] https://bugzilla.gnome.org/show_bug.cgi?id=586487
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]