Migrating from GtkTooltips to GtkTooltip: GTK+ 2 Reference Manual

## Migrating from GtkTooltips to GtkTooltip

GTK+ 2.12 brings a completely new tooltip implementation which allows many things that were not possible with the old GtkTooltips interface. The new possibilities are explained in more detail in the section about GtkTooltip.

A number of complications of the old API have been removed:

- Tooltips can not be grouped anymore. The old tooltips API allowed this by using multiple GtkTooltips objects. We believe that the timeout behaviour of the new tooltips implementation is better and makes it unnecessary to use grouping as a way to overcome shortcomings of the fast-tooltips mode.

- Timeouts can not be set individually anymore. Instead there are settings “gtk-tooltip-timeout”, “gtk-tooltip-browse-timeout” and “gtk-tooltip-browse-mode-timeout” to influence the behaviour of tooltips globally.

Here is an example of setting a tooltip on a widget with the old API:

    1
    2
    GtkTooltips *tooltips = gtk_tooltips_new ();
    gtk_tooltips_set_tip (tooltips, widget, "Some tips", NULL);

Using the new tooltips API, it is no longer necessary to create an object:

    1
    gtk_widget_set_tooltip_text (widget, "Some tips");

Similarly, setting a tooltip on a GtkToolItem gets simplified from

    1
    gtk_tool_item_set_tooltip (toolitem, toolbar->tooltips, "tool tip", NULL);

to

    1
    gtk_tool_item_set_tooltip_text (toolitem, text);