diff options
author | Benjamin Otte <otte@redhat.com> | 2015-12-09 18:25:36 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-12-15 08:41:16 -0500 |
commit | ad22612ab2f84eeea005a293e66761e9de22c6f7 (patch) | |
tree | c18ed9395d187d44c5f4b74090b2683a6acc1616 | |
parent | 7075d00958b749ee4e25e6a4ee7320d3773e6394 (diff) | |
download | gtk+-ad22612ab2f84eeea005a293e66761e9de22c6f7.tar.gz |
iconhelper: Require passing a cssnode to the constructor
Note that we don't use it yet.
-rw-r--r-- | gtk/deprecated/gtkstatusicon.c | 3 | ||||
-rw-r--r-- | gtk/gtkcellrendererpixbuf.c | 7 | ||||
-rw-r--r-- | gtk/gtkentry.c | 6 | ||||
-rw-r--r-- | gtk/gtkiconhelper.c | 5 | ||||
-rw-r--r-- | gtk/gtkiconhelperprivate.h | 3 | ||||
-rw-r--r-- | gtk/gtkimage.c | 5 | ||||
-rw-r--r-- | gtk/gtkspinbutton.c | 7 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 6 | ||||
-rw-r--r-- | gtk/gtkstylecontextprivate.h | 1 |
9 files changed, 29 insertions, 14 deletions
diff --git a/gtk/deprecated/gtkstatusicon.c b/gtk/deprecated/gtkstatusicon.c index e384974662..627a291f5b 100644 --- a/gtk/deprecated/gtkstatusicon.c +++ b/gtk/deprecated/gtkstatusicon.c @@ -43,6 +43,7 @@ #include "gtktooltip.h" #include "gtkicontheme.h" #include "gtklabel.h" +#include "gtkstylecontextprivate.h" #include "gtktypebuiltins.h" #ifdef GDK_WINDOWING_X11 @@ -1392,7 +1393,7 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon) round_size = round_pixel_size (widget, priv->size); - icon_helper = _gtk_icon_helper_new (widget); + icon_helper = gtk_icon_helper_new (gtk_style_context_get_node (gtk_widget_get_style_context (widget)), widget); _gtk_icon_helper_set_force_scale_pixbuf (icon_helper, TRUE); _gtk_icon_helper_set_definition (icon_helper, priv->image_def); _gtk_icon_helper_set_icon_size (icon_helper, GTK_ICON_SIZE_SMALL_TOOLBAR); diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index 2201c72c86..30dcc1b871 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -24,6 +24,7 @@ #include "gtkicontheme.h" #include "gtkintl.h" #include "gtkprivate.h" +#include "gtkstylecontextprivate.h" #include "a11y/gtkimagecellaccessible.h" @@ -446,7 +447,7 @@ create_icon_helper (GtkCellRendererPixbuf *cellpixbuf, GtkCellRendererPixbufPrivate *priv = cellpixbuf->priv; GtkIconHelper *helper; - helper = _gtk_icon_helper_new (widget); + helper = gtk_icon_helper_new (gtk_style_context_get_node (gtk_widget_get_style_context (widget)), widget); _gtk_icon_helper_set_force_scale_pixbuf (helper, TRUE); _gtk_icon_helper_set_definition (helper, priv->image_def); if (gtk_image_definition_get_storage_type (priv->image_def) != GTK_IMAGE_PIXBUF) @@ -580,12 +581,12 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell, if (is_expanded && priv->pixbuf_expander_open != NULL) { - icon_helper = _gtk_icon_helper_new (widget); + icon_helper = gtk_icon_helper_new (gtk_style_context_get_node (context), widget); _gtk_icon_helper_set_pixbuf (icon_helper, priv->pixbuf_expander_open); } else if (!is_expanded && priv->pixbuf_expander_closed != NULL) { - icon_helper = _gtk_icon_helper_new (widget); + icon_helper = gtk_icon_helper_new (gtk_style_context_get_node (context), widget); _gtk_icon_helper_set_pixbuf (icon_helper, priv->pixbuf_expander_closed); } } diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 31f0effbc5..411abcad07 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3256,9 +3256,6 @@ construct_icon_info (GtkWidget *widget, icon_info = g_slice_new0 (EntryIconInfo); priv->icons[icon_pos] = icon_info; - icon_info->icon_helper = _gtk_icon_helper_new (widget); - _gtk_icon_helper_set_force_scale_pixbuf (icon_info->icon_helper, TRUE); - widget_node = get_entry_node (widget); icon_info->css_node = gtk_css_node_new (); gtk_css_node_set_name (icon_info->css_node, I_("image")); @@ -3267,6 +3264,9 @@ construct_icon_info (GtkWidget *widget, update_icon_style (widget, icon_pos); g_object_unref (icon_info->css_node); + icon_info->icon_helper = gtk_icon_helper_new (icon_info->css_node, widget); + _gtk_icon_helper_set_force_scale_pixbuf (icon_info->icon_helper, TRUE); + update_node_ordering (entry); if (gtk_widget_get_realized (widget)) diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index b096955a42..241a400e12 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -770,11 +770,14 @@ _gtk_icon_helper_get_icon_name (GtkIconHelper *self) } GtkIconHelper * -_gtk_icon_helper_new (GtkWidget *owner) +gtk_icon_helper_new (GtkCssNode *node, + GtkWidget *owner) { + g_return_val_if_fail (GTK_IS_CSS_NODE (node), NULL); g_return_val_if_fail (GTK_IS_WIDGET (owner), NULL); return g_object_new (GTK_TYPE_ICON_HELPER, + "node", node, "owner", owner, NULL); } diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h index b87e26afd8..1f869d42a7 100644 --- a/gtk/gtkiconhelperprivate.h +++ b/gtk/gtkiconhelperprivate.h @@ -68,7 +68,8 @@ struct _GtkIconHelperClass GType gtk_icon_helper_get_type (void) G_GNUC_CONST; -GtkIconHelper *_gtk_icon_helper_new (GtkWidget *owner); +GtkIconHelper *gtk_icon_helper_new (GtkCssNode *node, + GtkWidget *owner); void _gtk_icon_helper_clear (GtkIconHelper *self); void _gtk_icon_helper_invalidate (GtkIconHelper *self); diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 42249026b7..b8530b201f 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -419,11 +419,12 @@ gtk_image_init (GtkImage *image) image->priv = gtk_image_get_instance_private (image); priv = image->priv; + widget_node = gtk_widget_get_css_node (GTK_WIDGET (image)); gtk_widget_set_has_window (GTK_WIDGET (image), FALSE); - priv->icon_helper = _gtk_icon_helper_new (GTK_WIDGET (image)); + + priv->icon_helper = gtk_icon_helper_new (widget_node, GTK_WIDGET (image)); _gtk_icon_helper_set_icon_size (priv->icon_helper, DEFAULT_ICON_SIZE); - widget_node = gtk_widget_get_css_node (GTK_WIDGET (image)); priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node, GTK_WIDGET (image), gtk_image_get_content_size, diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 35a59ccb49..88f0008b50 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1087,16 +1087,17 @@ gtk_spin_button_panel_draw (GtkSpinButton *spin_button, height = gdk_window_get_height (panel); width = gdk_window_get_width (panel); - icon_helper = _gtk_icon_helper_new (widget); - _gtk_icon_helper_set_use_fallback (icon_helper, TRUE); - if (panel == priv->down_panel) { + icon_helper = gtk_icon_helper_new (priv->down_node, widget); + _gtk_icon_helper_set_use_fallback (icon_helper, TRUE); gtk_style_context_save_to_node (context, priv->down_node); _gtk_icon_helper_set_icon_name (icon_helper, "list-remove-symbolic", GTK_ICON_SIZE_MENU); } else { + icon_helper = gtk_icon_helper_new (priv->up_node, widget); + _gtk_icon_helper_set_use_fallback (icon_helper, TRUE); gtk_style_context_save_to_node (context, priv->up_node); _gtk_icon_helper_set_icon_name (icon_helper, "list-add-symbolic", GTK_ICON_SIZE_MENU); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index b4a967e81a..7e8c2a0f7d 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -484,6 +484,12 @@ gtk_style_context_lookup_style (GtkStyleContext *context) return gtk_css_node_get_style (context->priv->cssnode); } +GtkCssNode* +gtk_style_context_get_node (GtkStyleContext *context) +{ + return context->priv->cssnode; +} + static GtkStateFlags gtk_style_context_push_state (GtkStyleContext *context, GtkStateFlags state) diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h index 31f71277e8..91ce297cd4 100644 --- a/gtk/gtkstylecontextprivate.h +++ b/gtk/gtkstylecontextprivate.h @@ -30,6 +30,7 @@ G_BEGIN_DECLS GtkStyleContext *gtk_style_context_new_for_node (GtkCssNode *node); +GtkCssNode *gtk_style_context_get_node (GtkStyleContext *context); void gtk_style_context_set_id (GtkStyleContext *context, const char *id); const char * gtk_style_context_get_id (GtkStyleContext *context); |