diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c index 691f7ad030..7b5327a41a 100644 --- a/gtk/gtkicon.c +++ b/gtk/gtkicon.c @@ -44,6 +44,7 @@ static void gtk_icon_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) { + GtkIcon *self = GTK_ICON (widget); GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget)); GtkAllocation alloc; @@ -52,7 +53,7 @@ gtk_icon_snapshot (GtkWidget *widget, gtk_css_style_snapshot_icon (style, snapshot, alloc.width, alloc.height, - GTK_CSS_IMAGE_BUILTIN_NONE); + self->image); } static void @@ -68,6 +69,7 @@ static void gtk_icon_init (GtkIcon *self) { gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); + self->image = GTK_CSS_IMAGE_BUILTIN_NONE; } GtkWidget * @@ -77,3 +79,10 @@ gtk_icon_new (const char *css_name) "css-name", css_name, NULL); } + +void +gtk_icon_set_image (GtkIcon *self, + GtkCssImageBuiltinType image) +{ + self->image = image; +} diff --git a/gtk/gtkiconprivate.h b/gtk/gtkiconprivate.h index 81ae9a2521..dcbb6d7c86 100644 --- a/gtk/gtkiconprivate.h +++ b/gtk/gtkiconprivate.h @@ -20,7 +20,8 @@ #ifndef __GTK_ICON_PRIVATE_H__ #define __GTK_ICON_PRIVATE_H__ -#include "gtk/gtkwidget.h" +#include "gtkwidget.h" +#include "gtkcsstypesprivate.h" G_BEGIN_DECLS @@ -37,6 +38,7 @@ typedef struct _GtkIconClass GtkIconClass; struct _GtkIcon { GtkWidget parent; + GtkCssImageBuiltinType image; }; struct _GtkIconClass @@ -48,6 +50,9 @@ GType gtk_icon_get_type (void) G_GNUC_CONST; GtkWidget * gtk_icon_new (const char *css_name); +void gtk_icon_set_image (GtkIcon *self, + GtkCssImageBuiltinType image); + G_END_DECLS #endif /* __GTK_ICON_PRIVATE_H__ */