diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 3e4d4906f7..ed91762e00 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -4445,6 +4445,7 @@ gtk_tooltip_set_text gtk_tooltip_set_icon gtk_tooltip_set_icon_from_stock gtk_tooltip_set_icon_from_icon_name +gtk_tooltip_set_icon_from_gicon gtk_tooltip_set_custom gtk_tooltip_trigger_tooltip_query gtk_tooltip_set_tip_area diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 81311df9d4..721239f52f 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -4408,6 +4408,7 @@ gtk_tooltip_set_custom gtk_tooltip_set_icon gtk_tooltip_set_icon_from_stock gtk_tooltip_set_icon_from_icon_name +gtk_tooltip_set_icon_from_gicon gtk_tooltip_set_markup gtk_tooltip_set_text gtk_tooltip_set_tip_area diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 66b29f1b77..1f4de9d776 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -318,9 +318,9 @@ gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip, * Since: 2.14 */ void -gtk_tooltip_set_icon_from_icon_name(GtkTooltip *tooltip, - const gchar *icon_name, - GtkIconSize size) +gtk_tooltip_set_icon_from_icon_name (GtkTooltip *tooltip, + const gchar *icon_name, + GtkIconSize size) { g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); @@ -332,6 +332,32 @@ gtk_tooltip_set_icon_from_icon_name(GtkTooltip *tooltip, gtk_widget_hide (tooltip->image); } +/** + * gtk_tooltip_set_from_gicon: + * @tooltip: a #GtkTooltip + * @gicon: a #GIcon representing the icon, or %NULL + * @size: a stock icon size + * Sets the icon of the tooltip (which is in front of the text) to be + * the icon indicated by @gicon with the size indicated + * by @size. If @icon_name is %NULL, the image will be hidden. + * + * Since: 2.20 + */ +void +gtk_tooltip_set_icon_from_gicon (GtkTooltip *tooltip, + GIcon *gicon, + GtkIconSize size) +{ + g_return_if_fail (GTK_IS_TOOLTIP (tooltip)); + + gtk_image_set_from_gicon (GTK_IMAGE (tooltip->image), gicon, size); + + if (gicon) + gtk_widget_show (tooltip->image); + else + gtk_widget_hide (tooltip->image); +} + /** * gtk_tooltip_set_custom: * @tooltip: a #GtkTooltip diff --git a/gtk/gtktooltip.h b/gtk/gtktooltip.h index 8039da6fbc..5271376798 100644 --- a/gtk/gtktooltip.h +++ b/gtk/gtktooltip.h @@ -48,6 +48,9 @@ void gtk_tooltip_set_icon_from_stock (GtkTooltip *tooltip, void gtk_tooltip_set_icon_from_icon_name (GtkTooltip *tooltip, const gchar *icon_name, GtkIconSize size); +void gtk_tooltip_set_icon_from_gicon (GtkTooltip *tooltip, + GIcon *gicon, + GtkIconSize size); void gtk_tooltip_set_custom (GtkTooltip *tooltip, GtkWidget *custom_widget);