diff options
author | Bastien Nocera <hadess@hadess.net> | 2009-10-13 13:53:09 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2009-10-14 13:22:14 +0100 |
commit | df53e6ad8b8939f1e7bb9a48987f972fec6cfa4c (patch) | |
tree | 3f96239e67bae47e9b497ff8026d169960e700b6 /gtk/gtktooltip.c | |
parent | 588bec91211977b311d9f2c808d3ff241fa53c38 (diff) | |
download | gtk+-df53e6ad8b8939f1e7bb9a48987f972fec6cfa4c.tar.gz |
Add ability to set a tooltip's image from a GIcon
Makes it easier to implement fallbacks whilst following
theme changes.
https://bugzilla.gnome.org/show_bug.cgi?id=598261
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r-- | gtk/gtktooltip.c | 32 |
1 files changed, 29 insertions, 3 deletions
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)); @@ -333,6 +333,32 @@ gtk_tooltip_set_icon_from_icon_name(GtkTooltip *tooltip, } /** + * 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 * @custom_widget: a #GtkWidget, or %NULL to unset the old custom widget. |