Re: tooltip on treeview cell
Julien Moutinho <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <20080215154858.GA11325@localhost> |
On Thu, Feb 14, 2008 at 06:57:38PM -0600, Yoann Padioleau wrote: > Hi, Hi, > How can I set the tooltip for a cell in a treeview ? > Apparently the other gtk bindings offer a method > set_tooltip_tree_cell() but I didn't find it in > lablgtk. AFAIK, if you use a GTK+ whose version is lower than 2.12, then its tooltip machinery, GtkTooltips (note the 's'), does not handle treeview tooltips. So the usual way is to do it manually, that is, to hook a motion_notify callback to the treeview, which will call a get_path_at_pos to retrieve the treeview cell under the cursor, whose data is then used to hide/show a popup window actually being the tooltip. However GTK+ 2.12 came up with a new tooltip machinery, GtkTooltip (no 's' now), which is way more powerful and handles treeview tooltips: http://mail.gnome.org/archives/gtk-devel-list/2007-June/msg00092.html A few months ago, I've wrapped GtkTooltip into the SVN of LablGTK: http://svn.gna.org/viewcvs/lablgtk/trunk One example for doing what you want with it being there: http://svn.gna.org/viewcvs/lablgtk/trunk/examples/tooltip.ml?rev=1392 However this wrap segfaults on my Debian box if the following patch against GTK+2.12 is not applied : http://bugzilla.gnome.org/show_bug.cgi?id=478519 I'm joining to this mail the patch updated to GTK+ 2.12.6. Feel free to tell GTK+'s developers your concern about BR#478519. HTH. _______________________________________________ Lablgtk mailing list [email protected] http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
gtk+2.12.6_gtktooltip_segfault.patch
(text/x-diff, 1.1 KB)
--- gtk/gtktooltip.c.orig 2008-01-29 04:35:47.000000000 +0100
+++ gtk/gtktooltip.c 2008-02-15 16:28:46.000000000 +0100
@@ -862,6 +862,9 @@
tooltip = g_object_get_data (G_OBJECT (display),
"gdk-display-current-tooltip");
+ if (!tooltip)
+ return;
+
if (tooltip->keyboard_mode_enabled)
{
pointer_widget = tooltip_widget = tooltip->keyboard_widget;
@@ -886,8 +889,6 @@
g_object_get (tooltip_widget, "has-tooltip", &has_tooltip, NULL);
- g_assert (tooltip != NULL);
-
return_value = gtk_tooltip_run_requery (&tooltip_widget, tooltip, &x, &y);
if (!return_value)
return;
@@ -994,7 +995,8 @@
tooltip = g_object_get_data (G_OBJECT (display),
"gdk-display-current-tooltip");
- tooltip->timeout_id = 0;
+ if (tooltip)
+ tooltip->timeout_id = 0;
return FALSE;
}
@@ -1009,7 +1011,7 @@
tooltip = g_object_get_data (G_OBJECT (display),
"gdk-display-current-tooltip");
- if (tooltip && GTK_TOOLTIP_VISIBLE (tooltip))
+ if (!tooltip || GTK_TOOLTIP_VISIBLE (tooltip))
return;
if (tooltip->timeout_id)