Re: [gtk-list] Tooltips and unref



On Mon, 10 Aug 1998, Tom Bech wrote:

> Hi,
> 
> Someone was talking about tooltips and hanging refs. Now, I managed
> to delete the message before I noticed to which ML it was posted ;)
> I suspect the poster subscribes to this list as well, though :)

it was gtk-devel.

> Ah well, to the point: to remove the reference the tooltip adds
> to a widget, call
> 
>   gtk_tooltips_set_tip (tooltips, widget, NULL, NULL);
> 
> This will remove the widget from the tooltips list of handled
> widgets, release the associated memory and unref the widget.
> 
> Hope this helps.
> 
> While I'm at it, I would like to suggest the addition of a function:
> 
> --
> 
> void
> gtk_tooltips_remove_tip (GtkTooltips *tooltips,
>                          GtkWidget   *widget)
> {
>   gtk_tooltips_set_tip (tooltips, widget, NULL, NULL);
> }  
> 
> --
> 
> to avoid confusion and make it self-documenting.

the function you propose can actually be a mere macro:

#define gtk_tooltips_remove_tip (tip, widget) gtk_tooltips_set_tip (tip, widget, NULL, NULL)

i think we better provide something like
gtk_widget_remove_tip (GtkWidget *widget)
{
  GtkTooltipsData *tip_data;
  
  tip_data = gtk_tooltips_data_get (widget);
  if (tip_data)
    gtk_tooltips_set_tip (tip_data->tooltips, widget, NULL, NULL);
}

> 
> Regards,
> Tom
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]